Hey Oleg,
Due to X-mas we want to have a certain action to be executed.
Between and including 06-12-Year and 05-01-Year (dd-mm-yyyy) this action should take place. I've tried to solve it with a "If" {Date} => 6-12-{Year} AND {Date} <= 5-1-[Year} but that was too simple, it didn't work. Do you have any thoughts what can be the best solution?
I've used Compare Value as Date / Time.
Between certain time period
Re: Between certain time period
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1864609949
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task169"
Hide=INTEGER|0
ID=INTEGER|-282037269
LogOnAsUser=INTEGER|1
Name=STRING|"check fromDate toDate"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|1
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"checkDate"
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"checkDate"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"checkDate"
varvalue=STRING|"31/12/2024"
[Actions\Action10]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
[Actions\Action11]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action11\Params]
message=STRING|"false"
type=STRING|"3"
[Actions\Action12]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VALUEFORMAT"
Enabled=INTEGER|-1
Name=STRING|"convert_checkDate"
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"value_checkDate"
format=STRING|"Systemtime"
fromvalue=STRING|"{checkDate}"
group=STRING|"Time"
resultvar=STRING|"value_checkDate"
reverse=STRING|"1"
value=STRING|"DateAsNumber"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"fromDate"
Params=FOLDER
[Actions\Action3\Params]
_rt_variables_produced=STRING|"fromDate"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"fromDate"
varvalue=STRING|"06/12/2024"
[Actions\Action4]
ActionID=STRING|"A_VALUEFORMAT"
Enabled=INTEGER|-1
Name=STRING|"convert_fromDate"
Params=FOLDER
[Actions\Action4\Params]
_rt_variables_produced=STRING|"value_fromDate"
format=STRING|"Systemtime"
fromvalue=STRING|"{fromDate}"
group=STRING|"Time"
resultvar=STRING|"value_fromDate"
reverse=STRING|"1"
value=STRING|"DateAsNumber"
[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"toDate"
Params=FOLDER
[Actions\Action5\Params]
_rt_variables_produced=STRING|"toDate"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"toDate"
varvalue=STRING|"30/12/2024"
[Actions\Action6]
ActionID=STRING|"A_VALUEFORMAT"
Enabled=INTEGER|-1
Name=STRING|"convert_toDate"
Params=FOLDER
[Actions\Action6\Params]
_rt_variables_produced=STRING|"value_toDate"
format=STRING|"Systemtime"
fromvalue=STRING|"{toDate}"
group=STRING|"Time"
resultvar=STRING|"value_toDate"
reverse=STRING|"1"
value=STRING|"DateAsNumber"
[Actions\Action7]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action7\Params]
message=STRING|"check- {checkDate} = ({value_checkDate}) | from- {fromDate} = ({value_fromDate}) | to- {toDate} = ({value_toDate})"
type=STRING|"3"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
case#1=STRING|"0"
connection=STRING|"0"
count=STRING|"2"
operator=STRING|"2"
operator#1=STRING|"4"
type=STRING|"1"
type#1=STRING|"1"
value1=STRING|"{value_checkDate}"
value1#1=STRING|"{value_checkDate}"
value2=STRING|"{value_fromDate}"
value2#1=STRING|"{value_toDate}"
[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action9\Params]
message=STRING|"true"
type=STRING|"3"
Re: Between certain time period
Wow. OK, I'm surprised with this solution
I've never expected this to be honest, seems more complicated than I thought. Nevertheless, it works. So, thanks!

Re: Between certain time period
Note that the year changes when you move to a new year.
You should compare the current date this way:
Look at my example
You should compare the current date this way:
Code: Select all
((CurrentDate >= Year-12-06) and (CurrentDate <= Year-12-31)) OR ((CurrentDate >= Year-01-01) and (CurrentDate <= Year-01-06))
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1515"
Hide=INTEGER|0
ID=INTEGER|2095948155
LogOnAsUser=INTEGER|1
Name=STRING|"X-mas dates"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""ControlDate"" with value ""{Date}"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"ControlDate"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"ControlDate"
varvalue=STRING|"{Date}"
[Actions\Action10]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action11]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then // check XMasDate"
Params=FOLDER
[Actions\Action11\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{XMasDate}"
[Actions\Action12]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Yes!!!"""
Params=FOLDER
[Actions\Action12\Params]
icon=STRING|"1"
msg0=STRING|"Yes!!!"
msg1=STRING|"Today is X-mas day!"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action13]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
[Actions\Action14]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Today is not X-mas day..."""
Params=FOLDER
[Actions\Action14\Params]
icon=STRING|"0"
msg0=STRING|"Today is not X-mas day..."
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action15]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Date1"" with value ""{FormatToDateTime({Year}-12-06,yyyy-mm-dd)}"""
Params=FOLDER
[Actions\Action2\Params]
_rt_variables_produced=STRING|"Date1"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"Date1"
varvalue=STRING|"{FormatToDateTime({Year}-12-06,yyyy-mm-dd)}"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""Date2"" with value ""{FormatToDateTime({Year}-01-05,yyyy-mm-dd)}"""
Params=FOLDER
[Actions\Action3\Params]
_rt_variables_produced=STRING|"Date2"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"Date2"
varvalue=STRING|"{FormatToDateTime({Year}-01-05,yyyy-mm-dd)}"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""XMasDate"" with value ""false"""
Params=FOLDER
[Actions\Action4\Params]
_rt_variables_produced=STRING|"XMasDate"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"XMasDate"
varvalue=STRING|"false"
[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then // Year-12-06 <= date <= Year-12-31"
Params=FOLDER
[Actions\Action5\Params]
case=STRING|"0"
case#1=STRING|"0"
connection=STRING|"0"
count=STRING|"2"
operator=STRING|"2"
operator#1=STRING|"4"
type=STRING|"2"
type#1=STRING|"2"
value1=STRING|"{ControlDate}"
value1#1=STRING|"{ControlDate}"
value2=STRING|"{Date1}"
value2#1=STRING|"{FormatToDateTime({year}-12-31,yyyy-mm-dd)}"
[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""XMasDate"" with value ""true"""
Params=FOLDER
[Actions\Action6\Params]
_rt_variables_produced=STRING|"XMasDate"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"XMasDate"
varvalue=STRING|"true"
[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then // Year-01-01 <= date <= Year-01-05"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
case#1=STRING|"0"
connection=STRING|"0"
count=STRING|"2"
operator=STRING|"2"
operator#1=STRING|"4"
type=STRING|"2"
type#1=STRING|"2"
value1=STRING|"{ControlDate}"
value1#1=STRING|"{ControlDate}"
value2=STRING|"{FormatToDateTime({year}-01-01,yyyy-mm-dd)}"
value2#1=STRING|"{Date2}"
[Actions\Action9]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""XMasDate"" with value ""true"""
Params=FOLDER
[Actions\Action9\Params]
_rt_variables_produced=STRING|"XMasDate"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"XMasDate"
varvalue=STRING|"true"
[\Comment]
s1=Detect than date between Year-12-06 and NextYear-01-05
Oleg Yershov
Re: Between certain time period
Great, thanks! This works excellent.