2011-05-05 57 views
5

我每次运行这个脚本时都会收到这个错误:System Events出错:“Test123”不理解通知消息。AppleScript:调用处理程序里面的tell语句

代码:

--more code... 
tell application "System Events" 
    if some_system_events_property then 
     my notify of "Test123" thru "Test" 
    end if 
end tell 
--more code... 
to notify of message thru level 
    display dialog message with titel level 
end notify 

我试图取代

my notify of "Test123" thru "Test" 

与以下,没有任何成功:

notify of "Test123" thru "Test" of me 
(notify of "Test123" thru "Test") of me 
+0

什么是“Test123”通过“测试”'?这对我来说毫无意义 – mcgrailm 2011-05-05 19:22:38

回答

3

试试这个:

tell application "System Events" 
    if some_system_events_property then 
     tell me to notify of "Test123" thru "Test" 
    end if 
end tell 

to notify of message thru level 
    display dialog message with title level 
end notify 

虽然我也会说,我从来没有使用AppleScript的处理程序直接参数语法,宁愿位置参数(即notify(message, level)),因为它避免了模棱两可的语法烦恼你发现了。

3

不完全相信你的努力做的,但在这里是如何调用函数并传递参数的示例

tell application "System Events" 
    set m to "message content" 
    my notify(m) 
end tell 
--more code... 
on notify(message) 
    display dialog (message) 
end notify 
相关问题