Jump to content

Controlclick question/issue


 Share

Recommended Posts

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 by quarqo
Link to comment
Share on other sites

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 by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My 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

 

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

very good advice, jdelaney. That could be your problem quarqo, if it is not because the window is not active.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My 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

 

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