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: Call method for NSTimer



On 1/31/06 2:44 PM, "Terry Heaford" <email@hidden> wrote:

> I believe this will do the trick
> 
> on pause (tDelay)
> set myDate to call method "date" of class "NSDate"
> set tOldSecs to call method "timeIntervalSinceNow" of myDate
> set tNewSecs to call method "timeIntervalSinceNow" of myDate
> repeat until (tOldSecs - tNewSecs) > tDelay
> set tNewSecs to call method "timeIntervalSinceNow" of myDate
> end repeat
> end pause

This repeat generates a tremendous amount of CPU activity just as Mark
Lively's does. I'm monitoring a shell script execution that typically takes
hours to complete.

On 1/31/06 3:23 PM, "Dean Shavit" <email@hidden> wrote:

> read this thread on MacScripter for the source of the problem and the
> solution:
> 
> http://bbs.applescript.net/viewtopic.php?id=14772

The thread at MacScripter seems to corroborate the observation I made
earlier today:

> But what solved it? Is it that if you have an idle handler, you'd better put
> your delay commands inside it, even if you're letting Finder do the
> delaying?

So by taking the Finder scope out of the script snippet that I reported as a
solution, I seem to have demonstrated that it isn't necessary to assign the
delay command to Finder. As long as it's in the idle handler, it doesn't
generate the error.

on idle
if delayer
delay delaytime
set delayer to false
else
do idle stuff
end if
end idle

Now what stumps me is that my app doesn't continue to update its status
without some user input once the idle handler is reached. If I want my
progress bar to update or a "finished" dialog to be displayed, I have to
press a key or move the mouse. I even noticed that the run log exhibits this
behavior when running the app in Xcode. When I observe the run log, the log
entries appear in spurts that coincide with some sort of user input on my
part such as a mouse movement.

If I simply include an independent delay command as a replacement for
calling the delay command in the idle handler, the error message appears,
but I can OK the error dialog and the process continues without the
symptoms.

The rest of the machine seems to function normally, while my app's interface
seems to be sleeping.

Is there a command that I can include in the idle handler when entering or
leaving that will "wake up" my interface?

-- 
Laine Lee


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Re: Call method for NSTimer (From: Terry Heaford <email@hidden>)



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.