Exforsys

Online Training

how to write into notepad file through winrunner?

This is a discussion on how to write into notepad file through winrunner? within the Testing Tutorials forums, part of the Articles and Tutorials category; Hi group! how can we copy one line written in a notepad file to another notepad file.. and suppose there ...


Go Back   Exforsys > Articles and Tutorials > Testing Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-29-2005, 01:22 AM
Junior Member
 
Join Date: Feb 2005
Posts: 17
mangalsachin2002
how to write into notepad file through winrunner?

Hi group!

how can we copy one line written in a notepad file to another notepad file.. and suppose there are three words in this notepad file now i want to write every word in a new line in the new note pad file through winrunner.. plz help me..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-29-2005, 10:10 PM
Junior Member
 
Join Date: Sep 2004
Posts: 8
nexus59
1) open a text file say "foo1.txt" in read mode. function is file_open()
2) open another text file say "foo2.txt" in write mode
3) you need to get row count to know the total # of lines in foo1.txt file.
so use ddt_open() on foo1.txt and ddt_get_row_count()
4) for( ) //use the count variable for condition within for loop
file_getline() on foo1.txt
file_printf() on foo2.txt //
end for loop.
5) file_close() on foo1.txt and foo2.txt

if foo1.txt contents are
SAM
TOM
after executing the pgm , foo2.txt should contain
SAM
TOM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-03-2005, 02:39 PM
Junior Member
 
Join Date: Sep 2004
Posts: 8
nexus59
sachin try this one:

file_open(f1.txt);
file_open(f2.txt);

table = "C:\\f1.txt";
rc = ddt_open(table, DDT_MODE_READ);
if (rc!= E_OK && rc != E_FILE_OPEN)
pause("Cannot open table.");
ddt_get_row_count(table,Count);
for(i=0;i<=Count;i++)
{
file_getline(f1.txt,input);

split(input,v," ");

file_printf("C:\\f2.txt","%s\r\n%s\r\n%s",v[1],v[2],v[3]);
}

file_close(f1.txt);
file_close(f2.txt);

f1.txt = i am sachin
f2.txt = i
am
sachin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:16 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.