Help on a simple if-then-else script

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

Help on a simple if-then-else script

Postby theneo6dude » Sun Dec 03, 2023 2:00 am

Hello,

I (simply) need to send a startup script based on a range of time.

In other words, at startup, if it is between 8:00 and 23:00 Widget would send a "play" (SeqSetState) to Pandoras, if it is between 23:00 and 8:00 Widget would send a "stop" command.
I started to write an “if-then-else” script condition , but will need some help to finalize.

I use the system variables “now” but I’m not sure about the Value B as I just need the time not the date.


if Now >= 2023-11-24 08:00:00.000 AND <= 2023-11-24 23:00:00.000 {
 WDWait(2)
 SeqSetState(1,”Play”)
}
 
Else {
 WDWait(2)
SeqSetState(1,”Stop”)
}


Hope that make sense ,
Thx



Windows 10 64 19045.3208
widget version 6.5.6
theneo6dude
 
Posts: 1
Joined: Wed May 16, 2012 3:54 pm

Re: Help on a simple if-then-else script

Postby Daniel Kaminski » Sun Dec 03, 2023 1:28 pm

Hi,

there are a few ways to tackle this

a) since you only need to check between full hours, just convert the hours Part of the now time into a integer.
WD_TimecheckFullHours.zip


b) calculate with Times
WD_Checktimes.zip


Trick in both cases is that you can read out any part of a datevariable and also format it in a way you want it with datevariable.format("..")

Hope this helps
Daniel
You do not have the required permissions to view the files attached to this post.
--
Daniel Kaminski
Pandoras Box Expert
User avatar
Daniel Kaminski
 
Posts: 1071
Joined: Tue Jul 22, 2008 10:55 am
Location: Herten, Germany


Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 63 guests