Copy&Paste functions in *.txt

Discuss RoboTask here
Post Reply
Viker
Posts: 2
Joined: Sun Nov 14, 2004 1:56 pm
Location: Ukraine

Copy&Paste functions in *.txt

Post by Viker »

I want to create some script, but I haven't such result I needed.

I have many TXT files for reading.
One file with constant text – CONSTANT.TXT.
And one file for writing – WRITE.TXT.

I need :
1)Open one of TXT files for reading
2)Copy first string of text and paste it to WRITE.TXT
3)Open CONSTANT.TXT copy first string of text and pust it to WRITE.TXT after text from point 1. Going to second string
4)Open TXT file from point 1, and copy second string
5)Open CONSTANT.TXT copy second string of text and pust it to WRITE.TXT after text from point 1. Going to third string
bla bla bla...

And main problem, that this script must started when I click on "NEW Message" button in Outlook, and result text from WRITE.TXT must append as signature to message.

PLZ HELP ME ;)
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Copy&Paste functions in *.txt

Post by Oleg »

I think, that your files contains not many lines.
Read the Const.txt file into the user variable named const (see task below) like comma separated text. Next you can access to each line as const(i) where i is line number.
And main problem, that this script must started when I click on "NEW Message" button in Outlook, and result text from WRITE.TXT must append as signature to message.
You can form the write.txt file and next force Outlook Express to begin a new message.

For example see task below. In order to import this task into RoboTask save text of task to any *.tsk file and use "Task | Import " menu command.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|565106205
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task185"
Hide=INTEGER|0
ID=INTEGER|1792563564
Name=STRING|"Combine two texts demo"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action1\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
file0=STRING|"c:\write.txt"
subdir=STRING|"0"
ToRecycleBin=STRING|"0"

[Actions\Action10]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""LINE_NO"" with value ""0"""
Params=FOLDER

[Actions\Action10\Params]
expand=STRING|"0"
varname=STRING|"LINE_NO"
varvalue=STRING|"0"

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

[Actions\Action11\Params]
destvar=STRING|"LINE"
file=STRING|"c:\text.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"

[Actions\Action12]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file c:\write.txt"
Params=FOLDER

[Actions\Action12\Params]
fileexists=STRING|"1"
filname=STRING|"c:\write.txt"
line0=STRING|"{line}"
line1=STRING|"{Const({Line_No})}"
linecount=STRING|"2"

[Actions\Action13]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action14]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to ""- Outlook Express"""
Params=FOLDER

[Actions\Action14\Params]
currentwindow=STRING|"0"
fixedwindow=STRING|"0"
keylayout=STRING|"0"
keys=STRING|"""%(F){ENTER}{ENTER}{DELAY 300}{TAB}{TAB}{TAB}"""
sendkind=STRING|"0"
wincaption=STRING|"- Outlook Express"

[Actions\Action15]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER

[Actions\Action15\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"0"
keylayout=STRING|"0"
keys=STRING|"""%(I){DOWN}{ENTER}{DELAY 100}c:\write.txt{enter}"""
sendkind=STRING|"0"
wincaption=STRING|"- Outlook Express"

[Actions\Action16]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""LINE"""
Params=FOLDER

[Actions\Action16\Params]
varname=STRING|"LINE"

[Actions\Action17]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""CONST"""
Params=FOLDER

[Actions\Action17\Params]
varname=STRING|"CONST"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""CONST"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"CONST"

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

[Actions\Action3\Params]
destvar=STRING|"LINE"
file=STRING|"c:\const.txt"
linecount=STRING|"0"
sourcetext=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"7"
type=STRING|"0"
value1=STRING|"{const}"

[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""CONST"" with value """"{line}"""""
Params=FOLDER

[Actions\Action5\Params]
expand=STRING|"1"
varname=STRING|"CONST"
varvalue=STRING|"""{line}"""

[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 ""CONST"" with value ""{const},""{line}"""""
Params=FOLDER

[Actions\Action7\Params]
expand=STRING|"1"
varname=STRING|"CONST"
varvalue=STRING|"{const},""{line}"""

[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

;end of task
Viker
Posts: 2
Joined: Sun Nov 14, 2004 1:56 pm
Location: Ukraine

Copy&Paste functions in *.txt

Post by Viker »

SNX, now I have something
like this

[string1 from dynamic file1][string1 from CONST fileC]
[string2 from dynamic file1][string2 from CONST fileC]
[string3 from dynamic file1][string3 from CONST fileC]
[string4 from dynamic file1][string4 from CONST fileC]

and this is cool ;)

But now I must change dynamic file manually.

I have folder with "dynamic" files(1.txt, 2.txt,...), and I make listing of this files to LISTING.TXT(without file path).

On next step I reading this file, and select one file for copying it (from e:\dynamic\*.txt I must copy one file to e:\) - like you say "Read the Const.txt file into the user variable named const (see task below) like comma separated text. Next you can access to each line as const(i) where i is line number. ".

But all files selected, so I can't copy one file. All
e:\dynamic\*.* copied to e:\.
But I needed only e:\DynamicFile.TXT

PS text.txt (from your example) = e:\DynamicFile.TXT


Thanks
Post Reply