Page 1 of 1

trigger every other week

Posted: Fri Apr 08, 2011 4:07 pm
by racheney
Thank You oleg for your answer on "trigger 3rd tue of month".
Do you have an algorithm to perform a task every other week
reguardless of which day IE: week 1,3,5,7,9,etc. without checking the week# 52 times.
 

trigger every other week

Posted: Sat Apr 09, 2011 12:49 am
by Oleg
There is WeekOfTheYear system variable
You can calculate whether WeekOfTheYear is odd or even.
Use Evaluate action (in Basic group) for this purpose with the following expression
{WeekOfTheYear({Date})} mod 2

if expression is 0 then the week # is even, otherwise - odd.

algorithm will be such:

evalate {WeekOfTheYear({Date})} mod 2 // and save to Num variable
if {NUM}>0 then
   ...
   do something
   ...
end if


trigger every other week

Posted: Sat Apr 09, 2011 4:32 am
by racheney
Thanks again Oleg,
I founf the evalate and the {WeekOfTheYear({Date})} but i could not find any wat to check for even/odd.
where can i get a list of modifiers like the "mod 2" used here? 

trigger every other week

Posted: Sat Apr 09, 2011 7:30 am
by Oleg
You should install additional Basic plugin.
Download here.
You can find the full help of built-in Basic. Press F1 in action editor (for Evaluate and Basic Script actions)

See the example below:
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1931015449
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1064"
Hide=INTEGER|0
ID=INTEGER|153548598
LocalVariables=STRING|"num"
LogOnAsUser=INTEGER|1
Name=STRING|"Even or odd week"
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
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER

[Actions\Action1\Params]
expression=STRING|"{WeekOfTheYear({Date})} mod 2"
variable=STRING|"NUM"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{num}"
value2=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""This is EVEN week"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"This is EVEN week"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""This is ODD week"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"This is ODD week"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action6]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"