OK, ok, I'll let out the secret of my top-secret script.
Here it is in its entirety:
on run
try
display dialog "To use your current screensaver as your desktop \"background image\", then click ScreenSaver." buttons {"Cancel", "Image", "ScreenSaver"}
if the button returned of the result is "Image" then
tell application "ScreenSaverEngine"
quit
end tell
else if the button returned of the result is "ScreenSaver" then
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources" & "\\" & "/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background"
end if
on error -128
quit
try
tell application "ScreenSaverEngine"
quit
end tell
end try
end try
end run
When you type the terminal script in Terminal, you click in the terminal window and push CTRL C to stop it. In this script, the script pauses at the shell script until COMMAND . is typed. Then it gives that error message. So, I tried using the script to ignore app responses, but then the script doesn't do the shell script. So I tried creating another script and bundling it in an AppleScript App bundle.
I had the following in the bundled script app:
delay 20
and that's it. Then I tell my first script to activate the bundled script app. Then I say:
tell app "BundledApp"
ignoring application responses
do shell script "the shell script"
end ignoring
end tell
do shell script killall -c BundledApp.app
At first, this worked... I think. After the app closed, the screensaver continued. Then all I had to do is run the main script again to quit it. I must have done something though because now I get the error that says that "no matching processes belonging to you were found" when I try to quit the bundled app. It activates it... but won't quit it.
The problem seemed to happen right after I set the visibility status for the bundled app to not be displayed in the dock. However, I have replaced that script several times and have rebooted - the problem still haunts me.