Jump to content

Control cannot be found?


aj1234
 Share

Recommended Posts

hi,

i'm trying to set a text of a control. now if the autoit script runs when the window was open (this is a sub-window login panel in an application), it successfully changes the text. however if the window openning was triggered by autoit, for some reason it doesn't find the control.

i've tried delaying the process, however no luck.

is the above behaviour by design? is there a window list i need to refresh after a new window is created so autoit can find it?

your help is much appreciated.

my code is below

ControlSend($currentTerminal, "", 59648, "!fl")
    Sleep(10)
    ControlSetText($currentTerminal, "", 1220,"user")
Edited by aj1234
Link to comment
Share on other sites

ok, some progress here - i found what might be the problem.

the login window which opens is the only focusable window, ie the background cannot be used until the login window is closed.

now if i check the window class list, it returns 2 different lists if before opening the login window, and after. i'm guessing the autoit is traversing that list? how to go around it?

please help!

Link to comment
Share on other sites

The only code you posted shows the exact same variable $currentTerminal identifying the window, but your description says the login window is different from the parent window. So, how did you set the value of $currentTerminal, and if it points to the parent window initially, how do you change it to point to the login child window?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

$currentTerminal is the handle of the main window. As far as I'm aware, handles are unique until the windows are closed?

since the login window is on top of the main window, and once you click the main window, the login window blinks and selected, i thought i can use the main window handle. am i wrong?

Link to comment
Share on other sites

You are wrong. The login child window has its own handle. The parent retains its handle, and it won't change as long as the parent window exists. The login dialog handle will be different.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...