7

I get this error everytime i run this script: System Events got an error: "Test123" doesn’t understand the notify message.

Code:

--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

I have tried to replace

my notify of "Test123" thru "Test"

with the following, without any success:

notify of "Test123" thru "Test" of me
(notify of "Test123" thru "Test") of me
4

2 回答 2

6

不完全确定您要做什么,但这是一个如何调用函数和传递参数的示例

tell application "System Events"
    set m to "message content"
    my notify(m)
end tell
--more code...
on notify(message)
    display dialog (message)
end notify
于 2011-05-05T19:21:20.197 回答
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 )),因为它避免了您发现的模棱两可的语法问题。

于 2011-05-05T23:21:44.843 回答