Jump to content

HotKeySet and Send conflict


Recommended Posts

Once i start Attack() i cant stop it. Everytime i press + again it just sends the key like normal, the program is not catching it as a hotkey and im pretty sure its because shift is still down. Ive tried moving when Shift is pushed and where it is let up and moving the sleep around but everytime i try it shift always seems to be stuck down so i cant call the function again to stop it

Any ideas?

HotKeySet("{NUMPADADD}", "Attack")
Global $Attack

While 1
    Sleep(10000)
WEnd

Func Attack()
    $Attack = NOT $Attack
    ToolTip('Attacking...',0,0)
    While $Attack
        Send("{LSHIFT DOWN}")
        MouseClick("Left")
        Send("{LSHIFT UP}")
        Sleep(500)
    WEnd
    ToolTip("")
EndFunc
Link to comment
Share on other sites

Sounds like a headache you could always do the lazy and run 2 instance of your program before exit like

HotKeySet("{NUMPADADD}", "Attack")

HotKeySet("{esc}","halt")

Global $Attack

While 1

Sleep(10000)

WEnd

Func Attack()

$Attack = NOT $Attack

ToolTip('Attacking...',0,0)

While $Attack

Send("{LSHIFT DOWN}")

MouseClick("Left")

Send("{LSHIFT UP}")

Sleep(500)

WEnd

ToolTip("")

EndFunc

Func halt()

Run("yourprogram.exe")

Exit

EndFunc

[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

the halt() function doesnt work because shift is being pushed down also so when you hit esc it doesnt see it as a hotkey and it doesnt exit

ive tried this but it never seems like LSHIFT Up is ever done any other ideas?

ive also tried using different keys for hotkey but cant get any to work

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Do
        Sleep(100)
    Until _IsPressed("63", $dll)
    Sleep(250)
    Do
        Send("{LSHIFT DOWN}")
        MouseClick("Left")
        Send("{LSHIFT UP}")
        Sleep(500)
    Until _IsPressed("63", $dll)
   Sleep(250)
WEnd
Edited by narayanjr
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...