How to run AppleScript file from sikuli: run("osascript some.applescript")

Asked by Chetan

is there a way to directly run .applescript file from sikuli
we are able to run script by passing string in runscript but we have an .applescript file say tests.applescript and would like to run it directly

any sample code would be appreciated

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said (last edit ):
#1

this works having the AppleScript text in the running script:

runScript (
"""
applescript
display dialog \"hello\"
"""
)

See: https://sikulix-2014.readthedocs.io/en/latest/scripting.html#runScript (the second info runScript(snippet))

Internally we use osascript.
To run an Applescript file is not implemented, but you might use a call to osascript using the normal run("someCommand").

Revision history for this message
Chetan (cshamdas) said :
#2

thanks. however we want to specific the file name and not put the code in string. is it possible to give the file name
example runScript (yxs_script)
reason:
the script can be long one

Revision history for this message
RaiMan (raimund-hocke) said :
#3

use
run("osascript yxs_script")

which runs the command osascript internally from a command line .

Can you help with this problem?

Provide an answer of your own, or ask Chetan for more information if necessary.

To post a message you must log in.