• 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: a "repeat" before a "on idle"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a "repeat" before a "on idle"


  • Subject: Re: a "repeat" before a "on idle"
  • From: Marc Myers <email@hidden>
  • Date: Sun, 1 Sep 2002 03:45:31 -0400

Date: Sat, 31 Aug 2002 23:45:45 -0400
Subject: a "repeat" before a "on idle"
From: Antonio Inojal <email@hidden>
To: email@hidden

Hello. I am currently making a test on a script which is idle for 5
seconds but which repeats nevertheless. I have found that a script which
begins with on idle will end as soon as it hits "end idle". Maybe if you
make the script an application which stays open, it will continue but ,
and correct me if I am wrong, variable data will be lost. ( To
illustrate this look at the code below and see that "i" is first given a
value of 5, then 7. What I would like is that when the script repeats in
the beginning, "i" still has a value of 7) Now, when I place a repeat
statement before all other source, and below it I place an 'on idle' ,
it gives me some error about it waiting for the end of repeat and
encountered on idle:

repeat
on idle
tell application "Finder"
set i to 5
set i to 7
beep
end tell
return 5
end idle
end repeat

Now my guess is, one cannot repeat or do any other thing before a 'on
idle'. My problem is this: Like my script shows, I would like it to
repeat the code inside a repeat statement, yet while inside, I would
like it to wait up 5 seconds and then repeat, again. Now, I could put
the on idle on the top, but then my script wouldn't even be idle. As I
have stated, the above code does not work for me. If you know of another
way of repeating yet being able to be idle for a certain amount of time
please tell me. Or if I am doing things backward in anyway and you know
a better way, I appreciate your feedback.
Tony

I can think of a couple of ways to do what I think you want to do. One is simply to eliminate all the idle stuff and put a "delay 5" command at the end of your repeat loop. The other is to use a stay-open applet with an idle handler. As you noted, you can't put an idle handler (or any kind of handler) into a repeat loop.

global i

on run
set i to "starting value"
end run

on idle
tell me to activate
display dialog "start idle: i = " & (i as text)
set i to 5
set i to 7
beep
display dialog "end idle: i = " & (i as text)
return 5
end idle

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[9/1/02 3:45:24 AM]
_______________________________________________
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: Address Book
  • Next by Date: Re: Installer script
  • Previous by thread: Re: Address Book
  • Next by thread: Re: 'name of processes' in Classic Environment
  • Index(es):
    • Date
    • Thread