Editing a notepad file in QTP - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: Editing a notepad file in QTP (/Thread-Editing-a-notepad-file-in-QTP) |
Editing a notepad file in QTP - arjun.singh - 03-23-2009 Hi, Can anyone please help me.I am trying to open a saved notepad file,search a particular string,edit it,save the file and closes it. How to do that in QTP? RE: Editing a notepad file in QTP - Tarik Sheth - 03-23-2009 Hi, You can try this. Code: dim fso,a RE: Editing a notepad file in QTP - Jackomcnabb - 03-24-2009 Here is a Script I built to Read a file in and search for version Numbers this should give you an idea of how to search for a string in a file. Code: ExpectedVersion = Parameter("ExpectedVersion") RE: Editing a notepad file in QTP - Ankesh - 10-20-2011 Hi All, I know its an old post bt i am having same issue. Can u tell me how to save the notepad after editing. I am using file system object. Regards, Ankesh i have another issues. I have a notepad which contains only one single line. My objective is to replace the existing line with the new line and save the file. Any help would be appreciated. Regards, Ankesh RE: Editing a notepad file in QTP - rajpes - 10-20-2011 1.It is automatically saved when you perform those write operations 2.One way is, read all contents of notepad(ReadAll) into a string var. Then replace(var,"oldstring","new string"). Get the file name in some other variable.delete the file.create a new notepad with same name and fileobj.Write var RE: Editing a notepad file in QTP - Ankesh - 10-20-2011 Thanks rajpes for ur time. I have already thought of your suggestion first. I dont want to delete and create again. I want to do it in one shot. I found one solution for it..and it is working for me. My objective was to open a notepad, get its content, perform some matematical operations and generate a new string and finally write the new string to the file.. Code: Const ForReading = 1, ForWriting = 2 Regards, Ankesh |