Rename content of a text fil

Discuss RoboTask here
Post Reply
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Rename content of a text fil

Post 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
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Rename content of a text fil

Post 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.
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Rename content of a text fil

Post by rice1973 »

Hi Oleg,
 
Can you help me with a task file?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Rename content of a text fil

Post 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"
Post Reply