I have playlist filenames that use date and hour such as Sat1200.alb.
Trying to write NEXT HOUR's playlist to a folder with a different name
Tried creating a variable {PFN} that equals next hour {Hour(+1)} but it does not work. It still shows THIS HOUR and not next hour. Is there an easy way to a variable = next hour instead of this hour?
HOUR + 1
Re: HOUR + 1
Look at my example
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1251730006
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task163"
Hide=INTEGER|0
ID=INTEGER|-121147657
LogOnAsUser=INTEGER|1
Name=STRING|"add hour"
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
Action3=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""H"" with value ""{hours}"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"H"
varvalue=STRING|"{hours}"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_INCREMENT"
Enabled=INTEGER|-1
Name=STRING|"Increment variable ""h"""
Params=FOLDER
[Actions\Action2\Params]
incement=STRING|"1"
vaiable=STRING|"h"
[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""current hour = {hours}"""
Params=FOLDER
[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"current hour = {hours}"
msg1=STRING|"next hour = {h}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Re: HOUR + 1
You made it so easy. Thank you so much for your help!
Re: HOUR + 1
Hey Oleg,
In regard to this question, I'm searching for a solution with does almost the same. When hours = 23 (in the example above) the increment will return 24, which (in my case) should be 00. The leading zero is important.
In the Demo task [DEMO] "TimeIncHours" custom function, the whole {DateTime} is used and will return it as well with the correct amount of hours. However, I only need the hours with the leading zero. The demo task does this part correct, but returns the whole date.
function TimeIncHours(tm, add)
TimeIncHours = DateAdd("h", CInt(add), CDate(tm))
end function
Due to the fact I am a VB / JS n00b, how can I (without using string / regex stuff) adjust the script so that this only returns the hours with a leading zero? The function DateAdd("h",1, Now()) does the same.
Edit
Hour(FormatDateTime(DateAdd("h",1, Now()+1),4)) -
Did it solved it myself now? WOW! It looks promsising to say at least.
Edit 2:
No, the leading zero is missing.![Mad :x](./images/smilies/icon_mad.gif)
In regard to this question, I'm searching for a solution with does almost the same. When hours = 23 (in the example above) the increment will return 24, which (in my case) should be 00. The leading zero is important.
In the Demo task [DEMO] "TimeIncHours" custom function, the whole {DateTime} is used and will return it as well with the correct amount of hours. However, I only need the hours with the leading zero. The demo task does this part correct, but returns the whole date.
function TimeIncHours(tm, add)
TimeIncHours = DateAdd("h", CInt(add), CDate(tm))
end function
Due to the fact I am a VB / JS n00b, how can I (without using string / regex stuff) adjust the script so that this only returns the hours with a leading zero? The function DateAdd("h",1, Now()) does the same.
Edit
Hour(FormatDateTime(DateAdd("h",1, Now()+1),4)) -
![Shocked :shock:](./images/smilies/icon_eek.gif)
![Shocked :shock:](./images/smilies/icon_eek.gif)
Edit 2:
No, the leading zero is missing.
![Mad :x](./images/smilies/icon_mad.gif)
Re: HOUR + 1
Maybe this? Look at this example...how can I (without using string / regex stuff) adjust the script so that this only returns the hours with a leading zero?
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1474"
Hide=INTEGER|0
ID=INTEGER|-1459948289
LogOnAsUser=INTEGER|1
Name=STRING|"[DEMO-modified] ""TimeIncHours"" custom function"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""TM"" with value ""{DateTime}"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"1"
varname=STRING|"TM"
varvalue=STRING|"{DateTime}"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""DELTA"" with value ""15"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"DELTA"
varvalue=STRING|"15"
[Actions\Action3]
ActionID=STRING|"A_SCRIPT_VBEVALUATE"
Enabled=INTEGER|-1
Name=STRING|"VB Evaluate"
Params=FOLDER
[Actions\Action3\Params]
expression=STRING|"TimeIncHours(""{tm}"", {delta})"
line00000000=STRING|"function TimeIncHours(tm, add)"
line00000001=STRING|" TimeIncHours = DateAdd(""h"", CInt(add), CDate(tm))"
line00000002=STRING|"end function"
line00000004=STRING|"'logmessage(TimeIncHours(""10:22:35"", ""12""))"
linecount=STRING|"5"
loadfromfile=STRING|"1"
variable=STRING|"newTime"
[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""TimeIncHours result:"""
Params=FOLDER
[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"TimeIncHours result:"
msg2=STRING|"Current time: {tm}"
msg3=STRING|"Delta: {delta}"
msg4=STRING|"New time: {NewTime}"
msg5=STRING|"Only time {Time({NewTime})}"
msg6=STRING|"Only hours {DateTimeToFormat({NewTime},hh)}"
msg7=STRING|"Hours and minutes {DateTimeToFormat({NewTime},hh:mm)}"
msgcount=STRING|"8"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Re: HOUR + 1
Yupz, ofcourse that works perfectly! Thanks.