Substract MonthName

Discuss RoboTask here
Post Reply
Rukbunker
Posts: 192
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Substract MonthName

Post by Rukbunker »

Hello everyone,

Due to lack of VB skills, most likely this stupid question ;)

In Robotask, a report is being generated for the previous month. In short: {MonthNo} - 1 will do.
The report should be mailed, but instead of "Report of 10", ofcourse the best way is "Report of Oktober". (The report is generated in November). So: variable {MonthName} should be used.

Ofcourse, I cannot do {MonthName-1}. How can I make sure the name of the previous is being used?
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Substract MonthName

Post by Oleg »

RoboTask contains the system variable IncMonths
For previous month use: {IncMonths(-1)}

Basic script language has the function MonthName (see here for details)
So, to calculate the previous month name use the expression MonthName({IncMonths(-1)}) in the VB Evaluate action

Also 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|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task87"
Hide=INTEGER|0
ID=INTEGER|1568618943
LogOnAsUser=INTEGER|1
Name=STRING|"previous month name"
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"
Params=FOLDER

[Actions\Action1\Params]
expression=STRING|"MonthName({IncMonths(-1)})"
line00000000=STRING|"'"
linecount=STRING|"1"
loadfromfile=STRING|"1"
variable=STRING|"nam"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Current month: {MonthName}"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"Current month: {MonthName}"
msg1=STRING|"Previouse month: {nam}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Rukbunker
Posts: 192
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: Substract MonthName

Post by Rukbunker »

Works perfectly. Many thanks!
Post Reply