Sign in to follow this  
Followers 0
Allegro

Filling in text fields on dialog boxes...

8 posts in this topic

I trying to automate a software install that requires information entered into some dialog boxes during the install. For example server names and product codes. These are all ascii strings. I can get the windows info for the box, just need to know how to add the required text in the fields. Thanks.

Share this post


Link to post
Share on other sites



I trying to automate a software install that requires information entered into some dialog boxes during the install. For example server names and product codes. These are all ascii strings. I can get the windows info for the box, just need to know how to add the required text in the fields. Thanks.

search func for

Chr ( ASCIIcode ) and

Send ( "keys" [, flag] )

Share this post


Link to post
Share on other sites

search func for

Chr ( ASCIIcode ) and

Send ( "keys" [, flag] )

There is more than one field that needs to be filled in. How do you apply a specific string to a specific field? Thanks.

Share this post


Link to post
Share on other sites

There is more than one field that needs to be filled in. How do you apply a specific string to a specific field? Thanks.

you must get, with AutoIT windows Info, the class/edit in the

windows gui. watch window management in the help file

WinTextMatchMode (Option) and Advanced Window Descriptions

like this

If WinWaitActive("[TITLE:My Window; CLASS:Edit; INSTANCE:2]", "") Then

Send("{ASC 065}")

EndIf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

like this?

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("gui", 384, 259, 193, 115)
$Input1 = GUICtrlCreateInput("", 32, 64, 121, 21)
$Input2 = GUICtrlCreateInput("", 216, 64, 121, 21)
$Input3 = GUICtrlCreateInput("", 120, 144, 121, 21)
$send = GUICtrlCreateButton("send", 128, 200, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
if $nMsg <> "" And $nMsg <> 0 Then
    
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
    Case $send
        If WinExists("gui", "") Then

            ControlFocus("gui", "", "Edit1")
            ControlSend("gui", "", "Edit1", "Edit 1")
            
            ControlFocus("gui", "", "Edit2")
            ControlSend("gui", "", "Edit2", "Edit 2")
            
            $text = ""
            For $i = 65 to 90
                $text = $text & Chr($i)
            Next
            
            ControlFocus("gui", "", "Edit3")
            ControlSend("gui", "", "Edit3", $text)

        EndIf

    EndSwitch
EndIf

WEnd
Edited by silvano

Share this post


Link to post
Share on other sites

silvano,

Thanks for the help on this. I will try to have a look at it soon... Real work gets in the way sometimes....

Share this post


Link to post
Share on other sites

silvano,

Thanks for the help on this. I will try to have a look at it soon... Real work gets in the way sometimes....

ControlFocus("GUI", "", "Edit2")

ControlSend("GUI", "", "Edit2", "Edit 2")

It Worked! It placed the text Edit 2 into the field Edit2.

The next question is a bit trickier -- If text already exits in the field, how can it be deleted or overwritten with the new?

This might be the case with certain installs of software, where an older version has already been setup...

Thanks, much appreciated!

Share this post


Link to post
Share on other sites

ControlFocus("GUI", "", "Edit2")

ControlSend("GUI", "", "Edit2", "Edit 2")

It Worked! It placed the text Edit 2 into the field Edit2.

The next question is a bit trickier -- If text already exits in the field, how can it be deleted or overwritten with the new?

This might be the case with certain installs of software, where an older version has already been setup...

Thanks, much appreciated!

try this

ControlFocus("gui", "", "Edit2")
ControlSend("gui", "", "Edit2", "+{HOME}{DEL}")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0