Hey Oleg and team!
Situation: We are using Robotask at a regional radiostation and are planning to mix the audiobed and the news together with sox, hourly executed ofcourse. That's already working great.
However, we are getting new beds with the hour in it. "The news from 5 o'clock, 6 o'clock" etc with +- 3 variants per hour. So, I have like 36 beds, more or less.
Hour03_A.wav
Hour03_B.wav
Hour03_C.wav
In the naming of the bed (File search: 3*.wav) I can narrow it down to the correct hour with a variable, but the variant should be somehow random, no specific order. How can I program Robotask the best way (in your approach) to pick a rondom Hour{Hour}_x.wav file?
Pick random file
Re: Pick random file
Hello,
I saw the question and wanted to put a quick answer if this works for you. You can create a new variable or set a variable you already have or within your actions for calling the "random hour{Hour}_x.wav" file, you can call the system variable "{RandomValue(1000)}" and it will provide that variant I think your asking for. By default in the notes for this, it mentions it defaults to 1000 but you can change that value to be the limit you want it to be random for so it could be "{RandomValue(12)}{Hour}_x.wav" when you call the file to be used.
I saw the question and wanted to put a quick answer if this works for you. You can create a new variable or set a variable you already have or within your actions for calling the "random hour{Hour}_x.wav" file, you can call the system variable "{RandomValue(1000)}" and it will provide that variant I think your asking for. By default in the notes for this, it mentions it defaults to 1000 but you can change that value to be the limit you want it to be random for so it could be "{RandomValue(12)}{Hour}_x.wav" when you call the file to be used.
Re: Pick random file
Good idea, thanks for the heads up. I will try this option.
Re: Pick random file
Look at the example below.
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
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|"Task1442"
Hide=INTEGER|0
ID=INTEGER|-385310292
LogOnAsUser=INTEGER|1
Name=STRING|"Random file name"
OnErrorTaskID=INTEGER|0
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
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""num"" with value ""{RandomValue(1000)}"""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"num"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"num"
varvalue=STRING|"{RandomValue(1000)}"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then \\<=333"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"4"
type=STRING|"1"
value1=STRING|"{num}"
value2=STRING|"333"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""filename"" with value ""Hour{Hours}_A.wav"""
Params=FOLDER
[Actions\Action3\Params]
_rt_variables_produced=STRING|"filename"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"filename"
varvalue=STRING|"Hour{Hours}_A.wav"
[Actions\Action4]
ActionID=STRING|"A_FLOW_ELSEIF"
Enabled=INTEGER|-1
Name=STRING|"ElseIf Then \\ <=666"
Params=FOLDER
[Actions\Action4\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"4"
type=STRING|"0"
value1=STRING|"{num}"
value2=STRING|"666"
[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""filename"" with value ""Hour{Hours}_B.wav"""
Params=FOLDER
[Actions\Action5\Params]
_rt_variables_produced=STRING|"filename"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"filename"
varvalue=STRING|"Hour{Hours}_B.wav"
[Actions\Action6]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
[Actions\Action7]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""filename"" with value ""Hour{Hours}_C.wav"""
Params=FOLDER
[Actions\Action7\Params]
_rt_variables_produced=STRING|"filename"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"filename"
varvalue=STRING|"Hour{Hours}_C.wav"
[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER
[Actions\Action9\Params]
message=STRING|"{num}; {filename}"
type=STRING|"3"
Oleg Yershov
Re: Pick random file
Great purposal Oleg, I will try that as well.