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

Recommended Answers

All 3 Replies

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.

thanks wildbamaboy

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.