【发布时间】:2013-12-21 03:51:48
【问题描述】:
我对 AppleScript 非常陌生,我正在尝试这样做。我的机器上运行着一个 Safari 进程。我希望我能去跑步旅行并刺激一个输入键事件。
有可能吗?
我正在尝试的代码是:
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set safRunning to is_running("Safari")
if safRunning then
run script "tell application \"Safari\"
key code 36
end tell"
return "Running"
else
return "Not running"
end if
在run script 里面key code 36(用于刺激输入)给我错误:
error "Expected end of line but found identifier." number -2741
你猜我哪里出错了?
【问题讨论】:
标签: macos applescript