Last update: 6 October 2024
Download links
- For Stata 14, 15, 16 and 17 (with Unicode support):
- rundolines5.17.0.zip (416 KB), updated 29 April 2021
- rundo5.17.0.zip (416 KB), updated 29 April 2021
- For Stata 13.1 and older versions of Stata (without Unicode support):
- rundolines41.zip (244 KB), updated 22 December 2013
- rundo41.zip (244 KB), updated 22 December 2013
Table of contents
1. Introduction
2. Requirements
3. Installation
4. Using the programs
5. Known problems and troubleshooting
6. Acknowledgments
7. History of the programs
Stata is a statistical package that is available for Windows, Macintosh and Unix operating systems. This guide addresses some shortcomings of the text editor that is part of the Stata package. Stata's Do-File Editor is fully integrated and commands can be executed directly from the editor with a keyboard shortcut or the click of a button. External editors often have a richer set of features but they lack integration with Stata.
This document describes how external text editors can be integrated with Stata in a way similar to the Do-File Editor. Two free programs are offered for this purpose: rundolines.exe allows the execution of selected Stata commands from an external editor, and rundo.exe allows the execution of complete Stata do-files from an external editor. Both programs can be installed and used together or individually. I recommend installing only rundolines because it can serve the same purpose as rundo (see the explanation in section 4).
- MS Windows: The programs were tested with Windows XP, Windows Vista, Windows 7, Windows 8 and Windows 10. Macintosh and Unix operating systems are not supported.
- Stata: The programs were tested with Stata versions 8, 9, 10, 11, 12, 13, 14, 15, 16 and 17.
- Text editor: The programs were tested with Notepad++ 4.8.2 and later versions. They have also been confirmed to work with ConTEXT, Crimson Editor, EditPlus, EmEditor, PSPad, TextPad, TeXnicCenter, and UltraEdit. In addition, previous versions of the programs were reported to work with gVim, Hidemaru, jEdit, SciTE, Vim, and WinEdt.
- rundo and/or rundolines; as explained in Section 4, rundolines can be used in a similar manner as rundo and the installation of rundo is therefore optional:
- For Stata 14, 15, 16 and 17 (with Unicode support): rundolines5.17.0.zip (416 KB), rundo5.17.0.zip (416 KB).
- For Stata 13.1 and older versions of Stata (without Unicode support): rundolines41.zip (244 KB), rundo41.zip (244 KB).
Please contact the author at fhuebler@gmail.com if you use the programs with any editor besides ConTEXT, Crimson Editor, EditPlus, EmEditor, Notepad++, PSPad, TextPad, TeXnicCenter, and UltraEdit, so that the list of supported text editors can be updated.
The integration of an external text editor with Stata can be accomplished with three simple steps:
- Download and extract the rundo and rundolines programs. As noted in Sections 2 and 4, the installation of rundo is optional.
- Edit the INI files.
- Find a way to call rundo.exe and rundolines.exe from the text editor with a keyboard shortcut, a menu entry, or an icon in the toolbar.
Step 1: Download the rundo and rundolines programs and save the contents of the two ZIP files anywhere on your computer. A suggested location is the personal ADO directory of Stata, usually C:\ado\personal\. Each ZIP archive contains four files: the executable, the source code, an INI file, and a readme file.
The programs for Stata 14, 15, 16 and 17 were written and compiled with AutoIt version 3.3.14.2. The programs for Stata 13.1 and older versions of Stata were written and compiled with AutoIt version 3.2.12.1. Users who prefer to compile the programs themselves can do so with the included source code.
Step 2: Edit the INI files for the rundo and rundolines programs. rundo.ini and rundolines.ini are identical and list six options that must be edited to match the user's setup.
- statapath is the path to the Stata executable, enclosed in quotes, for example "C:\Program Files\Stata13\StataSE.exe" or "C:\Program Files\Stata17\StataSE-64.exe".
- statawin is the title of the Stata window, also enclosed in quotes, for example "Stata/SE 13.1" or "Stata/SE 17.0". The window title is shown in the center or left corner of the title bar of the main Stata program window (see Figures 1 and 2). Any text that follows the version number should be ignored (for example "- [Results]" in Figure 2).
- statacmd is the keyboard shortcut to the Stata command window. In Stata versions 8 to 11, the shortcut is Ctrl+4 (written as "^4" in the INI file). In Stata 12, released in July 2011, the shortcut was changed to Ctrl+1 (written as "^1" in the INI file); the same shortcut is used in Stata 13 to Stata 17.
- clippause is a pause after Stata commands are copied to the Windows clipboard.
- winpause is a pause between window-related operations, for example between the switch from the text editor to Stata.
- keypause is the pause between individual key strokes that are sent to Stata.
The last three options are specified in milliseconds. The default values should work for most users but they can be reduced for a faster execution of the rundo and rundolines programs. If the pauses are too short, the programs fail and no commands are passed on to Stata.
Figure 1: Stata/SE 15.0 program window in Windows 10
Figure 2: Stata/SE 13.1 program window in Windows XP
Step 3: Find a way to call rundo.exe and rundolines.exe from the text editor with a keyboard shortcut, a menu entry, or an icon in the toolbar. This example shows how the programs can be linked to Notepad++, a free text editor for MS Windows. For Stata users, Brian Quistorff has released a Notepad++ syntax highlighting file for Stata code. Other text editors can also be integrated with Stata if they provide an option to call the rundo and rundolines programs; many editors have this capability.
- rundolines:
- In Notepad++, go to the Run menu and select Run.
- Browse to rundolines.exe and enclose the entire path in quotes. For example, if rundolines.exe is saved in the directory C:\ado\personal\, the complete entry in the Run box of Notepad++ would be:
"C:\ado\personal\rundolines.exe" - Click Save.
- Enter a name, for example "Run do-lines", and select a shortcut, for example F9 (see Figure 3). Shortcuts with a Shift or Ctrl key should be avoided (see Section 5).
- Click OK.
- Click Cancel.
- rundo:
- In Notepad++, go to the Run menu and select Run.
- Browse to rundo.exe and enclose the entire path in quotes. Next, add the text "$(FULL_CURRENT_PATH)" (with quotes) after the path to rundo.exe. For example, if rundo.exe is saved in the directory C:\ado\personal\, the complete entry in the Run box of Notepad++ would be:
"C:\ado\personal\rundo.exe" "$(FULL_CURRENT_PATH)" - Click Save.
- Enter a name, for example "Run do-file", and select a shortcut, for example F10 (see Figure 4). Shortcuts with a Shift or Ctrl key should be avoided (see Section 5).
- Click OK.
- Click Cancel.
Figure 3: Notepad++ shortcut setup for rundolines program
Figure 4: Notepad++ shortcut setup for rundo program
After the programs have been successfully installed, Stata commands can be executed directly from the text editor. In the case of Notepad++, press F10 (or any other assigned shortcut) to run a saved Stata do-file. To run only a few commands, highlight the relevant lines in the editor and then press F9 (or any other assigned shortcut). To run an entire do-file with rundolines, select all commands in the text editor (for example by pressing Ctrl+A in Notepad++) and then press F9 (or any other shortcut assigned to rundolines).
The rundo program sends the path of the do-file to the Stata Command window, preceded by the word "do" and followed by Enter. If more than one instance of Stata is open, the do-file is executed in the Stata window that was most recently active. If Stata is not open, the rundo program starts Stata and then runs the do-file. Note that a do-file must be saved before the rundo program is called because it looks for the saved version of the document that is currently being edited. An alternative would be to first select the entire text in the editor and then call the rundolines program, which passes all selected lines to Stata.
The rundolines program saves the highlighted lines in a temporary file and then sends the path of the temporary file to the Command window in Stata, preceded by "do" and followed by Enter. If more than one instance of Stata is open, the commands are executed in the Stata window that was most recently active. If Stata is not open, the rundolines program starts Stata and then runs the selected commands.
Because rundolines can run either a few selected commands or a complete do-file, it can serve the same purpose as rundo. Moreover, the use of rundo may lead to error messages in Stata 14, 15, 16 and 17, which support Unicode, if a do-file was saved with another text editor (for example the Microsoft Notepad) and encoded in UTF-8 with BOM because Stata cannot read the BOM character (at the time of writing this was true for Stata 14.2 and Stata 15.0). The author of the programs uses only rundolines and recommends rundolines over rundo. rundo is not necessary and is only maintained for historical reasons.
The rundo and rundolines programs are self-contained, they do not create any files besides a temporary file with Stata commands, and they make no changes to the Windows registry. As the source code shows, the only function of the programs is to copy commands from the text editor and pass them on to Stata. However, both programs overwrite the contents of the Windows clipboard directly after they are executed because the clipboard is used to store the path to the Stata do-file.
5. Known problems and troubleshooting
Users who encounter problems during the installation or execution of the rundo and rundolines programs are advised to follow the troubleshooting steps in this section.
Known problem 1: If the rundo and rundolines programs fail, the clippause, winpause and keypause values may be too small. In that case, edit rundo.ini and rundolines.ini, increase the pause values (especially for winpause and clippause), and then run the programs again. For best results, the values in the INI files are long enough so that the rundo and rundolines programs do not fail and short enough to avoid noticeable delays before the execution of the commands in Stata. The default values in the INI file should work on most systems.
Known problem 2: A second known problem involves keyboard shortcuts to rundo.exe and rundolines.exe that use combinations with Shift or Ctrl, for example Shift+F9 or Ctrl+F10. Such shortcuts can result in a "stuck" Shift or Ctrl key in Stata. This problem affects Notepad++ and other editors. It is therefore recommended to use shortcuts without Shift or Ctrl.
Known problem 3: After an update of Stata, for example from version 15.0 to version 15.1, the rundo and rundolines programs may stop functioning if the title of the Stata window has changed (see Figures 1 and 2). If this is the case, edit the statawin entries in the rundo.ini and rundolines.ini files to reflect the correct window title (for example, replace "15.0" by "15.1").
Known problem 4: When trying to execute rundo, a user can encounter the message "Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded." This problem only occurs if step 3 of the installation instructions was not followed. In this case, please reinstall rundo and confirm that the entry in the Run box of Notepad++ is the following text, including the quotation marks (with a different path to rundo.exe, if applicable): "C:\ado\personal\rundo.exe" "$(FULL_CURRENT_PATH)". An alternative is to use only rundolines, as explained in Section 4.Known problem 5: Occasionally, the working directory of Stata is changed to the Notepad++ program folder (for example "C:\Program Files\Notepad++") after running rundo or rundolines. This problem occurs when Stata is not already open and is started by calling rundo or rundolines from Notepad++. The solution to this problem is to either start Stata first (before rundo or rundolines are called) or to reset the working directory from within Stata to the desired folder.
Known problem 6: Since Stata 14, released in April 2015, Stata supports Unicode. Rundo and rundolines version 4.1 can be used with Stata 14 but do not support Unicode. Users of Stata 14, 15, 16 and 17 should therefore use rundo and rundolines version 5.17.0, released on 29 April 2021, which support Unicode. Users of older versions of Stata, up to and including Stata 13.1, should use rundo and rundolines version 4.1 because version 5.1 may cause problems with accented characters, such as à, é, ö or ñ.
Known problem 7: Stata 14, 15, 16 and 17 support Unicode but cannot run do-files encoded in UTF-8 with BOM because Stata cannot read the BOM character at the beginning of such files. The Microsoft Notepad text editor, for example, writes text files with a BOM if UTF-8 encoding is selected. If rundo is used to execute such a file the result is an "unrecognized command" error (return code 199) in Stata 14 to Stata 17. The same error occurs if do-files with a BOM are executed from the Stata Do-file Editor. This problem can be avoided by using rundolines instead of rundo because rundolines sends the commands directly from the text editor to Stata.
Troubleshooting: The rundo and rundolines programs should function properly if the installation instructions are followed exactly. If the programs do not work, please use the steps below to test your setup. I recommend testing the rundolines program first because its internal code is less complicated than the code for the rundo program.
- Save rundolines.exe and rundolines.ini in the same folder, as described in Step 1 of the installation instructions above. Do not edit and recompile the AU3 file.
- Edit the rundolines INI file as described in Step 2 of the installation instructions.
- Add a link to Notepad++ as described in Step 3 of the installation instructions.
- Start Stata.
- Start Notepad++ and type one or more Stata commands, for example "dir" (without quotes).
- Highlight the Stata commands in Notepad++ with the mouse or by pressing Ctrl+A.
- Press F9 (or any other shortcut that was assigned to rundolines.exe) to call the rundolines program. Stata should now run the commands from Notepad++. If the commands are not executed, the rundolines program cannot find Stata because the window title in the INI file is incorrect. If this is the case, edit rundolines.ini to match the title of the Stata program window, as shown in the installation instructions. For example, note the difference between "Stata" and "Stata/SE" and specify the correct version number of Stata (e.g. "17.0"). Save the INI file and repeat steps 4 to 7 until it is possible to run commands from Notepad++ in a copy of Stata that is already open. Move on to the next step.
- Close Stata but keep Notepad++ open.
- Highlight all Stata commands in Notepad++ with the mouse or by pressing Ctrl+A.
- Press F9 (or any other shortcut assigned to rundolines.exe) to call the rundolines program. Stata should now start and run the commands from Notepad++. If Stata does not start, review the rundolines.ini file and make sure that the path to the Stata executable is correct. For example, note the difference between wstata.exe and wsestata.exe. Save the INI file and repeat steps 8 to 10.
When the rundolines program works as expected, the troubleshooting steps can be repeated for the rundo program. However, rundo.exe is more complex than rundolines.exe and may not be compatible with as many editors as the rundolines program. This possible limitation can be overcome by using rundolines instead of rundo as explained in Section 4: to run an entire Stata do-file highlight all text in the editor (usually by pressing Ctrl-A) and then call rundolines.exe.
The rundo and rundolines programs are based on previous work by Dimitriy Masterov and Eva Poen. Masterov demonstrated in a post to the Stata mailing list how a do-file can be executed from Vi. Poen showed how individual lines can be executed from WinEdt. Nicholas Winter suggested changes to the programs that made them more efficient and solved some problems with the Windows clipboard. Jeffrey Arnold described how INI files can be used to set program parameters, making it possible to distribute precompiled and thus more user-friendly versions of the rundo and rundolines programs.Others tested the programs with different editors, suggested modifications, or provided general feedback: Alexey Bessudnov, Nicholas Cox, Marcos Delprato, Dirk Enzmann, Matthew Forbes, Ari Friedman, Stefan Gawrich, Masakazu Hojo, Changhwan Kim and Haebong Woo, Keith Kranker, Randall Lewis, Kieran McCaul, Salmai Qari, Tomoyo Sakiyama, Alonso Sánchez, Raul Sanchez, Sven-Oliver Spieß, Timm Sprenger, Francisco Tschen, Renato Vargas, Robert White, Ansgar Wolsing, Amanda Tzy-Chyi Yu, and Markus Zielonka.
- July 2004: First version of rundolines.au3 sent to the Stata mailing list (see Statalist archive).
- October 2004: First version of this guide, with both scripts, released as part of "Some notes on text editors for Stata users".
- March 2005: Scripts revised to work with Stata 7 and 8.
- March 2005: Expanded guide added to my blog on international education statistics.
- April 2005: Guide and scripts added to my website, with direct download links.
- 6 June 2005: Version 2.0 of scripts released, with support for Stata 9. The scripts are now compatible with Stata 7, 8, and 9. Scripts work with more than one instance of Stata. Scripts no longer rely on the built-in editor of Stata. New version of this guide.
- 8 June 2005: Version 2.1 of scripts released. Fixed problem with the clipboard that was reported by some users: scripts no longer attempt to restore clipboard or text in Stata Command window.
- 30 June 2005: Version 2.1.1 of rundolines script released, with minor bug fix related to clipboard.
- 26 September 2005: Version 2.2 of scripts released. The scripts are now compatible with Stata 9.1, released on 15 September 2005.
- 22 June 2006: New section added to the guide: Supported editors.
- 28 January 2007: The list of supported editors now includes EmEditor, gVim, Hidemaru, jEdit, Notepad++, SciTE, TextPad, Vim, UltraEdit, and WinEdt.
- 26 April 2008: The following editors have been confirmed to work with the scripts: Crimson Editor, EditPlus, EmEditor, gVim, Hidemaru, jEdit, Notepad++, SciTE, TextPad, Vim, UltraEdit, and WinEdt.
- 27 April 2008: Version 3 of the rundo and rundolines programs was released. The programs are now precompiled and no longer require installation of AutoIt. On the occasion of the new release, the previous guide to integrating Stata with external text editors was replaced by a new version of the guide.
- 22 June 2008: Section on troubleshooting added to this guide.
- 12 October 2008: The rundo and rundolines programs have been confirmed to work with Windows Vista. The acknowledgments section of this guide was expanded.
- 8 January 2009: The section on known problems and other parts of the guide were revised.
- 30 March 2009: Version 3.1 of the rundo and rundolines programs was released, with a bugfix. Version 3 of rundo.exe pointed to rundolines.ini instead of rundo.ini. Users who had only installed the rundo program received an error message when they tried to execute a do-file. The code of rundo.exe and rundolines.exe was also updated to version 10.1 of Stata. Both programs continue to work with older versions of Stata.
- 31 August 2009: INI files updated to support Stata 11.
- 17 April 2011: INI files updated to support Stata 11.2.
- 14 August 2011: Version 4 of the rundo and rundolines programs was released. The new programs support Stata 12, released in July 2011. To be compatible with all versions of Stata, it was necessary to add an option to specify the keyboard shortcut to the Stata command window. In Stata versions 8 to 11 the keyboard shortcut is Ctrl+4, in Stata 12 it is Ctrl+1. Users who upgrade from an older version of Stata to Stata 12 must install version 4 of the rundo and rundolines programs. Users of Stata 11 or previous versions of Stata can continue to use version 3.1 of the programs, which have been archived at these links: rundo3.zip (240 KB), rundolines3.zip (240 KB).
- 21 June 2012: The rundo and rundolines scripts are now hosted at Dropbox. This change was necessary because I no longer maintain a separate website at huebler.info, where I had previously hosted the scripts.
- 22 December 2013: Version 4.1 of rundo and rundolines was released. The programs are unchanged but the INI files were updated for Stata 13. The guide to integrating Stata and external text editors on this page was also revised and the troubleshooting section was expanded.
- 18 April 2015: Version 4.2 of rundo and rundolines was released. The programs are unchanged but the INI files were updated for Stata 14. The guide to integrating Stata and external text editors on this page was also revised.
- 28 June 2015: Version 5.0 of rundo and rundolines was released, with Unicode support for Stata 14. Version 4.2 was withdrawn. Users of Stata 13.1 and older versions of Stata should use version 4.1 of rundo and rundolines. The instructions in this guide were revised.
- 1 July 2015: Information on Unicode added to sections 4 (Using the programs) and 5 (Known problems and troubleshooting).
- 28 June 2017: Version 5.1 of rundo and rundolines was released, with Unicode support for Stata 14 and Stata 15. This guide was updated.
- 29 April 2021: Version 5.17.0 of rundo and rundolines was released, with Unicode support for Stata 14, Stata 15, Stata 16 and Stata 17.
- 6 October 2024: This guide was updated with new download links for all versions of rundo and rundolines. Broken links to other sites were replaced or removed. I don't plan any additional updates of the rundo and rundolines programs, for example to Stata 18 (see "A note on the future of this blog").
Related articles
- Guide to creating maps with Stata
- Guide to creating PNG images with Stata
- Guide to integrating Stata and external text editors (archived version of this guide, no longer maintained)
External links
- Stata
- Notepad++
- Notepad++ download page
- Notepad++ syntax highlighting file for Stata code
- AutoIt
- Some notes on text editors for Stata users
Friedrich Huebler, 27 April 2008 (edited 6 October 2024), Creative Commons License
Permanent URL: http://huebler.blogspot.com/2008/04/stata.html
Friedrich Huebler,
ReplyDeleteI did as you explained and now I'm using notepad++ to write and run my do-files!! (I chose notepad++ b/c there is a free user-defined Stata language written for it.)
Thank you so much!
This program makes life so much easier....
ReplyDeleteHowever I recently ran into some problems. I installed it on a different computer and suddenly rundolines won't allow more than 100 lines, if I select more it simply takes the first couple of lines. Any idea what might cause the problem? Thanks for your help.
stefan__pichler@hotmail.com
Stefan, it is difficult to diagnose the problem from your description. Did you install the latest version of the program and did you follow the instructions above? Please send me an email with more information about your setup (version of Stata, text editor, operating system) and attach your INI file. Thanks.
ReplyDeleteHi, after following your instructions I get the following error with both rundo and rundolines:
ReplyDeleteLine -1:
Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.
I use STATA 12/IC. Any idea?
Thank you, Israel
Israel, it looks like you didn't enter the correct text in the Run box of Notepad++. Please see step 3 of the instructions.
ReplyDeleteFriedrich -
ReplyDeleteI am getting the error that was commented on in August 2012 ("Array variable has incorrect number of subscripts..."), but only for rundo. I made the correction you pointed out in the follow up comment and it is still an issue.
Specs: STATA SE 10.1
Notepad++ v6.2.2
Windows 7 64 bit
rundolines works fine, which is odd.
Foote, the problem you encountered only affects rundo, not rundolines. A few users have reported this problem with rundo and without exception they were able to solve it by following the instructions under Step 3. Please confirm that the entry in the Run box of Notepad++ is indeed exactly the following text (with a different path to rundo.exe, if applicable):
ReplyDelete"C:\ado\personal\rundo.exe" "$(FULL_CURRENT_PATH)"
If rundo still does not work I would recommend that you restart the installation and make sure that you follow all instructions above.
Hi Friedrich,
ReplyDeleteHaving trouble with the installation. Have done the troubleshooting steps, and seems to fail at the first part, where even when stata is opened before notepad++ it doesn't work.
1. Is it necessary to set-up both scripts for rundolines to work? I only set up rundolines.
2. I was looking at the script in the .au3 file - and the stata directory and stata title designations were not my own - should I modify those to match my directory and stata version?
Thanks,
rs
Hi Friedrich,
ReplyDeleteThank you for your great tutorial. I just have one problem.
The .exes run fine for me. Stata opens and the code is transferred. However, the only problem is, after running the .exe, the directory of Stata becomes "C:\Program Files (x86)\Notepad++" and not the directory of the .do file that is used. I've reinstalled your files, I've also tried compiling the .au3 files myself, also trying another site and their tutorials. I have increased winpause, clippause and keypause to 3x their amount.
Do you have any idea what's causing this?
All the best and thanks one again for the tutorial,
Ryan.
Further to my previous post, my shortcuts.xml in my appdata folder looks like this:
ReplyDelete"C:\Users\ryan.pollard\Desktop\Notepad\rundolines4\rundolines.exe"
"C:\Users\ryan.pollard\Desktop\Notepad\rundo4\rundo.exe" "$(FULL_CURRENT_PATH)"
I also have other methods which have the same problem which can be seen here:
"C:\Users\ryan.pollard\Desktop\Notepad\SEND2STATA.KAK.EXE" do "$(FULL_CURRENT_PATH)"
"C:\Users\ryan.pollard\Desktop\Notepad\SEND2STATA.KAK.EXE" include "$(FULL_CURRENT_PATH)"
"C:\Users\ryan.pollard\Desktop\Notepad\SEND2STATA.KAK.EXE" run "$(FULL_CURRENT_PATH)"
"C:\Users\ryan.pollard\Desktop\Notepad\RUNDOLINES.KAK.EXE"
"C:\Users\ryan.pollard\Desktop\Notepad\HELPDOLINES.KAK.EXE"
Ryan wrote that the working directory of Stata changes to the directory in which Notepad++ is installed after running rundo or rundolines. I have observed the same on occasion but have not identified a clear pattern of the circumstances under which this problem occurs. It may be caused by my programs, by Notepad++ or by Stata. I don't think it has anything to do with the settings in the INI files or with the shortcuts Ryan listed in his follow-up post. If any users of rundo or rundolines with the same problem could send me additional information I may be able to offer a solution. Thank you.
ReplyDeleteA belated response to the message by rs of 10 May: It is not necessary to install both scripts, rundolines alone works fine. It is also not necessary to edit the AU3 scripts - in fact, I would advise against that - because all settings can be controlled with the INI file. Lastly, the link from Notepad++ to rundolines or rundo must be set up correctly (see Step 3 in the instructions).
ReplyDeleteI am a heavy user of stata. Your efforts to bring a new fresh to my research is greatly appreciated.
ReplyDeleteThank you!!
From Seoul, Korea
I have the exact same problem described by Ryan. It happens every time. I don't have anything to add though (I'm also using State SE 12 and Notepad++ v6.4.5
ReplyDeleteFor users with the problem described in comments from 24 May and 1 October 2013 (Stata working directory changed to Notepad++ directory), please see "Known problem 5" in the Known problems and troubleshooting section.
ReplyDeleteMy rundolines used to work fine--- since I "upgraded" to Stata/MP-64 rundolines no longer works (using your dec 2013 edited version)--- now when I hit F9 a new instance of stata starts--- butbeyond that the highlighted command does not run.
ReplyDeleteAny thoughts?
Peter Franks
Peter, check your INI file and confirm that all settings are correct, especially the variable "statawin". It appears that the title of the Stata window is not the same as with your previous version of Stata.
ReplyDeletethanks
ReplyDeleteIt turns out that although the correct initial reference to stata in the "statapath line is "stataMP-64
as in
statapath = "C:\Program Files\Stata13\StataMP-64.exe"
in the statawin line the 64 should be omitted as in
statawin = "Stata/MP 13.1"
I can't tell you how useful this integration has been for me.
ReplyDeleteI have one question though - I use rundolines from UltraEdit.
Sometimes, when I am submitting multiple programs to multiple instances of STATA, STATA seems to mix the code. It'll suddenly try to run a chunk of code that belongs to one of the other programs. Is it possible that this occurs due to using UltraEdit? Or is this a STATA issue?
Again, thank you very much for creating this.
If you have multiple instances of Stata, rundolines calls the instance of Stata that was most recently active. As a result, Stata commands can be sent to the wrong instance of Stata. To send the code to the intended instance of Stata, activate the Stata window before running rundolines from UltraEdit.
ReplyDeleteThank you for your rapid response! I think I need to clarify what I was asking:
ReplyDeleteI'm fairly positive my issue isn't pointing the code to the correct instance of STATA initially, instead that it is after I've sent code to multiple instances that the random chunk of "other" code appears. The fact that the code that appears is random illustrates that I'm not simply sending multiple programs of code to the same instance of STATA (one would think if I was doing that, I would see the code from the second sent program from start to finish, or start to crash, whichever comes first, when it appears). This code does not appear immediately either, and I can also see it run in the instance it was intended for.
The fact that it is not immediate is the part that worries me most. Sometimes it may be 30 minutes later, with both programs chugging away until then. I think it might have something to do with the way rundolines interacts with tempfiles to submit to STATA, since when I run many instances of programs from do-editors I have never experienced the same phenomenon. Have you ever experienced this or heard of it happening?
Thank you, again, for your time.
I am afraid I cannot answer your question. It could have something to do with the temporary files. Usually I have only one instance of Stata open, occasionally two or three, and I have not encountered the problem that you described. I have also not heard about this from other users.
ReplyDeleteHelp with Vim User
ReplyDeleteThank you for your effort in writing the program and making it freeware.
Could you give more specific instruction on how to implement the two programs in Vim? I saw it in the list but have no idea of how to implement it.
I tried to call it from command line in Vim through typing the following in the normal mode:
:!C:\...\rundo.exe
The error message is the same when I tried to open the rundo.exe file directly, which says:
Line -1:
Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.
Linfeng, the error message indicates that you are not calling rundo correctly from Vim. Please read "Known problem 4" in the "Known problems and troubleshooting" section. If that doesn't help you may want to consider using Notepad++ instead of Vim. I am unable to give specific advice for Vim because I have never used this editor.
ReplyDeleteThanks a lot for this, it's been extremely helpful for years.
ReplyDeleteI've got an issue now, rundo or rundolines are not launching stata for me when it's not running (they work fine when stata is already open). I suspect it is because my executables are running from a network. The ini files are setup correctly, but they just won't launch stata. And When I open stata manually, after running rundolines, it automatically starts executing the order which had been sent before.
Any ideas about this? thanks a lot!
Daniel
Daniel, you wrote that the commands are executed when Stata is already running. The fact that rundo and rundlines fail when Stata isn't already running indicates that the path to the Stata executable in the INI files is incorrect. It shouldn't matter if Stata is installed on a network. Please see step 10 in the troubleshooting section above.
ReplyDeleteit was as simple as that...there was a change in the folder naming convention used relative to previous stata versions, and I just hadn't looked carefully enough. Thanks a lot Friedrich!
ReplyDeleteDaniel
I'm using sublime text 2, stata 14, and windows 7. I get the sticky control issue described above, and if instead I use alt+enter I get the same problem with the alt key.
ReplyDeleteIs there any other workaround?
Thanks
Not perfectly works for me. I always have to point-and-click "Run" in Notepad++ and then choose "F9" in order to run do lines.
ReplyDeletePressing F10 key to run the entire do file works, though.
How can I make pressing the key to run the program work?
Thank you very much!
Thanks so much for a great program. I've been using it for years and have really appreciated it!
ReplyDeleteI'm installing it on a new work computer where I no longer have adminstrator access, and I've run in to the following problem. Both rundo and rundolines are able to call Stata, but when using rundolines, Stata is throwing me back the error "file C:\Users\LAN-W[maskedforprivacy]\AppData\Local\Temp\statacmd.tmp not found". I believe this is because the LAN-W[maskedforprivacy] folder belongs to my supervisor and I don't have access to it (however, it was using his admin password that allowed me to install Stata and Notepad++).
If indeed this is the problem, how would I go about editing the location where the temporary files are stored?
Thanks in advance for your help and for a great program!
Follow-up to my previous comment - I was able to solve my own problem by editing the rundolines au3 file $tempfile macro to directly call my local temp folder rather than the network folder it had been calling. Thanks!
ReplyDeleteJulia, the rundolines script uses the temporary folder of Windows. You can find where this folder is located by entering "%temp%" in the address bar of the Explorer or in a Windows Run box. The typical location of the temporary folder is C:\Users\User Name\AppData\Local\Temp. It seems odd that you would use the same temporary folder as another user on your PC. I would first try to confirm that temporary files are stored in your own temporary folder. rundolines should use the same location. In the rundolines script, this is controlled by the following line:
ReplyDelete$tempfile = EnvGet("TEMP") & "\statacmd.tmp"
As a last resort, you could edit the line above to point to a different folder and recompile the script, but I don't know what the consequences would be and cannot recommend such a modification of the program.
Thank you so much for this, this is really helpful, and I can't see myself using the Stata editor anymore!!
ReplyDeleteHowever, the last version of rundo51.zip is identified by Windows Defender as containng Trojan:Win32/Fuery.B!cl
Could you please clarify?
Greetings! Everything works well in my case with rundolines, except that it fails to paste the do-file parts into the Stata command window on my brandnew laptop (up-to-date Win 10 and Stata 15.1). I have checked all settings various times, set up everything from scratch three times - to no avail. It only works if I manually Ctrl-V in Stata. Any hints where the problem could be situated?
ReplyDeleteThanks!
Daniel
If you download rundo or rundolines from this website and get an alert from your antivirus software, this is likely to be a false positive. If this happens to you, you can report the problem to the maker of your antivirus software. For more information, please read AutoIt and Malware.
ReplyDeleteIf rundo or rundolines don't work as expected, please reinstall them and follow the instructions exactly as they are written.
ReplyDeleteHello,
ReplyDeleteI followed the install instructions ( for both rundolines and rundo). However,when I execute the do file from notepad++ Stata only opens a new window and doesn't run the instructions specified on the do file. The command "pwd" shows me this route "C:\Program Files (x86)\Notepad++".
Thanks for your help
I have seen this error occasionally but don't know what causes it. The best advice I can give is to start over and follow the instructions for installation precisely. Please also read the section "Known problems and troubleshooting".
ReplyDeleteI've done everything following the step by step guide, but I just see a "script paused" alert after stata is launched. I get nothing except opening a stata windows with either rundolines or rundo.
ReplyDeleteJuan, I am afraid I have no other suggestions.
ReplyDeleteHello,
ReplyDeleteI was trying to download rundolines51.zip (412 KB) but I got an error from Dropbox that doesn´t allow me to get the file. I tried different browsers and internet connections, but I always get the same error message. I was wondering if the file is no longer available?
Thanks a lot for any clarification
The file is available and it should be possible to download rundolines51.zip. It may be a temporary problem with Dropbox. If the link still doesn't work, please post here again or email me.
ReplyDeleteHello,
ReplyDeleteThe Dropbox link for rundolines51.zip (412 KB) seems in error again. I was wondering if you could update the link again at your convenience?
Sincerest thanks to you!
Hi - the file is still not working. I am a different user but am getting the same error message. Thanks for thelp!
ReplyDeleteI updated the download links for all versions of rundo and rundolines.
ReplyDelete