2011-05-05 56 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 
相關問題