Killing AppleVNCServer with an applescript
I found this ( http://macstuff.beachdogs.org/blog/?p=31) which looks like it should pretty much do what I want. I changed "Finder" in his example to "AppleVNCServer". It seems to identify the process ID (209), but won't kill it. I get the following message:
error "sh: line 0: kill: 65
209: arguments must be process or job IDs" number 1
This is the script:
set app_name to "AppleVNCServer"
set the_pid to (do shell script "ps ax | grep " & (quoted form of app_name) & " | grep -v grep | awk '{print $1}'")
if the_pid is not "" then do shell script ("kill -9 " & the_pid)
Does anyone see what's wrong here? I'm only just getting into Applescript. The shell script part is a little over my head...
Thanks,
Sean
G4 Mac Mini, Mac OS X (10.5.8)