Timeouts not working?

This is a general AppleScript question, not SD, but the following doesn’t work:

When run from SD or SE the script timeout at the default 2 minutes.

tell me
	with timeout of 600 seconds
		display dialog "Continue"
	end timeout
end tell

What is the question/issue?
Your script runs fine for me running Script Debugger 7.0.10 (7A99) on macOS 10.14.6 (Mojave).
The display dialog is immediately shown, as it should be.

Timeouts apply to Apple events sent to another process. You’re not doing that.

Right, but then it errors out after two minutes. In the script I’m running I need that dialog to wait 10 minutes before generating an error.

It looks like I’ll need to send the display dialog command to some app in order to get the full “with timeout” experience.

Is there some reason you can’t use the giving up after parameter?

I do. If the wait is more than 10 minutes the script dialog clears. I suppose I could put in a repeat loop and and the dialog go away and reappear after two minutes five times.

Or, maybe I could use dialog toolkit. That doesn’t have a timeout, does it? (I know Myriad Tables doesn’t).

They both have giving up after parameters.

But back to your script: as originally posted, it doesn’t time-out at all. So I’m not sure what your issue actually is.

This syntax works

tell me
delay 600
display dialog “Continue”
end tell

Whoops, my mistake. I was trying to simplify the error down to the minimum needed to show the error, but oversimplified.

It turns out it makes a difference if SD or SE has been activated or is still in the background.

The idea for this script is I have a document in TextWrangler that has a number (hundreds) of movies that have information that needs to be verified.

This script will take 10 at a time and open their IMDB pages in tabs in a Safari window. The user (me) will then check the info in IMDB against the list in TW and make whatever updates are needed. It doesn’t take an hour to do 10, but I’m often distracted and can’t always do 10 at once. It nearly always takes more than two minutes to do 10.

The script displays the dialog in Safari and I work do my work. But after two minutes I get the timeout in SD (and SE).

If, before the timeout, I activate SD, then I don’t get the timeout.

If I position the windows so I can see SD’s script timer it generates the error exactly 2 minutes after I clear the Safari dialog.

There are plenty of ways to work around this, but I’m suspecting that it’s a bug.

Here’s a version that illustrates the issue

property x : 1
--get text from TextWrangler
--tell application "TextWrangler" to set myText to text of window 1
--
--set myTitles to paragraphs of myText
--
set AppleScript's text item delimiters to {tab}
set myTitles to {}
repeat with x from 1 to 100
   set the end of myTitles to {"a", "b", "c", x as text, "d"} as text
end repeat
   set x to 0

--
repeat with thisTitle in myTitles
   set x to x + 1
   set searchString to text item 4 of thisTitle
   set searchPreString to "https://www.imdb.com/find?ref_=nv_sr_fn&q="
   set searchPostString to "&s=all"
   set searchURL to searchPreString & searchString & searchPostString
   tell application "Safari" to open location searchURL
   if x > 9 then
      set x to 1
      tell application "Safari"
         activate
         display dialog "These titles"
      end tell
      tell me
         with timeout of (1 * hours) seconds
            display dialog "Continue"
         end timeout
      end tell
   end if
end repeat


I suspect this is one of those “that’s how it works” things. You’ll notice that activating SD also stops the clock.

why not use the finder or system events for the dialog?

tell application “Finder” — or system events
activate
with timeout of (1 * hours) seconds
display dialog “Continue”
end timeout
end tell

or Shanes Dialog Toolkit Plus Library and set the timeout to never

As I said, there are numerous workarounds.

But whenever I encounter an unexpected behavior I report it here.

In this case the unexpected behavior (just the way it works) seems to be a bug in AppleScript, not a feature. But not the kind of bug that will ever get fixed. I’m thinking I’ll report it to Apple anyway.

That’s because at that stage the modal dialog stops SD from doing anything else – that’s more or less the definition of modal.