Jump to content

Using a Handle


 Share

Recommended Posts

STRAIGHT FROM HELP

; Identify the Notepad window that contains the text "this one" and get a handle to it

; Change into the WinTitleMatchMode that supports classnames and handles
AutoItSetOption("WinTitleMatchMode", 4)

; Get the handle of a notepad window that contains "this one"
$handle = WinGetHandle("classname=Notepad", "this one")
If @error Then
    MsgBox(4096, "Error", "Could not find the correct window")
Else
   ; Send some text directly to this window's edit control
    ControlSend($handle, "", "Edit1", "AbCdE")
EndIf

New to AutoIt ?

A Great Place To Start:

==> Welcome to AutoIt 1-2-3 <==

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

Anyone have any good examples of using a handle

A handle for what? Do you know the window name you want to find the handle of, or the .exe name? Care to elaborate a bit more... so we aren't chasing our tails, and hearing .... I've already tried that (Putting what you've done ... what code you've tried and failed at ... and as much description as possible about what your trying to accomplish ... usually yields the best results.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

A handle for what? Do you know the window name you want to find the handle of, or the .exe name? Care to elaborate a bit more... so we aren't chasing our tails, and hearing .... I've already tried that (Putting what you've done ... what code you've tried and failed at ... and as much description as possible about what your trying to accomplish ... usually yields the best results.

I am a financial trader and have a script, with the help from some of you, takes a text file and runs through each symbol and enters this into a text file. The script works, but I now want to run this on my trading platform ( level 2 screen ). I know how to find the handle:

For $i = 1 to $var[0][0]
; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

The trading platform has muliple level 2 screens open at one time.....the handle for one of them is 00090218

I want to have the script run and execute on this level 2 screen.

Edited by chandler8
Link to comment
Share on other sites

  • Moderators

Blah... you give NO descriptions... 'Run' this on my trading platform 2... what the heck is that? Run what? Input data? Screen shots with examples would be great... And you've still not posted what "You" have done to try to accomplish that.

So with the description you've given... I'll say this: Look at ControlCommand() / ControlSend() / ControlSetText() / etc... in the Help File if it isn't an internet application. That's about as good as I personally can do without any pertinent information.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...