oMBRa Posted August 15, 2008 Posted August 15, 2008 how to get the ID of a control knowing the id? and how to use command ControlSend knowing only the handle of a control
Andreik Posted August 15, 2008 Posted August 15, 2008 how to get the ID of a control knowing the id? and how to use command ControlSend knowing only the handle of a controlControl ID is returned by GuiCtrlCreate or is a control from another application?
martin Posted August 15, 2008 Posted August 15, 2008 how to get the ID of a control knowing the id? and how to use command ControlSend knowing only the handle of a controlYou can get a list of the classes in a window with WinGetClassList, see this function by MrCreatoR to list a window's controls.You can get the handle of a control from its id or its class name using ControlGetHandle. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Moderators SmOke_N Posted August 15, 2008 Moderators Posted August 15, 2008 (edited) how to get the ID of a control knowing the id? and how to use command ControlSend knowing only the handle of a controlSeeing that there is no [HANDLE; hwnd here] control option for the id parameter .... Func _ControlGetID($h_wnd) Local $a_GetDlgCtrlID = DllCall("User32.dll", "int", "GetDlgCtrlID") If Not @error And $a_GetDlgCtrlID[0] > 0 Then Return $a_GetDlgCtrlID[0] Return SetError(1, 0, "") EndFunc That could fail if the control doesn't have an id though... so you may want to look at using the ClassNameNN as they suggested above. Not sure about their functions, but I wrote one that enums a window and gathers that info using WinGetClassList(). http://www.autoitscript.com/forum/index.ph...c=32781&hl= Edit: After all this time, you still learn things. I was just informed by Valik that you can in fact use the controls handle in the identifier parameter. Don't ever remember reading that as an option... tested and works (as if I had doubts). Edited August 15, 2008 by SmOke_N 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.
Andreik Posted August 15, 2008 Posted August 15, 2008 Seeing that there is no [HANDLE; hwnd here] control option for the id parameter .... Func _ControlGetID($h_wnd) Local $a_GetDlgCtrlID = DllCall("User32.dll", "int", "GetDlgCtrlID") If Not @error And $a_GetDlgCtrlID[0] > 0 Then Return $a_GetDlgCtrlID[0] Return SetError(1, 0, "") EndFunc That could fail if the control doesn't have an id though... so you may want to look at using the ClassNameNN as they suggested above. Not sure about their functions, but I wrote one that enums a window and gathers that info using WinGetClassList(). http://www.autoitscript.com/forum/index.ph...c=32781&hl= Your function return same thing like _WinAPI_GetDlgCtrlID()?
Moderators SmOke_N Posted August 15, 2008 Moderators Posted August 15, 2008 Your function return same thing like _WinAPI_GetDlgCtrlID()?I'm sure... I forget about the api functions... could make life easier on myself huh ... 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.
oMBRa Posted August 16, 2008 Author Posted August 16, 2008 I get an error with autoit: there was an error in autoit3.exe. the application will be closed.
Moderators SmOke_N Posted August 16, 2008 Moderators Posted August 16, 2008 I get an error with autoit: there was an error in autoit3.exe. the application will be closed.Awesome. 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.
PsaltyDS Posted August 16, 2008 Posted August 16, 2008 I get an error with autoit: there was an error in autoit3.exe. the application will be closed.You declared a Local thingy vice a Global doohicky in line 637g.How many times are we going to have to point that out to people... 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
PsaltyDS Posted August 16, 2008 Posted August 16, 2008 what u mean?It was an attempt at humorous sarcasm, which must be considered a failure when that has to be pointed out... The point was, without explaining exactly what you did, and perhaps showing the code you did it with, or a short snippet of code that does the same thing, we can't help. 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now