Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Broken AppleScript under 10.3. How do I fix it?

Broken AppleScript under 10.3. How do I fix it?
Thread Tools
Spliff
Mac Elite
Join Date: Feb 2001
Location: Canaduh
Status: Offline
Reply With Quote
Oct 12, 2004, 11:11 PM
 
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
     
suthercd
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Oct 13, 2004, 08:57 AM
 
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-
     
Spliff  (op)
Mac Elite
Join Date: Feb 2001
Location: Canaduh
Status: Offline
Reply With Quote
Oct 13, 2004, 11:55 AM
 
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.
     
GeeYouEye
Junior Member
Join Date: Mar 2003
Location: Walnut Creek, CA
Status: Offline
Reply With Quote
Oct 13, 2004, 01:32 PM
 
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.
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:33 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,