Jump to content

Using _IsPressed


Recommended Posts

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
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...