Announcement

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

  • Change file association for .do files in Windows 7 to open in do-file editor

    Dear Statalisters,

    When I double-click a .do file in Windows 7, it opens the Stata 13 executable, but it does not open the .do file in the do-file editor as I would prefer.

    I tried resetting the file associations as described in this 2010 Statalist thread, but it did not work. (The result was that double-clicking opened in the .do file in a standalone text editor.)

    I also tried resetting the Windows Registry key HKEY_CLASSES_ROOT\Applications\StataMP-64.exe\shell\open\command to "C:\Program Files (x86)\Stata13\StataMP-64.exe" "doedit %1" but that did not help, either.

    I would very much appreciate your suggestions.
    Last edited by David Radwin; 12 Nov 2014, 15:04. Reason: double incidence of signature
    David Radwin
    Senior Researcher, California Competes
    californiacompetes.org
    Pronouns: He/Him

  • #2
    David,

    You probably already know this, but opening a .do file in the do-file editor is the default behavior, so you need to figure out how the default behavior got broken. Because this is the default, the documentation is not very forthcoming regarding how to change it.

    What happens when you right-click on a .do file? You should have the option to either "Open" (which should open the editor) or "Execute(do)" or "Execute Quietly (run)" . If that is not the case, perhaps that will give you some clues as to what got messed up.

    The nuclear option is, of course, to re-install Stata.

    Regards,
    Joe

    Comment


    • #3
      It might be too late for this since you went into deep settings already, but if you right-click and choose "choose default program" Stata *should* show up.

      Comment


      • #4
        Thank you Ben and Joe.

        Ben, I tried changing Stata to the default program, but after that double-clicking a do-file merely opens Stata but not the do-file.

        Joe, I don't have the Execute options when I right-click a do file. I just have Open. See attached screen shot.

        Obviously something is messed up. I would have to get our IT department to reinstall Stata, which make the nuclear option even less appealing.
        David Radwin
        Senior Researcher, California Competes
        californiacompetes.org
        Pronouns: He/Him

        Comment


        • #5
          I have done it this by changing a setting: In Stata, open the do-file editor. In the do-file editor, choose Edit>Preferences>Editor. In the box "Advanced" one can select to "Edit do-files opened from Windows instead of executing them." I hope this helps.

          Comment


          • #6
            Thank you, Jørgen, but unfortunately that did not work for me. I think I have to wait until I get Stata 14.
            David Radwin
            Senior Researcher, California Competes
            californiacompetes.org
            Pronouns: He/Him

            Comment


            • #7
              David,

              Have you tried something like this? http://defaultprogramseditor.com/
              I once messed up my "edit do file" option and this allowed me to fix it.

              Simple usage:
              - Open program
              - File type settings
              - Context Menu
              - type ".do" in search, scroll and click
              - Look for "Edit" option.
              - If it does not exist, select Add
              - Command name is "Edit". Program path is something like: "C:\Program Files\Stata13\StataMP-64.exe" doedit "%1" (be sure to point to the correct program files, either default or x32)

              Best,
              S


              Comment


              • #8
                Thank you Sergio. I did try using some program (I can't remember if it is the one you mentioned), but it did not work.
                David Radwin
                Senior Researcher, California Competes
                californiacompetes.org
                Pronouns: He/Him

                Comment


                • #9
                  Did you contact Stata tech support?

                  Comment


                  • #10
                    Thanks, Friedrich, but now I'm hoping it will go away with an upgrade to Stata 14, whenever I get that.
                    David Radwin
                    Senior Researcher, California Competes
                    californiacompetes.org
                    Pronouns: He/Him

                    Comment


                    • #11
                      Update: Upgrading to Stata 14 did not solve the problem, but getting a new computer did.
                      David Radwin
                      Senior Researcher, California Competes
                      californiacompetes.org
                      Pronouns: He/Him

                      Comment


                      • #12
                        I am now having this problem with Stata 15 on my Windows 7 operating system. I have tried all of the suggestions above, including the free software.

                        Now that I did the "reset file associations" in Stata 15, even Stata 14 does not come up as an option.

                        I can do without this feature, of course, but it is annoying. Any advice? Many thanks.

                        Comment


                        • #13
                          Update - I went back in to defaultprogramseditor and was able to reset using a different method than was outlined above. Instead of clicking on "context menu" I clicked on "Change 'open with' programs". Hope that helps someone.

                          Comment


                          • #14
                            This post helped me solve the same problem after my office computer was upgraded to Stata 15. Here are the steps I used (Windows 7): I typed 'regedit' at the start menu command. It opened the Registry Editor. I looked for Applications>StataSE-64.exe>shell>open>command. A left click on '(Default)' to modify value data to the new path of Stata15 and then added "%1" right after. My attempts entering "doedit%1" or doedit"%1" as suggested above didn't work.

                            Comment


                            • #15
                              Well, I finally fixed the problem on my machine after getting Stata 15 (thanks to a coworker's how-to instructions). The trick for me was to use DefaultProgramsEditor.exe (see post 7 above) and follow this sequence:
                              1. Select "File Type Settings"
                              2. Select "Context Menu"
                              3. Select ".dta" using the search feature
                              4. Select "Edit Selected Command…" button (for the Open command)
                              5. Paste this text in the Program path, including quotation marks: "C:\Program Files (x86)\Stata15\StataMP-64.exe" "%1"
                              6. Copy and paste this text in the Program path: "C:\Program Files (x86)\Stata15\StataMP-64.exe" "%1"
                              7. Repeat steps 4-6 for the Edit command (this step may be unnecessary)
                              8. Select "Save Context Menu"
                              9. Select "OK"
                              10. For the do-file editor, repeat steps 2-8, except use ".do" in step 3 and "C:\Program Files (x86)\Stata15\StataMP-64.exe" doedit "%1" in step 5
                              I hope it doesn't take anyone else three years to solve this!
                              David Radwin
                              Senior Researcher, California Competes
                              californiacompetes.org
                              Pronouns: He/Him

                              Comment

                              Working...
                              X