I'm trying to make an applescript that toggles the background screen saver thingy (to see what I mean, type this in terminal: "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background")
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background" works fine to start it, the problem comes when I want to stop it. I tried making a dialog so you could choose start or stop, and take appropriate action. But if you click start on the first one, when you run the script again to try to stop it, no dialog box shows up. When I place the code in its own script, it works, but only from the script editor. If I run it from the menu bar list it doesn't work.
Heres the script:
It works to start it, but then the script editor freezes until I end the screensaverengine with the terminal.
-BG
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background" works fine to start it, the problem comes when I want to stop it. I tried making a dialog so you could choose start or stop, and take appropriate action. But if you click start on the first one, when you run the script again to try to stop it, no dialog box shows up. When I place the code in its own script, it works, but only from the script editor. If I run it from the menu bar list it doesn't work.
Heres the script:
Code:
display dialog "Set BG Screen Saver:" buttons {"ON", "OFF"} ¬
default button 2
copy the result as list to {buttonpressed}
try
if the buttonpressed is "ON" then do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background"
if the buttonpressed is "OFF" then do shell script "killall ScreenSaverEngine"
end try
It works to start it, but then the script editor freezes until I end the screensaverengine with the terminal.
-BG