quarqo Posted August 20, 2014 Posted August 20, 2014 (edited) Hello! I recently cam across a weird problem related to "controlsend" and "controlclick" functions. So, if I use for example: ControlClick("Window Title", "", "", "left", 1, 116, 78) This line of code is working perfectly! Anyway, if I get the handle of the window and insert it into the above code, it stop working! $hwnd = WinGetHandle ( "Window Title" ) ControlClick($hwnd, "", "", "left", 1, 116, 78) ;not working anymore The controlclick/send functions shouldn't work with both, Window Title or Window Handle? If anyone could help me out, I would appreciate. Edited August 20, 2014 by quarqo
MikahS Posted August 20, 2014 Posted August 20, 2014 (edited) I think it might have something to do with the window not being the active window, as per the remarks it must be the active window. Local $hwnd, $active $hwnd = WinGetHandle("Window Title") $active = WinWaitActive($hwnd) If $active = 0 Then MsgBox(0, "title", "error could not make window active") Exit EndIf ControlClick($hwnd, "", "", "left", 1, 116, 78) Edited August 20, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
jdelaney Posted August 20, 2014 Posted August 20, 2014 You should really place in a control to click, as well. Else, I believe you are clicking at a point within the focused control. And those coords may be outside of the bounds of that control, effectively clicking nothing. 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.
MikahS Posted August 20, 2014 Posted August 20, 2014 (edited) very good advice, jdelaney. That could be your problem quarqo, if it is not because the window is not active. Edited August 20, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
quarqo Posted August 20, 2014 Author Posted August 20, 2014 Thank you soo much for your replies guys! Yes the problem was that my window was not active, but I don't want to activate it..hm..
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