Jump to content

How I cand find TextBox ID (after clicking Mouse on it)?


Recommended Posts

I am able to use MouseClick to select a TextBox on another application, however I need its ID number to enter a string directly on it (it doesn't have any Title therefore I can't use ControlFocus on it) !

Anyone know any method to find it? Thanks to any help  :sweating:

Link to comment
Share on other sites

Hi Danp2,

I have verified a lots functions about GUI controls but I have been  in vain  (ie: http://www.autoitscript.com/autoit3/docs/functions/), as I mentionned before those functions required Title or handle which I don't have it 

*) I only can file its related values by using _EnumList function (ID & class), but since it doesn't have the title & the class name having the same with other items (Child windows) therfore I can't get which ID is right (only identifying it by viewing directly to it)

Edited by Curious52
Link to comment
Share on other sites

After clicking the control ("TextBox") in your script, try using:-

ControlSend("", "", "", "The string to be sent")
 

Here is an example script which works.

; Run script then:-
; Select (click on) the "TexBox" you wish to send a string to.
; Press "Alt" key and "c" key together to send the string "Sent Text" to the selected "TexBox".
; Press the Esc key to quit.
HotKeySet("{ESC}", "Terminate") ; Esc
HotKeySet("!s", "_Send") ; Alt+ s

Local $a

While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func _Send()
    ControlSend("", "", "", "Sent Text")
    ;...........^ The first "" will select the title of the currently active window on which the control can be found.
    ; The third "" will select the id of the currently active, or selected, control - the "TexBox".
EndFunc   ;==>_Send
Link to comment
Share on other sites

I believe this >

; Press "Alt" key and "c" key together to send the string "Sent Text" to the selected "TexBox".

should read >

; Press "Alt" key and "s" key together to send the string "Sent Text" to the selected "TexBox".

REB

MEASURE TWICE - CUT ONCE

Link to comment
Share on other sites

Try something like this:

#include <WinAPI.au3>
Run("notepad.exe")
WinWait("[CLASS:Notepad]")
Local $sControl = ControlGetFocus("[ACTIVE]")
;~ MsgBox(0, "ControlGetFocus Example", "The control that has focus is: " & $sControl)
$hControl = ControlGetHandle("[ACTIVE]","",$sControl)
$iControl = _WinAPI_GetDlgCtrlID($hControl)
ConsoleWrite($iControl & @CRLF)
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...