Ahmad Alhour
Ahmad Alhour

Reputation: 43

How do I fill text-boxes in a gui application through command line?

I'm designing an NLP (Natural Language Processing) application in python and I want to use the following UNL (Universal Networking Language) EnConverter that is an executable gui - 3rd party - application and only works on windows (I don't have its source-code) :


So, what I want to know is how can I program a console application that calls this EnConverter and press the "Setting" button then manage to fill the text-boxes in the following image:

When I click the "Setting" button, the previous window shows up... I want my application to fill these text-boxes, then press "OK"... When pressing the "OK" button the application returns to the first window... The last thing for the application (my application) to do is clicking the "EnConvert" button in the first window... See the the first image, please.

I know this is possible because my professor have done this job in Perl... And he refused to tell me how!!! I have researched the Internet but I got nothing!

Upvotes: 4

Views: 3087

Answers (3)

daxim
daxim

Reputation: 39158

You can use Win32::GuiTest. It can detect widgets, click buttons, write text to GUI etc.

Upvotes: 4

Fenikso
Fenikso

Reputation: 9451

You can use PyWinAuto. It can detect widgets, click buttons, write text to GUI etc.

Upvotes: 3

mavnn
mavnn

Reputation: 9469

The Windows Sendkey package looks like it should be ideal this kind of thing.

From the page:

In this example, SendKeys is used to type "Hello World!" in notepad.

import SendKeys
SendKeys.SendKeys("""
    {LWIN}
    {PAUSE .25}
    r
    Notepad.exe{ENTER}
    {PAUSE 1}
    Hello{SPACE}World!
    {PAUSE 1}
    %{F4}
    n
""")

Upvotes: 1

Related Questions