Re: Any Way to Force an Idle Handler System Call? (Redux)
Re: Any Way to Force an Idle Handler System Call? (Redux)
- Subject: Re: Any Way to Force an Idle Handler System Call? (Redux)
- From: Stan Cleveland <email@hidden>
- Date: Fri, 06 Jun 2014 14:55:24 -0700
On Jun 6, 2014, at 1:56 PM, S. J. Cunningham wrote:
> [It] ...appears to be that there is no way to quit the idle handler before the next cycle. If I tell the app to quit from another script it appears to execute the quit handler but then the system resurrects it like a zombie :( It also seems to me that even executing "quit" from within the idle handler takes until the next cycle to quit.
>
> I hope I am wrong . Comments?
Hi Steve,
I've had some success with the following method that uses handlers within the main script to change idle time or quit via properties, rather than trying to so directly.
Keep in mind that a "tell application" command addressing your main script will cause it to launch. Be sure that your control script doesn't execute a "tell application" AFTER it has requested the quit, or your main script WILL ressurrect.
Cheers,
Stan C.
----- BEGIN "AmHere" SCRIPT -----
property idleInterval : missing value
property stoppingIt : missing value
on run
set idleInterval to 5
set stoppingIt to false
idle
end run
on idle
activate
display dialog "I'm here...." giving up after 1
if stoppingIt then quit
return idleInterval
end idle
on quit
continue quit
end quit
on setIdleInterval(interval)
set idleInterval to interval
end setIdleInterval
on stopIt()
set stoppingIt to true
end stopIt
------ END "AmHere" SCRIPT ------
---- BEGIN "Control" SCRIPT -----
tell application "AmHere"
setIdleInterval(2)
-- or --
stopIt()
end tell
----- END "Control" SCRIPT ------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden