Sign in to follow this  
Followers 0
shiby1510

Using _IsPressed

2 posts in this topic

I can't figure out how to correctly write my script below. Once a hotkey that is set is pressed I want the function to send shift+P. If I click, I want it to then send shift+P. If I click again, I want it to send shift+I. If I press anything besides a mouseclick I want it to stop the function until the next time I press the hotkey. Here is what I have so far. Many Thanks!

Func Yada()
    Send("^P")
        If _IsPressed('01') Then
            Sleep(50)
            Send ("^O")
        EndIf
        If _IsPressed('01') Then
            Sleep(50)
            Send("^I")
        EndIf
    EndFunc
    
Func _IsPressed($HexKey)
   Local $AR, $bO
   $HexKey = '0x' & $HexKey
   $AR = DllCall("user32", "int", "GetAsyncKeyState", "int", $HexKey)
   If NOT @Error And BitAND($AR[0],0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc

Share this post


Link to post
Share on other sites



it looks like no loop for program stay alive :blink:

I am sleeping, maybe i read the post badly ;[


This world is crazy

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