Jump to content

Filling in text fields on dialog boxes...


Allegro
 Share

Recommended Posts

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.

Link to comment
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] )

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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!

Link to comment
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}")
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...