• 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: Repeat
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repeat


  • Subject: Re: Repeat
  • From: Ben Waldie <email@hidden>
  • Date: Wed, 21 May 2003 22:28:20 -0400

Marcus,

On Tuesday, May 20, 2003, at 04:17 PM, Marcus Rodrigues wrote:

Please, can someone teach me how to repeat an action in intervals of one hour?
Thx =)

I assume you mean that you want the script to trigger once every hour. If so, you can do this a couple different ways...

OPTION 1
This code will simply pause your script for an hour

repeat
-- DO YOUR ACTION
delay 3600 -- In seconds. 3600 seconds = 1 hour
end repeat

OPTION 2
This code should be placed into your script. Then, you need to save your application as a "Stay Opened" AppleScript. This option can be selected in the "Save As" dialog box. Once launched, the code in the "idle" handler will be triggered every hour.

on idle
-- DO YOUR ACTION
return 3600 -- In seconds. 3600 seconds = 1 hour
end idle


If you are indeed looking to have your script perform a single task over and over again for one hour, you can do this with the following code...

set theStopDate to (current date) + (1 * hours)
repeat
-- DO YOUR ACTION
if (current date) !C theStopDate then exit repeat
end repeat


- Ben

Benjamin S. Waldie
Automated Workflows, LLC
=============================================
AppleScript and Workflow Automation
Consulting - <http://www.automatedworkflows.com>
AppleScript Info - <http://www.applescriptguru.com>
AppleScript Training - <http://www.applescripttraining.com>
=============================================


Thanks,

- Ben

Benjamin S. Waldie
Automated Workflows, LLC
=============================================
AppleScript and Workflow Automation
Consulting - <http://www.automatedworkflows.com>
AppleScript Info - <http://www.applescriptguru.com>
AppleScript Training - <http://www.applescripttraining.com>
=============================================
_______________________________________________
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.

  • Follow-Ups:
    • Re: Repeat
      • From: Michelle Steiner <email@hidden>
    • do shell script "sort"?
      • From: Joseph Weaks <email@hidden>
References: 
 >Repeat (From: Marcus Rodrigues <email@hidden>)

  • Prev by Date: Pic in email message
  • Next by Date: Re: Getting values in Photoshop 7 - the complete request
  • Previous by thread: Repeat
  • Next by thread: do shell script "sort"?
  • Index(es):
    • Date
    • Thread