【发布时间】:2015-07-20 15:14:43
【问题描述】:
我正在尝试从 tell 块调用函数/处理程序,但 AppleScript 不断抛出错误:
结果:错误“AppleEvent 处理程序失败。”数量-10000
脚本在我调用 start_varnish() 的地方失败:
tell application "System Events"
set iTermIsRunning to exists (processes where name is "iTerm")
end tell
tell application "iTerm"
activate
try
tell current terminal
if iTermIsRunning then
launch session "Default Session"
end if
tell the last session
my start_varnish()
end tell
end tell
on error err
log "Reopening iTerm2"
reopen
tell current terminal
tell the last session
my start_varnish()
end tell
end tell
end try
end tell
on start_varnish()
set name to "Varnish Cache"
end start_varnish
当我移动处理程序的内容并将其直接放在上面的代码中时,它可以正常工作,但我想将功能包装在处理程序中以实现可重用性。
【问题讨论】:
标签: applescript iterm2