Stata-support package (v1.02) for WinEdt 9

Author: Jeroen SL de Munter (jeroendemunter@gmail.com)

Description
###################################################################

The Stata-support package for WinEdt adds functionality to edit
Stata syntax from within WinEdt and send it to the Stata program
for execution.


Features
###################################################################

* Highlighting similar to the native Stata DO file editor (at least
  for most of the basic commands).

* Send a selection of syntax, or the whole syntax file to Stata.

* Open Stata from within WinEdt.

* Stata mode for .DO and .ADO files.

* Stata document templates for .DO and .ADO files.

* Independent of the installed Stata version.


Version info
###################################################################

v1.02 (2015-April-15)

Feature: Stata-mode now restores the clipboard item you had on the
clipboard before sending syntax to Stata.

Bugfix: The default for rundo.exe is now to look for a window
called "Stata" (instead of a version specific Stata window in the
previous version). Same applies for the WinEdt window. The script
is hopefully more robust after software changes/updates.

Bugfix: There is this open bug in AutoIt that causes the CTRL key
to hang (remain pressed) after sending modifier keys (like CTRL)
with rundo.exe. Added some work-around code in rundo.au3 to fix
this issue.

Changed: Rundo.exe is now 64-bit binary, but the 32-bit binary is
also provided in case you are running a 32-bit machine.

Updated: All Stata versions should work, but after installation
the default version is now updated to version 13 (64-bit) located
in: C:\Program Files (x86)\Stata13\Stata-64.exe. In case you have
a different Stata version, you can set your own version in the
Stata-support dropdown menu.

Updated: The AutoIt script that is used to create the Rundo.exe
binary is slightly updated to give more feedback in case of some
common errors after running Rundo.exe, which should make debugging
in the future more user friendly.


v1.01 (2013-may-01)

The installer is updated thanks to Karl Koeller.

Added Stata document templates for DO syntax and ADO programs
(Added Templates-Stata-support.ini).

Updated highlighting to match Stata DO file editor more accurately
(Updated Keywords-Stata-support.ini).

Updated shortcut-keys to match Stata DO file editor (DO selection:
Ctrl+D, DO file: Shift+Ctrl+D, updated MainMenu-Stata-support.ini).

DO files are now saved before sending commands to Stata (Updated
MainMenu-Stata-support.ini).

v1.00 (2012-nov-26)

Uploaded to Winedt.org


Current issues/Todo
###################################################################

Please let me know if you experience any issues running
"Stata-support" in WinEdt. Or if you want to contribute your
efforts to improve Stata-support. Below are some of the open issues
which I will look into once I have some spare time.

Add select line (Ctrl-L), delete line (Ctrl+Shift+L) shortcut in
Edit mainmenu

Toggle: show line-breaks, view whitespace (like in Stata DO editor)

Stata dictionary is outdated, syntax highlighting schemes
could be updated to reflect native Stata editor more closely, e.g.
star-comments (* comment) should also be highlighted in green if
there is only space characters in front, some of the newer commands
in Stata are not recognized in Stata-support.

Code folding would be a nice feature to add, for example with
multi-line forvalues loops { } and multi-line comments /* */.


Installation
###################################################################

Open the install.edt file in WinEdt

Press Shift+Ctrl+F9 (Execute current macro)


How does it work
###################################################################

Stata-support makes a call to the Rundo program including a couple
command-line parameters. Rundo decides what to do based on these
parameters. Basically, Rundo is an automated collection of keyboard
shortcuts to get Stata to run the syntax that is edited in WinEdt.

Rundo.exe was compiled using Autoit, which is basically a script
that executes some keyboard shortcuts. The source is included with
the distribution of Stata-support.



Remove Stata-support from WinEdt
###################################################################

Just run the Uninstall Stata-support option from the Stata-support
main menu menu-item.

Please note that if you changed some of the Stata-support specific
preferences in the Options Interface (Switches.ini, Keywords.ini,
FilterSets.ini, and/or ActiveStrings.ini), you might have to remove
some items manually.



Acknowledgements
###################################################################

The idea to create Stata-support for WinEdt came from working with
R-Sweave in WinEdt, which adds R functionality to WinEdt. Many
thanks to Gilbert Ritschard and Karl Koeller for the inspiration.

An earlier attempt to make Stata run and display syntax files in
WinEdt was posted by Philip Greenwood. The Stata command
dictionary, syntax highlighting, active strings, etc. were kindly
borrowed and slightly adapted to work with recent versions of
WinEdt and Stata.

The method for integrating Stata in external text editors was
adapted from a method originally posted by Friedrich Huebler. More
information available from http://huebler.blogspot.se/2010/08/stata.html

Autoit v3.3.12.0 was used to compile the rundo.exe executable,
source is included in this distribution.
