|
|
Broken AppleScript under 10.3. How do I fix it?
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Canaduh
Status:
Offline
|
|
I have an AppleScript that no longer works under Panther. I found on the 'net a couple years ago, but I don't know where I got it.
Anyway, all it does is to restart the SystemUIServer. Launching it under Panther gives me this AppleScript error:
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
Now here's the actual AppleScript code. It should be easy to fix, but I have no AppleScript coding abilities. If somone here could tell me how to correct the syntax so it works, I'd greatly appreciate it.
on run
set output to do shell script "ps -cx | grep SystemUIServer"
set savedDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}
set pid to first text item of output
if pid is "" then
set pid to second text item of output
end if
set AppleScript's text item delimiters to savedDelimiters
do shell script "kill " & pid
end run
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
It appears that there are two 'spaces' create at the beginning of the stdout in your ps command. Try 'third text item' in lieu of 'first text itme' in the fifth line of your script.
C-
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Canaduh
Status:
Offline
|
|
Originally posted by suthercd:
It appears that there are two 'spaces' create at the beginning of the stdout in your ps command. Try 'third text item' in lieu of 'first text itme' in the fifth line of your script.
C-
Thanks so much. That worked perfectly.
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status:
Offline
|
|
Can't you just have it run "killall SystemUIServer"? Since killall can kill a process by name, wouldn't that be easier?
|
I bring order to chaos. You are in chaos windows, you are the contradiction, a bug wishing to be an OS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|