Complex if expression won't work

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
gknopf
Newbie
Posts: 12
Joined: Thu Feb 10, 2011 11:11 pm
Location: Germany

Complex if expression won't work

Post by gknopf » Thu Jul 14, 2011 9:34 pm

Hi all,

can someone give me a hint why this script will end up with an error?

Code: Select all

GetTime>timer
DayOfWeek>weekday

if>{(%timer%>23:42:22) and (%weekday%=5)}
 MessageModal>It is later
else
 MessageModal>It is earlier
endif

Thanks in advance.
George

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jul 15, 2011 4:00 am

23:42:22 is not a number so it needs quotes. Also, GetTime> on my computer does not produce military time. I would see 11:42:22 PM. You can create time as you've displayed it by using Hour>, Min> and Sec> functions

Code: Select all

Hour>hh
Min>mm
Sec>ss
Let>timer=%hh%:%mm%:%ss%
DayOfWeek>weekday

if>{(%timer%>"23:42:22") and (%weekday%=5)}
 MessageModal>It is later
else
 MessageModal>It is earlier
endif

gknopf
Newbie
Posts: 12
Joined: Thu Feb 10, 2011 11:11 pm
Location: Germany

Post by gknopf » Sat Jul 16, 2011 10:47 am

Great help! Thanks a lot. :) I guess the time format depends on the local settings. On my PC I get the european format.

Best regards
George

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts