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 > applescript timeout

applescript timeout
Thread Tools
Fresh-Faced Recruit
Join Date: Jan 2001
Location: Hampstead, MD, USA
Status: Offline
Reply With Quote
Jan 23, 2001, 12:50 PM
 
I've created a script to compare folders on a network and copy the network folder when its mod date is different from the local folder. It's a pretty large file, takes 6-7 min to copy, so it times out before the copy is complete. Any suggestions for an easy way to prevent the timeout while copying? Can timeout be specified at the beginning for the whole script?

------------------
Tim
Tim
     
RGS
Guest
Status:
Reply With Quote
Feb 3, 2001, 10:18 AM
 
You can specify the timeout before the entire script:

with timeout of 600 seconds
tell application...
script stuff here
end tell
end timeout

or before a specific portion of the script:

tell application...
with timeout of 600 seconds
script stuff here
end timeout
end tell
     
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status: Offline
Reply With Quote
Feb 5, 2001, 11:44 AM
 
Hi Tim,

As RGS mentioned above, you could wrap the copying/duplicating command (or the entire script) inside a 'with timeout ...' block. This is one of two possible methods, and is the most general one. The second method is appropriate only in certain specific situations, and would involve wrapping the copying/duplicating command inside an 'ignoring application responses' block (this would be suitable only if the rest of your script doesn't depend on the result of the copying).

It is important to emphasise that, according to Apple, either of these two methods might not work unless you are copying the file by using the commands of an application such as the Finder [or the commands of a scripting addition (OSAX) that occur within a 'tell application ...' block].

Just to provide a little more detail on the second method, the basic idea is to simulate "multitasking" in the sense that your script wouldn't wait for the copy to complete. [As mentioned earlier, this would be suitable only if the rest of your script doesn't depend on the result of the copying.] For example:-
Code:
[...] ignoring application responses tell application "Finder" duplicate source reference to target reference end end [...]
[BTW, Apple's official 'AppleScript Language Guide' is a good source of information about the relatively obscure features available in AppleScript. See the New to AppleScript thread for a link to the official 'AppleScript for Scripters' web page (where the online/PDF versions of the 'AppleScript Language Guide' can be found), along with other links to interesting AppleScript-related web sites.]

Regards,

--Paul
     
   
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:07 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2