• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Making a repeat loop without slowing CPU
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making a repeat loop without slowing CPU


  • Subject: Re: Making a repeat loop without slowing CPU
  • From: "Arthur J. Knapp" <email@hidden>
  • Date: Thu, 18 Jul 2002 15:26:41 -0400

> From: email@hidden
> Date: Wed, 17 Jul 2002 18:55:31 EDT
> Subject: Making a repeat loop without slowing CPU

> I'm trying to write an AppleScript that will tell me when the movie thats
> being downloaded into MoviePlayer has finished loading.

> tell application "QuickTime Player"
> activate
> if the max time loaded of movie 1 = the duration of movie 1 then
> display dialog "Finished loading movie!"
> tell me to quit
> end if
> end tell

> This works, but I need to put it into a repeat-loop of some sort.

I think you can do just that:

> tell application "QuickTime Player"
> activate

repeat -- forever

> if the max time loaded of movie 1 = the duration of movie 1 then
> display dialog "Finished loading movie!"
> tell me to quit

-- "quit" will stop the repeat loop, (as well as quit)

> end if

end repeat

> end tell


If you are really concerned about hogging the cpu, you can use the
idle handler, (in a stay-open script):

on idle

> tell application "QuickTime Player"
> activate
> if the max time loaded of movie 1 = the duration of movie 1 then
> display dialog "Finished loading movie!"
> tell me to quit
> end if
> end tell

return 2 --> checks every 2 seconds

end idle


Again, the "quit" itself takes care of stopping the idle process,
along with everything else.


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
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.

  • Prev by Date: Re: Go To Commands (AppleScript)
  • Next by Date: Re: Passing *possible* variables to a handler
  • Previous by thread: Re: Making a repeat loop without slowing CPU
  • Next by thread: GoTos?
  • Index(es):
    • Date
    • Thread