Re: AS 1.6 timeout bug? - work around found!
Re: AS 1.6 timeout bug? - work around found!
- Subject: Re: AS 1.6 timeout bug? - work around found!
- From: "Donald S. Hall" <email@hidden>
- Date: Mon, 26 Nov 2001 23:05:30 -0700
Just after posting my message, I stumbled on a solution to my problem. If I
preload "theScript" with a load script command, the instant timeout error
goes away. I began my test script with the following lines when theScript
was in another file:
------------------------------
property theScript : ""
if theScript is "" then
set theScript to choose file of type {"osas", "APPL"}
end if
set theScript to load script theScript -- ** new line added **
-------------------------------
Don
>
The scripts below work fine if "theScript" is in the same file as the test
>
script that runs it, but gives an instant timeout error (-1712), even though
>
the wait time is supposedly one minute, if "theScript" resides in another
>
file.
>
>
The test script uses the dummy tell block to enable the timeout feature. See
>
the Applescript in a Nutshell book, page 152. Without it, the test script will
>
always wait for the run script command to complete, which I do not want.
>
("theScript" is only a sample script to illustrate the problem. I want to run
>
others that could take a very long time to run, and I want the main script to
>
proceed without waiting.)
>
>
The instant timeout error seems to only occur when theScript contains a
>
"Finder" tell block. If I run a script that uses an "Interarchy" tell block
>
for example, there is no problem.
>
>
There is also no problem in OS X 10.1.
>
>
Is this some kind of a bug in AS 1.6? Is there a way around it?
>
>
Thanks for any insights,
>
>
Don
>
>
-- test script ------------------------------------------
>
set waittime to 60
>
>
try
>
with timeout of waittime seconds
>
tell application "Finder" -- dummy tell to enable timeout
>
get version
>
run script theScript
>
end tell
>
end timeout
>
display dialog the result as text
>
>
on error errMsg number errNum
>
display dialog errMsg & return & "Number: " & errNum
>
end try
>
>
-- sample script using the Finder -------------------------------------
>
script theScript
>
set {AppleScript's text item delimiters, oldTIDs} to {",", AppleScript's text
>
item delimiters}
>
tell application "Finder"
>
set proclist to name of every process whose visible is true
>
end tell
>
set proclist to proclist as text
>
set AppleScript's text item delimiters to oldTIDs
>
return proclist
>
end script
>
------------------------------------------------------------------------
>
>
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
email@hidden