ExtractFileNameNoExt multiline variable

Discuss RoboTask here
Post Reply
marcolobaido
Posts: 70
Joined: Thu Jul 02, 2015 3:54 pm

ExtractFileNameNoExt multiline variable

Post by marcolobaido »

Hi, I assigned several paths to a variable {A} and so It's a multiline variable. I need to write a file list without extention. ExtractFileNameNoExt{A} doesn't work.
what's the simplest way to use ExtractFileNameNoExt function with multiline variables?

Is there a simpler way than using text loop with variable {A}?
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: ExtractFileNameNoExt multiline variable

Post by Oleg »

If you have a list of files as a text (one file name per line) you have to use Text Loop action and extract names line-by-line
You can't extract file name from the list.

also look at my example how to do this (see below)
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|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task103"
Hide=INTEGER|0
ID=INTEGER|246339309
LogOnAsUser=INTEGER|1
Name=STRING|"Get filename from file list"
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 ""LIST"" with FileNames"
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"LIST"
varvalue=STRING|"D:\Temp\example.docx{EOL}D:\Temp\error.png{EOL}D:\Temp\test.xls{EOL}D:\Temp\download.xml"

[Actions\Action2]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action2\Params]
destvar=STRING|"NAME"
line0=STRING|"{List}"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Full name:"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"Full name:"
msg1=STRING|"{Name}"
msg3=STRING|"Name only:"
msg4=STRING|"{ExtractFileNameNoExt({Name})}"
msgcount=STRING|"5"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
Post Reply