RT Posted March 9, 2016 Posted March 9, 2016 i am trying to write a script which fires on the first of the month. but it always fires no matter what the date. trigger birthdays send If [ Date ( Month ( Get (CurrentDate) ) -0 ; 1 ; Year ( Get (CurrentDate) ) ) ] Perform Script [ “Birthdays report this month” ] Else Exit Script [ ] End If
doughemi Posted March 9, 2016 Posted March 9, 2016 (edited) Try If[Get(CurrentDate) = Date ( Month ( Get (CurrentDate) ) ; 1 ; Year ( Get (CurrentDate) ) ) ] Your calculation returns the date of the first of the month, which is always greater than 0, and therefore always true. Edit: Actually you could get away with just If[Day(Get(CurrentDate)) = 1] Edited March 9, 2016 by doughemi 1
comment Posted March 9, 2016 Posted March 9, 2016 (edited) If you want to see if today is the first of the month, then you should test for: Day ( Get (CurrentDate) ) = 1 Your test calculates the date of the first of the month, and places it inside an If[] - that will always return true. Note also that if for some reason your script doesn't run on the first of the month (e.g. because it's weekend or a holiday), then the next earliest time the test will return true is a month from now. So you might offend all those whose birthday is this month. Edited March 9, 2016 by comment 1
RT Posted March 9, 2016 Author Posted March 9, 2016 16 minutes ago, comment said: If you want to see if today is the first of the month, then you should test for: Day ( Get (CurrentDate) ) = 1 thanks for the answer, i have just started using FMserver and trying to get some PDF reports done in the back ground and as FMserver does not do PDF natively i will try to write an applescript to fire an ical event on the first of the month.
Recommended Posts
This topic is 3179 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now