Jump to content

_MouseClickPlus or ControlClick on Chrome


Newb
 Share

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

Select
Case $Button = "left"
$Button = $MK_LBUTTON
$ButtonDown = $WM_LBUTTONDOWN
$ButtonUp = $WM_LBUTTONUP
Case $Button = "right"
$Button = $MK_RBUTTON
$ButtonDown = $WM_RBUTTONDOWN
$ButtonUp = $WM_RBUTTONUP
EndSelect

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

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))
Next
EndFunc

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

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.

Link to comment
Share on other sites

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

Opt("MouseCoordMode", 2)


Sleep(2000)
MsClick("Window tittle","","","left",1,398, 349) ;Set window tittle for controlclick
Sleep(2000)
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

#cs
Sleep(2000)
_MsClick(318, 542)
Sleep(2000)
_MsClick(318, 542)

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

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

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