0

hello guys,

I have written a script to open notepad and added the text in script, after that i want to save the file in text format.

from pywinauto import application


from pywinauto import application
app=application.Application()
app.start_('Notepad.exe')
app.Notepad.edit.TypeKeys('hello')
app.Notepad.MenuSelect("File->Open")
app.Notepad.MenuSelect("File->Save")/*saveas dialog box opened and waiting for the filename*/

Please guide me

Regards
kumar

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by kumar86
0

You don't have to open Notepad or use extra modules to write and save a text file. It's all built in.

# Opens a file called Hello.txt for writing.
f = open("Hello.txt", "w")
          #Filename  #Mode

# Write the text to the file.
f.write("Hello world!")

# Close the file
f.close()

This will work just fine unless you absolutely have to use Notepad for some reason.

0

hello guys,

I am writing automated python script. How can i propagate the result of each script in XL sheet, whether the script is passed or failed. could you please help me

For example , my first script is to verify 'open an existing project'
and second script to verify the 'to close the opened project'.
so each script should propagate the result PASSED or FAILED to xl sheet with filename

Regards
kumar

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.