Sign in to follow this  
Followers 0
BANDWIDTH

Need some help

8 posts in this topic

#1 ·  Posted (edited)

Well here's my script till now.

Opt("WinTitleMatchMode", 4)
Opt("MouseCoordMode", 2)
Opt("SendKeyDelay", 35)

$D2_PATH = "C:\Program Files\Diablo II"
$D2_EXE = "Diablo II.exe"
$D2_WIN = "Diablo II"
$D2_CMD = '-window -lowquality -nosound -res800 -title "Diablo II"'

Run($D2_PATH & "\" & $D2_EXE & " " & $D2_CMD)
If ProcessExists($D2_EXE) Then
    WinActivate($D2_WIN)
    WinWaitActive($D2_WIN)
    If Not @error Then
        ControlMove($D2_WIN, "", "", 0, 0)
        WinWaitActive($D2_WIN)
        WinSetState($D2_WIN, "", @SW_MINIMIZE)
    Else
        MsgBox(0+16, "ERROR", "Could not find correct window")
        Exit
    EndIf
EndIf

$handle = WinGetHandle("classname=" & $D2_WIN, "")
ControlSend($handle, "", "", "{ENTER}") ;To activate the start :)
If Not @error Then
    _MouseClickPlus($D2_WIN, "left", 405, 380, 1)
Else
    MsgBox(0+16, "ERROR", "We got an error, Please reboot or contact the maker at ~MyEmail~")
    Exit
EndIf

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

He's moving to the right position (minimized) but he just doesnt click ;)

Edited by BANDWIDTH

Share this post


Link to post
Share on other sites



Well here's my script till now.

He's moving to the right position (minimized) but he just doesnt click ;)

Are we supposed to just guess what is is SUPPOSED to do?

Share this post


Link to post
Share on other sites

I thought you guys could easy figure that out.

Anyways im tryin to Move the mouse, and Click in a minimized window. ;)

Share this post


Link to post
Share on other sites

I thought you guys could easy figure that out.

Anyways im tryin to Move the mouse, and Click in a minimized window. ;)

Unfortunately, you are use SendMessage to initiate a window action, this isn't always going to work. _MouseClickPlus() is notorious for giving people headaches.

I did notice though, you weren't using Opt('MouseCoordMode', 2) with your other Opts, try that and see if it rectifies your situation.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

@Smoke, I am using Opt("MouseCoordMode", 2) i guess you didnt see it.

Anyways, If im right it does move to the right location but it just doesnt click. ;)

*Waiting for solutions*

Share this post


Link to post
Share on other sites

@Smoke, I am using Opt("MouseCoordMode", 2) i guess you didnt see it.

Anyways, If im right it does move to the right location but it just doesnt click. ;)

*Waiting for solutions*

*solution*

Don't play the game minimized. I've already told you the issue... nothing more to say about it.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

*solution*

Don't play the game minimized. I've already told you the issue... nothing more to say about it.

;) again someone cant take it that i pointed him on his 'overseen' faults.

Share this post


Link to post
Share on other sites

;) again someone cant take it that i pointed him on his 'overseen' faults.

? overseen ? I wasn't speaking of the "Opt", I was speaking of the issue with SendMessage. I hadn't even checked if you were actually using it again after you said you were, I just took your word at it. Looks like someone else over looked something :evil: ... (and if you can find a fault, by all means ... exploit it ... then call the ACAD Officer to come see the post, he'll get a kick out of it. :lmao: )

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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