Page 1 of 1

Rename content of a text fil

Posted: Fri Jan 22, 2010 7:43 am
by rice1973
Hi Oleg,Is it possible to replace text "in" a text file?Example;file:test.txtIn the file the is a "." that needs to be replaced by ",".Best regards,Maurice

Rename content of a text fil

Posted: Fri Jan 22, 2010 8:16 am
by Oleg
Yes of course.

use STR Replace action.
put
{TextFile(Test.txt)}
into source string
and write result into NewText variable (for example)
Next step - Write Text File
use expression
{NewText}
as text.

Rename content of a text fil

Posted: Wed Feb 03, 2010 9:40 am
by rice1973
Hi Oleg,
 
Can you help me with a task file?

Rename content of a text fil

Posted: Thu Feb 04, 2010 1:43 am
by Oleg
See example below, please:

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task916"
Hide=INTEGER|0
ID=INTEGER|1703573345
LocalVariables=STRING|"filename,text"
LogOnAsUser=INTEGER|1
Name=STRING|"replace (.) to (,)"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FILENAME"" with value ""C:\incoming\test.txt"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"FILENAME"
varvalue=STRING|"C:\incoming\test.txt"

[Actions\Action2]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
mode=STRING|"0"
replacement=STRING|","
source=STRING|"{TextFile({FileName})}"
substring=STRING|"."
variable=STRING|"text"

[Actions\Action3]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file {FileName}"
Params=FOLDER

[Actions\Action3\Params]
fileexists=STRING|"0"
filname=STRING|"{FileName}"
line0=STRING|"{text}"
linecount=STRING|"1"
suppress=STRING|"1"