Jump to content
Sign in to follow this  

_MouseClickPlus or ControlClick on Chrome

Recommended Posts

Hi everyone.

I'm trying since 4 hourse (googling and everything) to make a damn click on a Chrome webpage to make some tests (http://www.barneyb.com/r/jquery_live_button.cfm)

I'm not able to make it work.... Does anyone had already bashed his head on it and solved it?

Here's the _MouseClickPlus (which is the one I would prefere to work with) and ControlClick code I am trying now:


Local $handle = WinGetHandle("[CLASS:Chrome_WidgetWin_1]")

ControlClick("www.barneyb.com/r/jquery_live_button.cfm - Google Chrome","","Chrome_RenderWidgetHostHWND","left",1,20,20)
_MouseClickPlus($handle,"left",20, 20, 1)

Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
Local $MK_LBUTTON = 0x0001
Local $WM_LBUTTONDOWN = 0x0201
Local $WM_LBUTTONUP = 0x0202

Local $MK_RBUTTON = 0x0002
Local $WM_RBUTTONDOWN = 0x0204
Local $WM_RBUTTONUP = 0x0205

Local $WM_MOUSEMOVE = 0x0200

Local $i = 0

Case $Button = "left"
$Button = $MK_LBUTTON
Case $Button = "right"
$Button = $MK_RBUTTON

If $X = "" OR $Y = "" Then
$MouseCoord = MouseGetPos()
$X = $MouseCoord[0]
$Y = $MouseCoord[1]

For $i = 1 to $Clicks
DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $WM_MOUSEMOVE, "int", 0, "long", _MakeLong($X, $Y))

DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $ButtonDown, "int", $Button, "long", _MakeLong($X, $Y))

DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle($Window), "int", $ButtonUp, "int", $Button, "long", _MakeLong($X, $Y))

Func _MakeLong($LoWord,$HiWord)
Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))

Coordinates are abritrary, I don't care, but I'm not able to make it click on chrome...

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post

Link to post
Share on other sites

This is a function I once found in the example scripts.

Opt("MouseCoordMode", 2)

MsClick("Window tittle","","","left",1,398, 349) ;Set window tittle for controlclick
MsClick("Window tittle","","","left",1,398, 349) ; >>

Func MsClick($tittle, $text, $controlid, $clickType, $clicks = 1, $x = 1, $y = 1)
$coord = UiRatio($x, $y)
ControlClick($tittle, $text, $controlid, $clickType, $clicks, $coord[0], $coord[1])
EndFunc ;==>MsClick

Func UiRatio($_x, $_y)
Dim $return[2]
$size = WinGetClientSize("[CLASS:Window tittle]") ; Must set so we can get windows' size
$return[0] = $size[1] * ($_x / $size[0])
$return[1] = $size[1] * ($_y / $size[1])
Return $return
EndFunc ;==>UiRatio

_MsClick(318, 542)
_MsClick(318, 542)

Func _MsClick($x, $y, $button = "left")
$coord = UiRatio($x, $y)
MouseClick($button, $coord[0], $coord[1])
EndFunc ;==>_MsClick()

Original post here: '?do=embed' frameborder='0' data-embedContent>>

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...