Page 1 of 1
Weeknumber minus 1
Posted: Wed Nov 06, 2013 9:10 am
by rice1973
Hello Oleg,
What do i have to change to set the week number minus 1 by the variable ; {WeekOfTheYear({Date})}
And at what day does the new week start? Is it on monday?
Kind regards,
Maurice
Re: Weeknumber minus 1
Posted: Wed Nov 06, 2013 11:00 am
by Oleg
New week begins on Monday.
See the example below how to calculate WeekOfTheYear-1
Code: Select all
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task730"
Hide=INTEGER|0
ID=INTEGER|73766993
LogOnAsUser=INTEGER|1
Name=STRING|"Week of the year - 1"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""WEEKNUM"" with value ""{WeekOfTheYear({Date})}"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"WEEKNUM"
varvalue=STRING|"{WeekOfTheYear({Date})}"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""WeekNum"""
Params=FOLDER
[Actions\Action2\Params]
incement=STRING|"-1"
vaiable=STRING|"WeekNum"
[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""[{Time}, {DayOfWeek}, {Date}]"""
Params=FOLDER
[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"[{Time}, {DayOfWeek}, {Date}]"
msg1=STRING|"Week of the Year: {WeekOfTheYear({Date})}"
msg2=STRING|"Week of the Year - 1: {WeekNum} "
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
Re: Weeknumber minus 1
Posted: Wed Nov 06, 2013 11:46 am
by rice1973
Ok,
Is it not as simple as {IncDays(-1)} ?
Re: Weeknumber minus 1
Posted: Wed Nov 06, 2013 1:07 pm
by Oleg
What do you want to get: yesterday's date or number of previous week?
{IncDays(-1)} - the day number (not week number or date)
{DateIncDays(-1)} - the date of yesterday
Re: Weeknumber minus 1
Posted: Thu Nov 07, 2013 8:37 am
by rice1973
I want to get the number of previous week.

Re: Weeknumber minus 1
Posted: Thu Nov 07, 2013 9:23 am
by Oleg
So, look at my example above.
Re: Weeknumber minus 1
Posted: Wed Feb 03, 2021 4:31 pm
by Micha
Where to use the code when I want to use the variable? Should I copy the code to "Local variables"???
Re: Weeknumber minus 1
Posted: Sun Feb 14, 2021 9:55 am
by Oleg
Where to use the code when I want to use the variable? Should I copy the code to "Local variables"???
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
You can see the task and use task editor to edit it and see all parameters of each step