Page 1 of 1

Date of next Sunday

Posted: Tue Mar 08, 2022 4:29 pm
by renders
Hi all.. I have a need to copy a file from a folder that is named \MONTH DAY\text.docx.

The folder name is based on the date of next Sunday. The task is scheduled 5 days before the actual Sunday.
For most Sundays, I can use the {MonthName} variable for the first part. And a local variable based on a VB Evaluate of {Day}+(8-{DayOfWeekNo})

However, there will be some times when the Sunday might be in the next month..

Can you suggest the simplest way to create this?

Thanks for your advice..

Rob

Re: Date of next Sunday

Posted: Tue Mar 08, 2022 4:52 pm
by renders
I tried using {MonthIncDays(+(8-{DayOfWeekNo}))} but get a type mismatch.

Re: Date of next Sunday

Posted: Tue Mar 08, 2022 5:46 pm
by Oleg
Look at my example below

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task38"
Hide=INTEGER|0
ID=INTEGER|-1797697898
LogOnAsUser=INTEGER|1
Name=STRING|"Date of next sunday"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER

[Actions\Action1]
ActionID=STRING|"A_SCRIPT_VBEVALUATE"
Enabled=INTEGER|-1
Name=STRING|"VB Evaluate (calculate delta)"
Params=FOLDER

[Actions\Action1\Params]
expression=STRING|"8 - {DayOfWeekNo}"
linecount=STRING|"0"
loadfromfile=STRING|"1"
variable=STRING|"delta"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Date of next sunday: {DateIncDays({delta})}"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"Date of next sunday: {DateIncDays({delta})}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

Copy text of the task and paste into RoboTask task list