Hi there, I have created a process to rename files, what I want to have happen is to rename files with the variable I gather from the user input dialog
so myvariableFILENAME.EXT
I cant figure out how to pass the original filename to the rename process.
I am probably being dumb but I cant see it!
Thanks
append variable to filename process
Re: append variable to filename process
Look at my example. I hope this helps
Save the text of the task to a file and use menu Task -> Import to import it 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|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task545"
Hide=INTEGER|0
ID=INTEGER|1106714061
LogOnAsUser=INTEGER|1
Name=STRING|"add prefix to file 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
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILENAME"" with value ""FILENAME.EXT"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FILENAME"
varvalue=STRING|"FILENAME.EXT"
[Actions\Action2]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER
[Actions\Action2\Params]
default=STRING|"none"
password=STRING|"0"
prompt=STRING|"Enter the prefix"
variable=STRING|"PREFIX"
[Actions\Action3]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{prefix}"
value2=STRING|"none"
[Actions\Action4]
ActionID=STRING|"A_FLOW_EXIT"
Enabled=INTEGER|-1
Name=STRING|"Exit"
[Actions\Action5]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NEWNAME"" with value ""{prefix}{filename}"""
Params=FOLDER
[Actions\Action6\Params]
expand=STRING|"1"
varname=STRING|"NEWNAME"
varvalue=STRING|"{prefix}{filename}"
[Actions\Action7]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Old name: {filename}"""
Params=FOLDER
[Actions\Action7\Params]
icon=STRING|"1"
msg0=STRING|"Old name: {filename}"
msg1=STRING|"New name: {newname}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Re: append variable to filename process
Thanks Oleg, I think I see the logic of that, but where I am now stuck is how to apply this process in the context of my existing one.
Currently I monitor a folder that is an SD Card, so if its inserted, RoboTask creates a list of files of the pattern - P*.MP4 - then renames those (on the card)
Once that is done I will copy those files to a network mapped drive.
My experience is with Apple Automator so this is still a little unfamiliar to me, how would I achieve that?
Currently I monitor a folder that is an SD Card, so if its inserted, RoboTask creates a list of files of the pattern - P*.MP4 - then renames those (on the card)
Once that is done I will copy those files to a network mapped drive.
My experience is with Apple Automator so this is still a little unfamiliar to me, how would I achieve that?
Re: append variable to filename process
I should add that the UNKNOWN IF Then parts in the task - I assume I need to put some process in there right? But again not clear what that is.
For a future update, would it make sense to tweak the rename function to add append text to existing filename?
Thats something that you can do in a few other automation applications and might avoid the complexity of the process and lighten up your excellent support workload.
For a future update, would it make sense to tweak the rename function to add append text to existing filename?
Thats something that you can do in a few other automation applications and might avoid the complexity of the process and lighten up your excellent support workload.
Re: append variable to filename process
it seem you work with RoboTask LiteI should add that the UNKNOWN IF Then parts in the task - I assume I need to put some process in there right? But again not clear what that is.
Try this example
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
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task545"
Hide=INTEGER|0
ID=INTEGER|1106714061
LogOnAsUser=INTEGER|1
Name=STRING|"add prefix to file 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
Action3=FOLDER
Action4=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILENAME"" with value ""FILENAME.EXT"""
Params=FOLDER
[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FILENAME"
varvalue=STRING|"FILENAME.EXT"
[Actions\Action2]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER
[Actions\Action2\Params]
default=STRING|"none"
password=STRING|"0"
prompt=STRING|"Enter the prefix"
variable=STRING|"PREFIX"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NEWNAME"" with value ""{prefix}{filename}"""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"1"
varname=STRING|"NEWNAME"
varvalue=STRING|"{prefix}{filename}"
[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Old name: {filename}"""
Params=FOLDER
[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"Old name: {filename}"
msg1=STRING|"New name: {newname}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
Oleg Yershov
Re: append variable to filename process
Also look at this example below.
It is not trivial but it should work with RoboTask Lite.
The task creates the list of filed and batch file for renaming.
Then it run CMD file.
It is not trivial but it should work with RoboTask Lite.
The task creates the list of filed and batch file for renaming.
Then it run CMD file.
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1604865554
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task546"
Hide=INTEGER|0
ID=INTEGER|-793738978
LogOnAsUser=INTEGER|1
Name=STRING|"add prefix for Lite version"
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
Action4=FOLDER
Action5=FOLDER
[Actions\Action1]
ActionID=STRING|"A_FOLDER_CHANGE"
Enabled=INTEGER|-1
Name=STRING|"Change Folder (D:\incoming\test)"
Params=FOLDER
[Actions\Action1\Params]
folder=STRING|"D:\incoming\test"
[Actions\Action2]
ActionID=STRING|"A_MISC_RUNCONSOLEAPP"
Enabled=INTEGER|-1
Name=STRING|"Run command-line utility: cmd /c dir /b *.txt >list"
Params=FOLDER
[Actions\Action2\Params]
convertansi=STRING|"0"
ifnonzero=STRING|"0"
params=STRING|"/c dir /b *.txt >list"
program=STRING|"cmd"
saveexitcode=STRING|"0"
saveoutput=STRING|"1"
[Actions\Action3]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER
[Actions\Action3\Params]
default=STRING|"none"
password=STRING|"0"
prompt=STRING|"Enter the prefix"
variable=STRING|"PREFIX"
[Actions\Action4]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file MyRename.cmd"
Params=FOLDER
[Actions\Action4\Params]
encode=STRING|"0"
fileexists=STRING|"0"
filname=STRING|"MyRename.cmd"
line0=STRING|"@echo off"
line1=STRING|":m1"
line2=STRING|"set fff="
line3=STRING|"set /p fff=Input file"
line4=STRING|"if ""%fff%""=="""" goto end"
line5=STRING|"ren ""%fff%"" ""{prefix}%fff%"""
line6=STRING|"goto m1"
line7=STRING|":end"
linecount=STRING|"8"
suppress=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_MISC_RUNCONSOLEAPP"
Enabled=INTEGER|-1
Name=STRING|"Run command-line utility: cmd /c myrename.cmd < list"
Params=FOLDER
[Actions\Action5\Params]
convertansi=STRING|"0"
ifnonzero=STRING|"0"
params=STRING|"/c myrename.cmd < list"
program=STRING|"cmd"
saveexitcode=STRING|"0"
saveoutput=STRING|"1"
Oleg Yershov