3
为什么在tell指令块中没有调用处理程序? 错误是-1708Applescript中的tell block中的处理程序调用错误
on stub() -- method is not called in tell block
end stub
tell application "Finder"
stub()
end tell
为什么在tell指令块中没有调用处理程序? 错误是-1708Applescript中的tell block中的处理程序调用错误
on stub() -- method is not called in tell block
end stub
tell application "Finder"
stub()
end tell
在一个tell SOMETHING
块,AppleScript的查找命令内SOMETHING
。在这种情况下,它正在寻找application "Finder"
内的stub
命令;这显然不存在。要让AppleScript查找您定义的函数,您需要编写my stub()
; my
强制它在当前脚本的主体中查看,而不是在application "Finder"
中查看。在这种情况下,这给你:
on stub()
-- ...
end stub
-- ...
stub() -- Works fine
-- ...
tell application "Finder"
-- ...
my stub() -- With the `my`, works fine
-- ...
end tell
非常感谢! – Dmitry 2010-04-18 20:51:10