Date of next Sunday

Discuss RoboTask here
Post Reply
renders
Posts: 11
Joined: Tue Oct 02, 2018 7:47 pm

Date of next Sunday

Post 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
renders
Posts: 11
Joined: Tue Oct 02, 2018 7:47 pm

Re: Date of next Sunday

Post by renders »

I tried using {MonthIncDays(+(8-{DayOfWeekNo}))} but get a type mismatch.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Date of next Sunday

Post 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
Oleg Yershov
Post Reply