My script basically does the following (pseudo code shown here), in an endless loop:
repeat Tell app “Safari” For each window for each tab in this window if qualified (URL of this tab) Check contents of page if changed update TextEdit window for this page with summary. end if end if end for end for Delay (1) forever.
IOW, it scans the open web pages for certain types (from a certain site) and if found, scans those pages for changes. When the pages change, the TextEdit summary page is updated to reflect that.
This all works fine EXCEPT When Safari or TextEdit or something else is frontmost, the lag between the page updating and the summary updating will start to get longer and longer and longer. When it does update, it updates all the way, but it just waits longer and longer.
All my debugging says that it’s NOT in the processing to detect changes - it’s in the DELAY.
It acts as if the DELAY were getting longer and longer.
If I build an APP, it behaves the same way.
When it is in the stall like that, I can click on the script window, or otherwise bring ASE to the front, and it updates instantly, as if it realized it was behind and decided “Oh, I better quit goofing off”.
When running the app, if I bring the app to the front, it likewise catches up. As long as ASE (or the app) is frontmost, it works fine. But a few seconds after something else comes in front, it tries to get away with not doing what I ask.
What am I missing? Is there a better way to keep the thing working while it’s not frontmost?
This is in Mavericks - I never noticed this behavior in 10.6, but I won’t swear that it wasn’t there.
---------------------------------------------------------------- Steve Bird Culverson Software - Elegant software that is a pleasure to use. www.Culverson.com (toll free) 1-877-676-8175
|