Jump to content
Sign in to follow this  
narayanjr

HotKeySet and Send conflict

Recommended Posts

narayanjr

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

Share this post


Link to post
Share on other sites
lordicast

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]

Share this post


Link to post
Share on other sites
narayanjr

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.