我对编程很陌生,尤其是 AppleScript。我为情人节写了一个简单的脚本来播放 iTunes 中的歌曲,然后在 Safari 中打开一个 flash 动画文件。当我在 ScriptEditor 中运行脚本时,一切正常,但是当我作为独立应用程序导出时,它在启用全屏模式的命令中失败。我假设这是系统事件的问题。需要明确的是,应用程序运行到最后,但是在击键命令时我听到警报声并且窗口保持原样。
我正在运行优胜美地,并且已经完全更新。
理想情况下,我想在 Google Chrome 中打开文件以使用演示模式,但我什至无法让 Chrome 打开文件。
感谢您的任何建议!这是代码:
tell application "Finder"
set visible of every process whose visible is true and name is not "Finder" to false
close every window
end tell
set volume output volume 75
tell application "iTunes"
set currentVolume to sound volume
if player state is playing then
stop
back track
end if
play track "The Promise"
set player position to 6
end tell
delay 4
tell application "Safari"
activate
if (count of windows) is 0 then -- Remove "if" statement if you don't want to make a new window if there is none
make new window at front
end if
open (POSIX path of (path to home folder)) & "/Desktop/beMine/beMine.swf"
tell application "System Events"
tell process "Safari" to keystroke "f" using {command down, control down}
end tell
end tell