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

Re: Applescript schedulers


  • Subject: Re: Applescript schedulers
  • From: John Cochrane <email@hidden>
  • Date: Mon, 19 Nov 2007 22:52:42 +1100


On 18/11/2007, at 10:54 PM, Jan Erik Moström wrote:

I would like to start running some applescripts at certain times, what alternatives are there for doing the actual scheduling?

I have been using an iCal event to trigger a nightly backup script. 
This has worked without any problems, although the machine running it is set not to go to sleep so I have not tested if it will wake up a sleeping machine to run the script.

I wrote a script to make rescheduling the iCal event easier.
Here tis.

display dialog "Delete all existing iCal backup script schedules
 or 
Make a new backup schedule?" buttons {"Cancel", "Delete All", "Make New"} default button 3
if the button returned of the result is "Delete All" then
tell application "iCal"
set backup_cal to first calendar whose title is "Backups"
try
delete (every event of backup_cal whose summary is "backup")
end try
end tell
else
set scriptPath to POSIX path of (choose file with prompt "Choose your backup Applescript." without invisibles and multiple selections allowed) as Unicode text
display dialog "In 24 hour time, what hour would you like to backup.
(e.g.  15 for 3 PM, 22.30 for 10:30 PM)" default answer "23" buttons {"Cancel", "OK"} default button 2
copy the text returned of the result to backup_hour
set date_string to date string of (current date)
set start_time to date (date_string & " " & backup_hour)
set duration to "+.50"
set end_time to (start_time) + 50 * minutes
tell application "iCal"
set backup_cal to first calendar whose title is "Backups"
try
exists backup_cal
on error
create calendar with name "Backups"
set backup_cal to first calendar whose title is "Backups"
end try
set theEvent to make new event at end of backup_cal with properties {summary:"backup", start date:start_time, end date:end_time, recurrence:"FREQ=DAILY;INTERVAL=1"} --"FREQ=DAILY;INTERVAL=1"}
tell theEvent
make new open file alarm at end of open file alarms with properties {trigger interval:-0.01, filepath:scriptPath}
end tell
end tell
display dialog "The selected application will run every day at " & (time string of start_time) buttons {"OK"} default button 1
end if

John Cochrane

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Applescript schedulers (From: Jan Erik Moström <email@hidden>)

  • Prev by Date: Re: Adobe Illustrator CS3 'save' command appears to be buggy
  • Next by Date: Simple GUIs
  • Previous by thread: Re: Applescript schedulers
  • Next by thread: Re: Applescript schedulers
  • Index(es):
    • Date
    • Thread