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: Ted Wrigley <email@hidden>
- Date: Sat, 07 Jun 2014 14:16:22 -0700
Apparently, by the time the idle loop begins running the next idle call is already set by the system. That’s one of the side effects of applescript not being multi-threaded; I don’t see any way of clearing that unless there’s a unix trick that will manage it. However, this seems more like a problem of script structure: it seems to me you could easily plan around this. Assuming this is the same problem that was floating around before (with the camera system and the email notification), the simple expedient of quitting and restarting the app should suffice.
If I were doing this I’d switch to a combined approach. Use the applescript app with the two hour idle loop as you have it, but launch it via launchd. Save the following as a plain text file in ~/LaunchAgents/user.timer.reset.plist, obviously putting the correct path to the script app in line 8, then load it into launchd by logging in again or running the command launchctl load ~/LaunchAgents/user.timer.reset.plist in Terminal.app.
<?xml version="1.0" encoding="UTF-8"?> <plist version="1.0"> <dict> <key>Label</key> <string>user.timer.reset</string> <key>Program</key> <string>/path/to/scriptapp.app</string> <key>KeepAlive</key> <true/> </dict> </plist>
This plist will launch the app when it loads and make sure the app stays open continuously. When you want to reset the idle loop (i.e., when you get the correct email) simply quit the script app. launchd will immediately restart it, resetting the idle loop. |
_______________________________________________
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