Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Idle events



Hi Everybody,
how do I send idle events from an object if it is not doing anything ? Why
doesn4t at least a window, or the application, sends idle by default, if
idle ? Or if it does, how do I catch it ?
Regards
Klaus G. Umland

Art-Lab Communications
http://www.art-lab.com

<pants:smarty>
If an application was sending events it wouldn't be idle now would it?
<pants:default>

AppleScript language guide
Command Handlers p.307
Idle Handlers
If a stay-open script application includes an Idle handler, AppleScript sends the
script application periodic Idle commands whenever itХs not responding to
incoming events. The statements in the handler run periodically (every 30
seconds, by default).
For example, the following handler causes a stay-open script application to
beep every 30 seconds after it has been launched.

on idle
beep
end idle
To change the rate, return the number of seconds to wait as the result of the idle
handler. For example, the following script beeps every 5 seconds.
on idle
beep
return 5
end idle

If an Idle handler returns a positive number, that number becomes the rate (in
seconds) at which the handler is called. If the handler returns a non-numeric
value, the rate is not changed.

Handlers
Remember that the result returned from a handler is just the result of the last
statement, even if it doesnХt include the word return explicitly. For example,
this handler only gets called every 15 minutes.:

on idle
set x to 30
beep
set x to x * x -- The handler returns the result (900).
end idle

To make sure youХre not changing the idle rate, return 0 at the end of the
handler.

On Sunday, July 7, 2002, at 06:28 PM, klaus umland wrote:
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.