Current DAY?

What is the syntax for checking the current day and seeing if it is Friday? If its friday I want to run a program.

Hi Dave, there’s probably a better way to do this, but this basic script will work…

[This script was automatically tagged for color coded syntax by Script to Markup Code]

Greg,
Thanks for the code. When someone takes the time to repy to my request I always appreciate it.

While you can do it Greg’s way, there is a better way:

set w to weekday of (current date)
if w is Friday then beep

The main issue is with portability. Not all countries format dates the same way, and international settings may or may not include the day name as the first word of “current date” as string.

The above code explicitly gets the weekday and since it’s using the system constant for the day name (rather than a string comparison), it will work everywhere, regardless of whether the day you know as “Friday” is called Freitag, Viernes, Vendredi or ???.

Thanks Andrew, that’s what I was looking for but the keyword “weekday” slipped my mind ;¬)