Not waiting until the end of a shell script

Hi.

I simply want to do this:

do shell script "/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &"

The problem I have, is that the button clicked, stays clicked until the ScreenSaverEngine quits, which is only when I do that from the terminal. I was hoping to have a start, and a stop button, but this issue pretty much cripples the whole application.

I tried handing the work over to System Events:

tell application "System Events"
			do shell script "/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &"
end tell

But that didn’t work either, the button still stays pressed. Any thoughts on how to stop this?

(Considering moving this to OS X forum.)

You probably need to redirect the stdout and stderr from the command. Qwerty Denzel and I did this with ScreenSaverEngine in another thread: Killing unknown pid with AppleScript

Ah, thanks Bruce. That’s perfect. I put it in this forum because I thought maybe it would have something to do with a custom class for my button or something like that, but now I see the answer I guess this does belong in OSX