[SOLVED]Apple Script Timeout

Posted on
Mon Jan 27, 2014 9:21 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

[SOLVED]Apple Script Timeout

I've got a few Action Groups and Schedules that use Applescript... mainly to control iTunes on a remote computer... nothing really fancy, but sometimes, if the target computer isn't on or not responding, Indigo waits for the script to time out... seemingly a very long time. Not sure if this is on the OS side or part of the app, but you might consider shortening the time out time. As it is, if the Applescript is the first action in the list, and it hangs, nothing happens 'til the script times out..and seemingly retries a few times as well.

Posted on
Tue Jan 28, 2014 12:41 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: Apple Script Timeout

do not embed the scripts but run as attached file then they just run independently and a timeout does not impact indigo. you should though box the actions with

try
your action that times out
end try

Karl

Posted on
Tue Jan 28, 2014 10:32 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Apple Script Timeout

AppleScript timeouts aren't controllable by Indigo. However, you can add timeouts to the script as well:

Code: Select all
try
    with timeout of 10 seconds
        tell application "Whatever"
            # Do whatever processing you want here
        end tell
    end timeout
on error number errNum
    # this is not totally necessary, but a timeout will cause an error to be thrown
    # and you can catch here and do any cleanup processing
end try


This is one way to protect embedded AppleScripts from hanging up the server. However, @kw123 is generally right - if you have a script that talks to something else, and particularly if that something else is on the network, it's usually a much better idea to save your script in an external file and execute it that way - those scripts are run in their own processes so it doesn't matter if it gets stuck, etc., the main server process won't get held up.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron