Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bitstomper

macrumors newbie
Original poster
Feb 29, 2008
5
0
Hi,

Simple question:
I have a script and saved it as an application.
It runs fine but the app stays open and I have to force quit it before I shut down.
What is the instruction to actually close the application (itself).

Thanks

on run
do shell script "/Applications/synergy-1.3.2/synergys -f --config /Applications/synergy-1.3.2/synergy.conf "
end run
 

lancestraz

macrumors 6502a
Nov 27, 2005
898
0
RI
When you save your script from Script Editor, make sure the "Stay Open" checkbox in the "Save as..." sheet is not selected.
 

lancestraz

macrumors 6502a
Nov 27, 2005
898
0
RI
Try this:
Code:
on run
	do shell script "/Applications/synergy-1.3.2/synergys -f --config /Applications/synergy-1.3.2/synergy.conf > /dev/null 2>&1 &"
end run
I don't have synergy so I can't test this...
 

bitstomper

macrumors newbie
Original poster
Feb 29, 2008
5
0
you dont need synergy
I am trying to close down the script application after it was run
 

sord

macrumors 6502
Jun 16, 2004
352
0
What lancestraz is trying to say is that most likely synergy hasn't quit, and therefore your application won't quit. Try putting
Code:
display dialog "It quit"
at the end of your script. If it doesn't come up, follow what lancestraz said, if it does then its a different problem.
 

bitstomper

macrumors newbie
Original poster
Feb 29, 2008
5
0
on compile I get:

The run handler is specified more than once, or there were top-level commands in addition to the run handler.

on run
do shell script "/Applications/synergy-1.3.2/synergys -f --config /Applications/synergy-1.3.2/synergy.conf "
end run

display dialog "It quit"


I do not want synergy to quit.
The whole point was writing a script that starts up synergy.
But the script application remains open after running the run command.
If there is an other way, please let me know.
btw If I force quite the application synergy remains running (it's a server and client program to use one keyboard and mouse on multiple computers)
 

lancestraz

macrumors 6502a
Nov 27, 2005
898
0
RI
on compile I get:

The run handler is specified more than once, or there were top-level commands in addition to the run handler.

on run
do shell script "/Applications/synergy-1.3.2/synergys -f --config /Applications/synergy-1.3.2/synergy.conf "
end run

display dialog "It quit"


I do not want synergy to quit.
The whole point was writing a script that starts up synergy.
But the script application remains open after running the run command.
If there is an other way, please let me know.
btw If I force quite the application synergy remains running (it's a server and client program to use one keyboard and mouse on multiple computers)
The "display dialog" needs to go inside the run block.
What is probable happing is when you do the shell script "/Applications/synergy-1.3.2/synergys -f --config /Applications/synergy-1.3.2/synergy.conf" it will infinitely sit there wondering what to do with it's output. If you tack on "> /dev/null 2>&1 &" to the end of the shell script (still inside the quotes) the AppleScript should quit.
So your script should look like this:
Code:
on run
	do shell script "/Applications/synergy-1.3.2/synergys -f --config /Applications/synergy-1.3.2/synergy.conf > /dev/null 2>&1 &"
display dialog "I'm quitting."
end run
If you get the "I'm quitting" dialog when you run the script, everything is working OK and you can remove that line from the script. If you get it and click "OK" and the script still doesn't quit, I have one more idea....
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.