synergy and command line / terminal

I recently installed synergy on my Powerbook and PC set-up. Unfortunately none of the frontends worked for me, so I stuck with the command line. But I wanted a One-Button way to turn synergy on when I needed it. So attached is my little script. I just wonder if there is a better way of doing this, maybe without starting the Terminal or at least run it in the background. If someone has a better way please let the script world know.

S.


set path2syn to "/applications/synergy/" as string

tell application "System Events" to get name of every process
set ProcessList to result
if ProcessList does not contain "synergys" then
	tell application "Terminal"
		do shell script path2syn & "synergys -c " & path2syn & "synergy.conf"
		quit
	end tell
	display dialog "Synergy Starting..." buttons "Close" giving up after 3
else
	display dialog "Synergy is already running!" buttons "OK" giving up after 5
end if

Model: Powerbook G4
AppleScript: 1.9.3
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

There is a very common mistake in your code above (well, several, actually, but I want to focus only on one). When using the “do shell script” command, you don’t put it inside a tell block for the Terminal app. Out of curiosity, why did you do this? Obviously somewhere you must have seen this convention, where was it? Terminal and “do shell script” have nothing to do with one another. The “do shell script” command is part of the Standard Additions scripting addition. If you really wanted a script executed in Terminal, you would issue the “do script” command inside a Terminal app tell block. By using the “do shell script” command correctly, you would actually solve the problem you want to solve, not launching the Terminal app.

Jon

Ahh,

thanks Jon. Yes, indeed I saw that somewhere on this forum, so I just went around and tried it. But I have since corrected the problem, and as you said I works without starting the finder. But you also mentioned additional mistakes. Care to explain them to me? Even though this thing runs, I’d like to improve my future problem solving skills.

Thanks in advance,
S.