Script runs ok in script editor but not when calledby Indigo

Posted on
Sat Nov 07, 2009 8:30 pm
ricks offline
Posts: 122
Joined: Nov 11, 2006
Location: Reno, NV

Script runs ok in script editor but not when calledby Indigo

I'm trying to keep track of an airport express that keeps losing it's connection to my base station. I've come up with the applescript below. It runs fine in Script Editor, but when I point Indigo to run the scpt file, it doesn't work properly.

Is there something going on with the shell script that Indigo does not like? If so, are there any other approaches to ping another device?

Thanks!

Code: Select all
set server_list to {"ap_name1", "ap_name2"}
repeat with server_address in server_list
   
   try
      set result to do shell script "ping -c 1 " & server_address & ".local"
      
   on error errStatement number errNum
      if errNum = 68 then
         
         tell application "IndigoServer"
            log "AIRPORT ERROR: " & server_address & " not responding"
            
            set emailAddress to "xxx@xxx.xxx"
            set emailBody to "Airport ERROR: " & server_address & " not responding"
            set emailSubject to "INDIGO: Error in Airport"
            send email to emailAddress with subject emailSubject with body emailBody
            
         end tell
      end if
   end try
end repeat

Posted on
Sat Nov 07, 2009 8:33 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Script runs ok in script editor but not when calledby In

Try using the full path to the ping command (/sbin/ping) instead of just 'ping'. When the script runs standalone I don't think it has the shell path setup to find it automatically.

Image

Posted on
Sat Nov 07, 2009 11:15 pm
ricks offline
Posts: 122
Joined: Nov 11, 2006
Location: Reno, NV

Re: Script runs ok in script editor but not when calledby In

support wrote:
Try using the full path to the ping command (/sbin/ping) instead of just 'ping'. When the script runs standalone I don't think it has the shell path setup to find it automatically.


Excellent, thank you Matt, that solved it. I had forgot about that -- I think I've run into this before.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests