Backing Up Source With AutoIt

I have never liked how TradeStation bundles all of “our” source code in a library.  I have always copied my source code into a notepad text file as a back up.  Not only does this back up your source you can actually look at it without launching the EL editor.  The only drawback is having to copy to notepad and then save it.  I recently came across a very powerful window’s automation software called AutoIt.  With this FREE software you can automate a ton of mundane daily tasks.  I have created a script that runs in the background and when you compose a new Analysis Technique and hit the F7 function key it will copy the contents of the current window to a notepad text file and then all  you do is save it.  With this script you should never say I wished I had back up my source outside of the TradeStation realm.

Goto http://www.autoitscript.com and download the program.  Here is the code for the macro/script:



#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

 

HotKeySet("{F7}", "copyELD")
HotKeySet("{F8}", "terminate")

 

Func copyELD()
$window_title = WinGetTitle("[active]")
WinActivate($window_title)
Send("{CTRLDOWN}a{CTRLUP}{CTRLDOWN}c{CTRLUP}{down}")
$variable_fromclipboard = ClipGet()
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("//")
Send($window_title)
; Send($variable_fromclipboard)
Send("{CTRLDOWN}v{CTRLUP}{down}")
MsgBox(0, "The text was pasted ok", "Yep can see it")

Local Const $sMessage = "Choose a filename."
; Local $sFileSaveDialog = FileSaveDialog($sMessage, "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "ELD Text (*.txt)", $FD_PATHMUSTEXIST)
; MsgBox($MB_SYSTEMMODAL, "", "You saved the following file:" & @CRLF & $sFileSaveDialog)
Send("{CTRLDOWN}s{CTRLUP}{down}")
Send("{CTRLDOWN}x{CTRLUP}{down}")
endFunc
Func terminate()
Exit
endFunc
While 1
Sleep(10)
Wend 


Discover more from George Pruitt

Subscribe to get the latest posts sent to your email.

Leave a Reply