Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Associate mata-files and ado-files with the Stata Do-file editor

    Hi
    This might be the wrong forum.
    In that case I apologize. But for me this problem started with mata-files.

    In windows when I double click a do-file Stata opens with the file in the editor.

    What must I do to make the same happen for mata-files? And ado-files?
    All I get get in both cases are:
    . C:\ado\personal\mymata.mata
    unrecognized command: C
    I can see that when a do-file is double clicked then (unlike the 2 other file types) the full path is put in qoutes and prefixed by doedit in the command.
    Is there a place where I can set this?
    Kind regards

    nhb

  • #2
    Hi Niels
    It does not answer entirely your question, but you can (do)edit .mata and .ado files within Stata with the user-written package dirtools written by Ulrich Kohler and Row Wada. The package allows you to list files and edit them with the help of hyperlinks.
    Windows is apparently not aware that it has to run the command doedit when it comes to .ado and .mata files. I don't know how exactly you can change this behavior, but my guess is that you have to change some of the System parameters. Maybe you should ask Stata Technical support.
    Best
    Christophe

    Comment


    • #3
      Hi Christophe
      Thank you for the answer.
      I'll publish the answer from technical support here when I get it.
      Kind regards

      nhb

      Comment


      • #4
        A small correction to Christophe's post: the co-author of dirtools is Roy Wada.
        Steve Samuels
        Statistical Consulting
        [email protected]

        Stata 14.2

        Comment


        • #5
          Hi
          Here is what I got from Stata:

          The behavior of double clicking on a file is handle by the operating system's file associations.

          In the past you could manually edit the file associations on Windows XP. To be able to edit them on a more recent version of Windows requires a tool to restore the functionality that was removed.

          A good resource to be able to edit the file associations on modern Windows can be found below:

          http://superuser.com/questions/22933...-and-windows-7

          These tools can let you create new file associations or edit existing ones. The simplest way to get the same behavior for *.ado and *.mata files it to copy the current associations for *.do and add them to the other extensions.
          To the question: Since Stata does the "right" setting for do-files why this isn't done for ado og mata files? The answer is:
          We want all users to double click on a do-file and DTA file and have the operating system launch Stata.
          The ado and mata files are used by only the advanced programmers so we do not wish to have them open up in the do-file editor automatically because we want to reduce the number of accidents for new users.
          Advanced programmers can change the file associations to behave exactly as they want so they are not limited by the default behavior.
          I've tried one the links (FileTypesMan) and now I can right-click and choose to get ado or mata files in the do-file editor.

          It is interesting to note that Microsoft (I've been skimming the text at link) have made it harder to make that kind of association and hence a small amount of solutions have appeared to remedy the problem.

          In view of that I find it strange that Stata Corp doesn't just insert a setting or 2 to make it easier for me and others, not so advanced programmers. That shouldn't take very long to do so.
          Off course the problem could be mine alone and hence no change is needed

          Anyway this is what is said and done in the case. I hope others can use it.
          Kind regards

          nhb

          Comment


          • #6
            I tried this so that ado files can open in Stata Do-File Editor when double-clicked:

            Control Panel -> Default Programs -> Associate a file type or protocol with a program

            There in the list, .do file is associated with Stata. So I select .ado file and associate it with Stata. However, when I double-click ado files now, Stata starts with an error message "unrecognized command: C" thinking that drive C:\ is the command. My impression is that when a do file is double-clicked, Stata checks if the file is a do file, and opens the editor accordingly with a doedit command (or maybe there is something else going on in the file association, I don't know) Since ado is not a do file, Stata doesn't do anything with it. How do you fix this?

            Comment


            • #7
              Hi Cyrus
              Follow the guidelines in #5 to remedy this. As you can see what you did isn't enough.
              If it is any consolation I don't think there is any harm done when you doubleclick on an ado-file.
              It is just not what you wanted.

              Regards/nhb
              Kind regards

              nhb

              Comment


              • #8
                Thank you, Niels. I used Default Programs Editor that I downloaded from http://defaultprogramseditor.com/. It's a standalone program and it doesn't require an installation if the Windows component's installed on the computer.

                Default Programs Editor worked well to associate ado files as do files. Now when I double-click an ado file, it opens in the do-file editor of Stata. So nice!

                I wish StataCorp could make this easier for us by adding an option in the preferences to associate ado files as do files. So that Stata wouldn't install that way, but advanced users can select that option later after installing Stata to associate ado files as do files.
                Last edited by Cyrus Levy; 31 May 2016, 08:45.

                Comment

                Working...
                X