• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What is the maximum repeat syze?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the maximum repeat syze?


  • Subject: Re: What is the maximum repeat syze?
  • From: kai <email@hidden>
  • Date: Mon, 6 Mar 2006 16:10:38 +0000


On 6 Mar 2006, at 14:36, Bernardo Höhl wrote:

I have this application that is supposed to stay open, doing a curl request on a server 24 hours a day, every 4 seconds. If you do the maths, it is supposed to repeat itself 21,600 times.

If I use this:

on idle theObject
    repeat 4000 times
-- do something
    end repeat
end idle

It works Ok, I mean I can click on the application name > quit , and the app will quit,

Higher repeat values like 5,000 or 10,000 or 30,000 or, even putting a "repeat while true" block will cause the app to stop responding to the click on the application's name, I mean the the menu will not drop down and can only do a "force quit".

Have you guys any clue why this happens? Is there a repeat limit?

In this scenario, I should think there most certainly is, Bernardo.

Basically, your script is attempting to do more than you think. On the first iteration of the idle handler, the repeat loop is entered and starts to execute the 'do something' statement(s). Unless these actions return another value, the idle handler will be called again after the default idle period of 30 seconds. So your repeat loop will have executed the 'do something' statement(s) only 7-8 times when the handler will try to enter another repeat loop. In a further 30 seconds, yet another repeat loop will be attempted - and so on...

The bottom line is that, for this kind of situation, it would be better to use the idle handler itself to repeat the routine that you want executed. Return a value at the end of the handler to indicate how many seconds you wish to elapse before the handler is called again. Something like this:

on idle theObject
	-- do something
	4 (* seconds to next idle handler execution *)
end idle

You might want to check this out:

http://developer.apple.com/documentation/AppleScript/Conceptual/ AppleScriptLangGuide/AppleScript.e7.html

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: What is the maximum repeat syze?
      • From: kai <email@hidden>
References: 
 >What is the maximum repeat syze? (From: Bernardo Höhl <email@hidden>)

  • Prev by Date: Re: How To Read a Dictionary
  • Next by Date: Re: What is the maximum repeat syze?
  • Previous by thread: Re: What is the maximum repeat syze?
  • Next by thread: Re: What is the maximum repeat syze?
  • Index(es):
    • Date
    • Thread