Configure Textpad for Stata11

Follow these steps.

1. Download Textpad from: http://www.textpad.com/download/#downloads

2. Download AutoIt from: http://www.autoitscript.com/autoit3/downloads.shtml

3. Download rundo.au3 and rundolines.au3 from: http://s281191135.onlinehome.us/2005/20050310_Stata_editor.html#script1

Save them to this folder: C:\ado\plus

4. Download stata.syn from: http://www.tc.umn.edu/~oakes007/pubh6617.htm

Save it to this folder: C:\ado\plus

5. Edit both the rundo.au3 and rundolines.au3 as follows:

5.1. Make sure the Global line has these commands:

Global $statapath, $statawin, $commands, $tempfile, $tempfile2, $dofile

5.2. Change the path to the correct Stata executable file, shown here:

$statapath = "C:\Program Files\Stata11/StataSE.exe"

OR

$statapath = "C:\Program Files (x86)\Stata10/wstata.exe"

5.3. Change the name of the Stata window to be correct, shown here:

$statawin = "Stata/SE 11.1"

OR

$statawin = "Stata/IC 10.0"

* Surprisingly, you cannot ignore this. It's not just a naming thing.

5.4. Add the line "$dofile = $CmdLine[1]" if you dont see it already:

; NOTE: Edit this block of commands to match the editor used

; EmEditor or TextPad: path of do-file is passed to AutoIt

$dofile = $CmdLine[1]

6. Open Autoit (start-programs-autoit-"Compile script to .exe"). NOTE that if you have installed SendtoToys already (or something on the big list, not sure what), you can just right-click the .au3 files to compile them that way).

6.1. Select the rundo.au3 file for the source (C:\ado\plus\rundo.au3), and click "Convert." The executable file rundo.exe is created in the folder.

6.2. Repeat step 5.1 to get rundolines.exe.

7. Open Textpad.

7.1. Click Configure-"New Document Class"

Document class name: Stata11SE <next>

Class members: *.do, *.ado, *.log <next>

Select "Enable syntax highlighting" and in the dropdown box, select stata.syn <next>

<finish>

7.2. Click Configure-preferences-tools-"Add" button. Add the programs rundo.exe and rundolines.exe to the tools.

7.3. While still in preferences, click Keyboard-Tools. Assign new shortcut keys to rundo and rundollines:

rundo: Ctrl+Shift+Q

rundolines: Ctrl+Shift+W

* Feel free to change shortcuts for your other favorite commands; I also made Ctrl-F and Ctrl-H call "Find" and "Replace", respectively, to conform to Microsoft products.

7.4. Back on the main Textpad screen, click View-Toolbars-Customize. Select Tools and click Apply.

8. Open up a sample .do file from Stata and run some commands.

9. Exit Textpad. Go to Start - Programs - and right-click Textpad in the menu. Add a shortcut key to it if you wish.