Re: st: AppleScript and StataSE

> Running the following Applescript from the Script Editor
> --
> tell application "StataSE"
> activate
> open file "myfile.do"
> end tell
> --
> where myfile.do is in the active directory of Stata (Stata Data in this
> case) gives the error message:
>
> "StataSE got an error: File some object wasn't found"
Your path is wrong. A true HFS path precedes a filename with a : to specify
the current working directory. You should've entered:
tell application "StataSE"
activate
open file ":myfile.do"
end tell
To specify an absolute path, enter:
tell application "StataSE"
activate
open file "Macintosh HD:Users:someuser:Desktop:myfile.do"
end tell
Stata's HFS paths follow the POSIX model in that absolute paths start with a
path delimiter (in this case, a colon) and relative paths do not. Macintosh
HFS paths are the opposite.
> Any thoughts on these errors? The FAQ on text editors suggests this or
> some variant (not the one posted) should work.
I didn't see where this was suggested but it does work.
-Chinh Nguyen
cnguyen@stata.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/