3 Replies Latest reply on Feb 1, 2011 12:19 AM by Sorbsbuster

    Running a script on the first day of the month

    Polarpro

      Title

      Running a script on the first day of the month

      Post

      Hey there...,

      I'd like to run a script on the first day of the month. I wonder if this here works:

      If [Day ( Get ( CurrentDate ) ) = 1]

      run script (...)

      End If

      The reason why I'm asking: Does this line check if the day's number is "1", or does it check if the statement Day ( Get ( CurrentDate ) ) is Boolean true? Sounds awkward, I know...

      Mike

        • 1. Re: Running a script on the first day of the month
          philmodjunk

          It does check to see if the current date is the first of the month, but you'll likely need more logic than that to keep this record from running multiple times on that first day of the month. You might log the date this script was last run so that you can also check to see if the date last run is the same as today or not...

          • 2. Re: Running a script on the first day of the month
            Polarpro

            Thank you for your fast answer.

            As for the re-run, in this case things should be fine as the mentioned lines are part of a script that runs from the server only once a day, very early in the morning.

            :) Mike

            • 3. Re: Running a script on the first day of the month
              Sorbsbuster

              For those who don't run scheduled scripts on Server, or who use FM versions before Install OnTimer Script, there is a very easy way to have any script run any time you like.  (Forgive me for only giving the Windows version.)

              - Create a file with no fields or layouts necessary.  For this example, call it 'First Of Month Check'.  It only has one script:

              - Perform Script [External Script: Choose the file and script you want to run]

              - Close File [This file]

              - In its File -> Options set this script to run on start-up

              In Windows Scheduler set a schedule to open this file when and as often as you like.  You can have a whole folder full of such scheduled scripts.  Truth be told I still use this a lot, even with Install OnTimer Script.