• 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: How to script the launching of a script at a specific time...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to script the launching of a script at a specific time...


  • Subject: Re: How to script the launching of a script at a specific time...
  • From: Stan Cleveland <email@hidden>
  • Date: Thu, 7 Dec 2017 16:55:40 -0800

On Dec 1, 2017, at 06:09 PM, Jean-Christophe Helary
<email@hidden> wrote:
>
> If there is an Applescript way to open a specific file at a given time that
> does not involve Calendar, I'm all for it, but right now I'm trying to focus
> on Calendar because that's where I manage all my jobs. So...
> <snip>
> I take any suggestions that solves that Calendar issue (most probably caused
> to my poor coding skills), or any solution that bypasses Calendar but stays
> reasonably within what Applescript allows :-)

Hi Jean-Christophe,

If you or anyone else is interested, I can send code and sample files for a
system that will launch any number of scripted processes, each on their own
unique schedule of your choosing. The code is written using only "vanilla" AS
and has no dependencies other than System Events, Standard Additions, and a
handful of shell commands. The system is robust and has been in continuous
operation for years, running on a Mac Mini used as a "drone". We reboot the
computer about once a week to maintain system stability. Email me off-list, if
you'd like a zip file containing all pertinent files.

Here's how it works: first, a process folder is set up that contains the
following files:

Process_Runner.app           The controlling script using an idle loop, saved
as a stay-open application
Sample_Process_1.scpt      A process script file to execute
Sample_Process_1.plist      A property list that holds the script's "Run
Parameters" and execution history

Additional processes (and their related plist files) may be placed into the
process folder. Processes are dynamically detected and may be added or removed
any time the main script is stopped.

Processes can be triggered by one or more of the following "Run Parameters".
These parameters are compared against the current day and time, and the history
of prior executions of the process, to determine whether or not to run the
process. This is rechecked 30 seconds (or at whatever delay you desire) after
any triggered processes complete their runs. Launch times are approximate,
depending on the number of processes and how long they each take to complete.

dailyStartTime     (Earliest time of day to execute the process script)
          9:00 AM   = Start at 9:00 AM
        12:01 AM   = Start at midnight

dailyEndTime     (Latest time of day to run)
          9:00 PM   = End at 9:00 PM
        11:59 PM   = End at midnight

minsDelayBetweenRuns     (Delay between executions)
        60   = Run once per hour
          0   = No delay between runs; run as often as possible

numRunsPerDay     (Limit of daily executions)
        4     = Run process 4 times per day
        0     = No limit on daily runs; run as many times as possible

weekdaysToRun    (Days of week to execute)
        SuMoTuWeThFrSa   = Run every day of the week
        Sa                         = Run only on Saturdays
        MoWeFr                 = Run only on Mondays, Wednesdays, and Fridays

As an example, to run a script every weekday (not weekends) at noon, you'd use
the following "Run Parameters":

dailyStartTime*              12:00 PM        Begin checking Run Parameters at
this time
dailyEndTime*                12:30 PM        Stop checking Run Parameters at
this time
minsDelayBetweenRuns   0                    Don't specify a delay between runs
numRunsPerDay              1                    Execute only once per day
weekdaysToRun               MoTuWeThFr    Execute only on these days of the week

Or another example, to run a script every 4 hours every day, but not more than
4 times, you'd use the following "Run Parameters":

dailyStartTime*              6:00 AM          Begin checking Run Parameters at
this time
dailyEndTime*                7:00 PM          Stop checking Run Parameters at
this time
minsDelayBetweenRuns   240                Four hour delay between runs
numRunsPerDay              4                    Execute 4 times per day
weekdaysToRun         SuMoTuWeThFrSa  Execute every day
______
*If another long-running process may encroach on these start or end times, make
'dailyEndTime' later to allow for it

Stan C.

 _______________________________________________
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

  • Follow-Ups:
    • Re: How to script the launching of a script at a specific time...
      • From: Bob Stern <email@hidden>
    • Re: How to script the launching of a script at a specific time...
      • From: Jean-Christophe Helary <email@hidden>
  • Prev by Date: Trouble escaping @
  • Next by Date: Is there a way to prepare NSAttaributedString like "attribute runs"?
  • Previous by thread: Re: Trouble escaping @
  • Next by thread: Re: How to script the launching of a script at a specific time...
  • Index(es):
    • Date
    • Thread