Jump to content

Recommended Posts

Posted (edited)

;===============================================================================
  ;
  ; 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
 
 
 
 
 Func _MakeLong($LoWord,$HiWord)
    Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
 EndFunc

I think Larry made the _MakeLong function, so credit goes to him on that. I got a lot of help on the entire thing, I just threw it into a function.

I'll have to figure out how to get the actual area size of the window excluding the title bar for some games, atleast in Diablo II.

EDIT: To get D2 offsets use this code:

$winsize = WinGetPos("Diablo II")
 $borderwidth = ($winsize[2] - 800) / 2
 $titleheight = $winsize[3] - 600 - (2 * $borderwidth)
 
 msgbox("", "", $borderwidth & " " & $titleheight)

And use it like so:

_MouseClickPlus( "Diablo II", "left", 525 - $borderwidth, 585 - $TitleHeight )
Edited by Jon
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted

Pointless by NO means!

I do this to help people, my personal benefit is minimal seeing as how I don't play the game.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted

I posted an example at the bottom of my script, just include that function inside your script and call it.

All you gotta do :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted (edited)

very nice @insolence :D very nice !!!!!!!!! can u also use pixelgetcolor in a minimized window ?

:idiot:

<{POST_SNAPBACK}>

Nope, sadly you cannot.

[EDIT]

Delete what???

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted

A file, i dont have diablo installed on this cp or i would test on it, all i have is a file saved in a folder, and the folder iz minimized, trying to delete it from there

Ive also tried MSWord i couldnt get it to click on the close button

Posted (edited)

wtf ? it wont click in the d2 window at alll dunno why ...

do i have to use borderwidht and title height ?

Edit: Insolence reply plz :idiot: it wont click man .. or if it clicks it clicks like 5 extra pixels in X axis and about 30 extra pixels in Y axis

Edited by pcdestroyer
Posted

You have to use the offsets thing I supplied at the bottom.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted (edited)

hmm .. i use the offset but it makes it even worse .....

it just doesnt work for me :idiot:

Edit: nevermind i got it !!!!!!!!! now it is 100% accurate with my editing in the script :D

give me some tiem ... ill post an explanation

Edited by pcdestroyer
Posted

Alright :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted

Yeah I knew that was the problem -.- I mentioned it in the first post.

$winsize = WinGetPos("Diablo II")
$borderwidth = ($winsize[2] - 800) / 2
$titleheight = $winsize[3] - 600 - (2 * $borderwidth)

msgbox("", "", $borderwidth & " " & $titleheight)

But you need to automize that, does the above code not find those values?

If not maybe this will work:

$winsize = WinGetPos("Diablo II")
$borderwidth = $winsize[2] - 800
$titleheight = $winsize[3] - 600

msgbox("", "", $borderwidth & " " & $titleheight)
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Posted (edited)

hmm... it seems that , when i use $borderwidth and $titleheight it clicks on a completely different place BUT if i use their real values which are "3" and "26" it works .... :idiot: if i use them as a variable it wont work ... is this a bug or something ?!

Edited by pcdestroyer
Posted

No it's gotta be something in your script, why don't you post it in support.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...