Applescript中tell块中的处理程序调用错误
为什么不在tell块中调用处理程序? 错误是-1708Applescript中tell块中的处理程序调用错误,applescript,Applescript,为什么不在tell块中调用处理程序? 错误是-1708 on stub() -- method is not called in tell block end stub tell application "Finder" stub() end tell 在告诉某个东西块中,AppleScript在某个东西中查找命令。在本例中,它在应用程序“Finder”中查找存根命令;这显然是不存在的。要让AppleScript查找您定义的函数,您需要编写my stub();my强制它查看当前脚本的
on stub() -- method is not called in tell block
end stub
tell application "Finder"
stub()
end tell
在
告诉某个东西
块中,AppleScript在某个东西
中查找命令。在本例中,它在应用程序“Finder”
中查找存根
命令;这显然是不存在的。要让AppleScript查找您定义的函数,您需要编写my stub()
;my
强制它查看当前脚本的主体,而不是应用程序“Finder”
。在这种情况下,这将为您提供:
on stub()
-- ...
end stub
-- ...
stub() -- Works fine
-- ...
tell application "Finder"
-- ...
my stub() -- With the `my`, works fine
-- ...
end tell