有什么办法可以让我的脚本自动关闭吗?注意:如果您强行退出,屏幕保护程序将保留在桌面上,因此不是因为它在应用程序中运行。
tell application "System Events"
tell screen saver preferences
if running then
do shell script "killall ScreenSaverEngine"
else
do shell script "//System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background"
end if
end tell
end tell
答案 0 :(得分:1)
将&> /dev/null &
添加到shell脚本:
tell application "System Events"
tell screen saver preferences
if running then
do shell script "killall ScreenSaverEngine"
else
do shell script "//System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &> /dev/null &"
end if
end tell
end tell