Avoiding apple events timeout

tell application “QuarkXPress”

with timeout of 1000 seconds
	set the_delay to display dialog "==== Pausing while you Format ===="
end timeout

i am trying to have my script run and pause for say ~15 min or until i press ok
but when i try it this way it still times out

i know i could hard wire to “delay for 900” but then i have to wait the full duration
sometimes i do not need to wait that long

any sugestions would be reatly appreciated


i have thought about using an idle handler but how would it work (i have never used one)
basically my script is set to open an excel file do some stuff then take that copy into Quark
where there is some hand formating to be done before continuing
some times no hand work is needed
other times it may take 10-15 min

i would prefer to just be able to hit an ok button once done
but sometimes it “times out” before i am done

the reason i need it to be in one AS is cause there are variables in the first part of the script that i would be unable to carry into the 2nd half if it were a seperate script

hope this helps to clarify

and thanks for any help

yeah i think you could store a handler in a separate file and display a dialog with infinite timeout. then when you hit OK have it run that “outside” handler to process the rest. you might have to declare the variables outside of the handler in that other script though. not really sure.

the problem is even when i specify a timeout period like 900 or 1000

it will still timeout before that is satisfied

so in essence the timeout is not working at least with a dialog

i realized that in order for the
with timeout of 1000 seconds
set the_delay to display dialog “==== Pausing while you Format ====”
end timeout

to work correctly

i needed to tell the script to be the front app first

“tell me to activate”

after i did that my Timeout seems to work as intended
displaying a dialog box until and “pausing” until i hit the ok button at least for 1000 seconds

i havent tried but i suppose this would work as well

set the_delay to display dialog "==== Pausing while you Format ====" default button "ok" giving up after 1000

any insight would be appreciated
i am sure others would appreciate the info on which method would be more effective/efficient

not sure which would be better

Your understanding of ‘with timeout’ is incorrect.

It doesn’t tell AppleScript to wait that amount of time for the next statement to execute. It sets the amount of time AppleScript will wait for future applications calls to execute.

The correct way to do this is using the ‘giving up after’ parameter. This will dismiss the dialog after the set time unless the user dismisses it first - I assume this is the result you’re aiming for?

Thank you for bringin clarity to this issue

funny tho how i answered my own question ! :smiley:

but for now on i will use giving up after when i want to create this type of delay