Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to concatenate 2 text files
#1
Solved: 10 Years, 9 Months ago
Hi All,

Can you pls help me on the below scenario?

I am trying to capture the Text from 2 different web pages and stored in a Text file. I used the following code
1st FileSadWeb page1)
--------
Code:
sVar=br(br).pg(pg).object.DocumentElement.Innertext
set oFSO=CreateObject("scripting.Filesystemobject")
set oFile1=oFSO.CreateTextFile("C:\temp\file1.txt",ForWriting,True)
oFile1.write sVar
oFile1.close
2nd FileSadweb page2)
-------
Code:
sVar2=br(br).pg(pg).object.DocumentElement.Innertext
set oFile1=oFSO.CreateTextFile("C:\temp\file2.txt",ForWriting,True)
oFile2.write sVar2
oFile2.Close

Now, I have to concatenate these two files and save in a different file. I need to remove extra spaces as well.

Can you please provide me the solution to do this?

Earliest reply is highly appreciated!
Thanks,
kishore
Reply
#2
Solved: 10 Years, 9 Months ago
Did you try the Append mode?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 10 Years, 9 Months ago
Ankur,

Can you pls provide code for Appending 2 files?

I have created a file in Append mode and am able to write the content into it. However, I need information on how to combine 2 text files and read into a single file? I will be capturing text from 2 different web sites and will be writing into a Text file. For this, I would request your detailed answer.

Team-->I welcome anyone's complete answer.

Earliest reply would be gr
Thanks,
kishore
Reply
#4
Solved: 10 Years, 9 Months ago
Team,

I tried with Append mode and got the answer. Thanks Ankur for the support!
Kishore
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,542 09-13-2015, 12:06 AM
Last Post: ADITI1992
  QTP Should open files(say txt files) it can be n number from a folder. Shiv Y 1 2,524 12-18-2013, 01:45 AM
Last Post: mlkrqtp
  I am trying to extract text from a webelement but it is generating blank text scenari excellentpawan 2 4,288 08-13-2013, 08:37 PM
Last Post: excellentpawan
  How do I compare 2 text files? avanthika 4 14,283 12-10-2011, 09:03 PM
Last Post: Arul
  how to find a particular text in a text string pjavvaru 3 16,630 06-04-2010, 08:49 PM
Last Post: jsknight1969

Forum Jump:


Users browsing this thread: 1 Guest(s)