StataUser Posted June 25, 2004 Share Posted June 25, 2004 Dear all, I am a Newbie with AutoIt. Please excuse if this is very basic. What I try to do: Process my Stata do-files (Stata is a statistics software) from within my favourite text editor WinEdt. Stata should be opened, if not already running, but not made active. Then the line "do $CmdLine[1] {Enter}" should be sent to the command line of Stata. I have some problems doing this. Here is what I tried (I found this on statalist: http://www.stata.com/statalist/archive/200...msg00699.html):If WinExists("Intercooled Stata 8.2") Then WinWaitActive("Intercooled Stata 8.2") Send("do " & '"' & $CmdLine[1] & '"' & "{Enter}") Else ;Run Stata Run("C:/Programme/Stata8/wstata.exe") WinWaitActive("Intercooled Stata 8.2") Send("do " & '"' & $CmdLine[1] & '"' & "{Enter}") EndIfWith this, the line "do $CmdLine[1]" is only executed when I click on the Stata window to make it active. But I would rather like to skip this and directly look at the log file in the editor. So I tried with WinWait("Intercooled Stata 8.2")instead, but this resulted in "do " & '"' & $CmdLine[1] & '"' & "{Enter}" being send to my editor window instead, if Stata was not already running.Is there some way I can do this? It is very important that I can also send the {Enter} , else Stata won't execute the do-file. I'd be grateful for any pointers. Best, Eva Link to comment Share on other sites More sharing options...
Developers Jos Posted June 25, 2004 Developers Share Posted June 25, 2004 You could do it this way: WinWait("Intercooled Stata 8.2") WinActivate("Intercooled Stata 8.2") Send("do " & '"' & $CmdLine[1] & '"' & "{Enter}") Or check if you can do a ControlSend which is even better, but you need to figure out the control to send it to. This can be done wit AU3_Spy.exe. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
StataUser Posted June 26, 2004 Author Share Posted June 26, 2004 Hi, thanks a lot! I used AU3_Spy.exe and than tried a ControlSend, and it worked just like I wanted. Best, Eva Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now