繁体   English   中英

运行命令不起作用? AppleScript的

[英]Run command not working? Applescript

我原来有这些代码

 set Chrome_List to {"Open Chrome", "Open Google Chrome", "Open GoogleChrome", "Open browser", "Open chrome"} --List of words, meaning "Good" set TextEdit_List to {"Open Textedit", "Open Text Edit", "open text", "open empty text "} --List of words, meaning "Bad" set Gmail_List to {"Open Gmail", "Open Email", "open mail", "open Google Mail ", "open G-Mail"} set photobooth_list to {"Open Photo Booth", "Open PhotoBooth", "open camera", "open Camera ", "open photo booth"} set complete_list to Chrome_List & TextEdit_List & Gmail_List & photobooth_list tell application "SpeechRecognitionServer" set theResponse to listen for complete_list with prompt "Which Application should I open" if (Chrome_List contains theResponse) then run script "/Volumes/Genesis/Application/GoogleChrome/GoogleChrome.scpt" else if (TextEdit_List contains theResponse) then run "/Volumes/Genesis/Application/TextEdit/TextEdit.scpt" else if (Gmail_List contains theResponse) then run "/Volumes/Genesis/Application/Gmail/Gmail.scpt" else if (photobooth_list contains theResponse) then run "/Volumes/Genesis/Application/PhotoBooth/PhotoBooth.scpt" end if end tell end 

该代码链接到此代码:

 say "Opening Photo Booth" launch application "Photo Booth" end end end 

但是出于某种原因,当我告诉它“打开PhotoBooth”时,它说:“ / Volumes / Genesis / Application / PhotoBooth / PhotoBooth.scpt”不理解“运行”消息。

Gmail也是如此,但是其他应用程序(例如GoogleChrome和TextEdit)都可以正常工作。

有人有解决方法吗?

尝试将脚本保存为应用程序而不是编译脚本。 Gmail.app与Gmail.scpt

另外,将命令从“运行”更改为“打开”。

do shell script "open '/Volumes/Genesis/Application/PhotoBooth/PhotoBooth.app'"

你有一个错字。 在第一次出现时,您有:

run script "…

但在其中一些你就是

run "…

你需要运行脚本。 另外,在第二个脚本中,我建议

tell application "Photo Booth" to activate

而不是使用launch其忽略了开放事件调用(除非你确信这就是你想要的)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM