View Full Version : applescript if statement

Aug 5, 2013, 12:31 PM
With the example below how can I check if difference is between 7 and 10 I would like to run another bit of code then else if difference is greater than 10 then run some other code.

set CurrentDate to current date
set this_date to "17/8/2013"
set difference to ((date this_date) - CurrentDate + 1 * days) div days as number

thanks for your help

Red Menace
Aug 5, 2013, 01:32 PM
This kind of basic information can be found in the AppleScript Language Guide (https://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_control_statements.html#//apple_ref/doc/uid/TP40000983-CH6g-158244), for example:
if difference > 7 and difference ≤ 10 then
-- do this
else if difference > 10 then
-- do that
-- do something else
end if

Aug 5, 2013, 11:16 PM
Thank you Red Menace for your help