Sign in to follow this  
Followers 0
OtokIT

Send Click Script Not Working ?

13 posts in this topic

#1 ·  Posted (edited)

Opt("MouseCoordMode", 0)
HotKeySet("+!d", "mPos");Shift-Alt-d
HotKeySet("+!s", "sClick");Shift-Alt-s
$winTitle = WinGetTitle("");
$pos = MouseGetPos()

Func mPos()
    $pos = MouseGetPos()
    $winTitle = WinGetTitle("");
    MsgBox(0, $winTitle & " Mouse x,y:", $pos[0] & "," & $pos[1])
EndFunc ;==>mPos

Func sClick()
    MouseMove($pos[0], $pos[1])
    _MouseClickPlus($winTitle, "left", $pos[0], $pos[1])
EndFunc ;==>sClick

WinWaitActive("empyrean")

;===============================================================================
;
; Function Name:  _MouseClickPlus()
; Version added:  0.1
; Description:  Sends a click to window, not entirely accurate, but works
;                minimized.
; Parameter(s):   $Window    =  Title of the window to send click to
;                $Button     =  "left" or "right" mouse button
;                $X       =  X coordinate
;                $Y       =  Y coordinate
;                $Clicks     =  Number of clicks to send
; Remarks:      You MUST be in "MouseCoordMode" 0 to use this without bugs.
; Author(s):      Insolence <insolence_9@yahoo.com>
;
;===============================================================================
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 ;==>_MouseClickPlus

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

Attempting to use the code from this topic, http://www.autoitscript.com/forum/index.ph...=7112&hl=diablo

No matter what I test it on it will not work. There's a button on a webpage and I want to click that while it's minimized.

gratitude

OtokIT

Edited by OtokIT

Share this post


Link to post
Share on other sites



I'm not sure but I think the windows message pump will supress mouse messages outside the button on the taskbare (and/or icons in the Tray) to a minimized window?

Share this post


Link to post
Share on other sites

I'm not sure but I think the windows message pump will supress mouse messages outside the button on the taskbare (and/or icons in the Tray) to a minimized window?

If you look at how I have it setup, I don't think that should be an issue.

mPos() sets the information then sClick() uses it.

How would I change it to make it work?

Right now it's just a generic script that can send a mouse click to any target window but it's not working at all!

Share this post


Link to post
Share on other sites

Don't think you can click with autoit riight now. Maybe in the beta.

Share this post


Link to post
Share on other sites

For a web page, why not just use IE.au3?


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

For a web page, why not just use IE.au3?

IE.au3 cannot automate clicks in a flash object, if it can I would enjoy an example. What I must do is click on a flash game different points over time and then navigate to a new you-are-el.

I am hoping that this script can be fixed to work not incorrectly.

appreciation for your reply

Share this post


Link to post
Share on other sites

could you possibly provide the link to the game?

Share this post


Link to post
Share on other sites

could you possibly provide the link to the game?

Yes.

http://www.ebaumsworld.com/helicopter.shtml

I tried using google some more but I have not found a nice solution unless I can send packets or HTTP headers directly and programaticly in an easy way....

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

this might make it easier to make a bot,

http://media.ebaumsworld.com/copter.swf

and i got 1291 :think:

wow wait im still confused at the question , do u want a bot to play the game or just what?

cuz by the way if u were compiling that , thats a UDF not a script

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

this might make it easier to make a bot,

http://media.ebaumsworld.com/copter.swf

and i got 1291 :think:

wow wait im still confused at the question , do u want a bot to play the game or just what?

cuz by the way if u were compiling that , thats a UDF not a script

I'm not boting it, just sending clicks to it. There's a difference. Boting would imply doing something intelligent where I'm just crashing it over, and over.

If you look at my code and can't figure out what it's doing then I'm in shock.

1st you set the window name and the mouse position then you run the other function to "minimize click" at that location.

The UDF I'm trying to use sucks apparently. I'm hoping for a fix.

Share this post


Link to post
Share on other sites

Can anyone else

confirm that the UDF in question is broken OR

provide a working example...?

It seems broken.

Share this post


Link to post
Share on other sites

im busy but ill post something later on , i got homework to finish so yeah, :think: idk why u want to make it crash over and over but yeah ok

Share this post


Link to post
Share on other sites

im busy but ill post something later on , i got homework to finish so yeah, :think: idk why u want to make it crash over and over but yeah ok

Okay thanks.

Just remember the clicks have to be "minimized" ones, check out the thread I linked to in my first post.

:heart:

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  
Followers 0