Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: TextPad Question: why is my 'rundo.exe' not working?


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Re: TextPad Question: why is my 'rundo.exe' not working?
Date   Tue, 26 Apr 2005 11:01:18 -0700 (PDT)

Raphael,

Your Stata command contains square brackets. Are the brackets
captured with the following command?

  $dofile = WinGetTitle("")

If so, you have to add these lines to your AutoIt script, after you
remove the "TextPad - " string from the $dofile variable:

  $dofile = StringReplace($dofile,"[","")
  $dofile = StringReplace($dofile,"]","")

Friedrich Huebler

--- Raphael Fraser <[email protected]> wrote:
> Dear All,
> 
> I have tried for days to get my rundo executable to
> run using AutoIt but to no avail. I keep getting this
> error:
> 
> . do "[G:\hosmer\ex\chp1\1a.do]"
> file [G:\hosmer\ex\chp1\1a.do] not found
> r(601);
>  
> I believe there is some small adjustment in the code
> that I simply cannot locate. Here is my rundo.au3
> code, can anyone tell me what's wrong here:
> 
> ; AutoIt v3 script to run a Stata do-file from an
> external text editor: rundo.au3.
> ; Friedrich Huebler ([email protected]), 15 July
> 2004.
> ; Adapted from an AutoIt script by Dimitriy V.
> Masterov
> ; ([email protected]), sent to Statalist
> on 23 June 2004
> ;
> (http://www.stata.com/statalist/archive/2004-06/msg00699.html).
> ; AutoIt is available at
> http://www.autoitscript.com/autoit3/.
> 
> ; Declare variables (NOTE: edit if necessary before
> script is compiled)
> Global $statapath, $statawin, $dofile
> $statapath = "D:/Program Files/Stata8/wsestata.exe"
> $statawin = "Stata/SE 8.2"
> 
> ; Reduce SendKeyDelay and WinWaitDelay to speed up
> script
> Opt("SendKeyDelay", 1)
> Opt("WinWaitDelay", 200)
> 
> ; Get path of do-file from title of EmEditor window
> ; NOTE: Modify for other editors
> $dofile = WinGetTitle("")
> ; Remove "TextPad - " string from window title
> $dofile = StringReplace($dofile,"TextPad - ","")
> 
> If WinExists($statawin) Then
>   WinActivate($statawin)
>   WinWaitActive($statawin)
>   ; Activate Stata Command window
>   Send("^4")
>   ; Double quotes around $dofile are needed in case
> path contains blanks
>   ControlSend($statawin,"Stata
> Command","RICHEDIT1","do " & '"' & $dofile & '"' &
> "{Enter}")
> Else
>   Run($statapath)
>   WinWaitActive($statawin)
>   ; Activate Stata Command window
>   Send("^4")
>   ; Double quotes around $dofile are needed in case
> path contains blanks
>   ControlSend($statawin,"Stata
> Command","RICHEDIT1","do " & '"' & $dofile & '"' &
> "{Enter}")
> EndIf
> 
> 
> 
> -----------------------------------------
> Raphael A. Fraser, M.Sc.
> Assistant Lecturer in Medical Statistics
> Tropical Medicine Research Institute
> University of the West Indies
> Mona, Kingston
> Jamaica
> 
> Contact
> (876) 927-2471
> (876) 410-4699

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index