Jump to content

Key Toggle to send the same Key


Recommended Posts

:~ Purely an Example

#Include <Misc.au3>

While 1

   While _IsPressed(09) ;~ 09 = TAB
      Send("{TAB}")
      sleep(2500)
   WEnd

   sleep(100)
WEnd

How can I make an Toggle with an key that will be also send, without reactivate itself.

So while I'm pressing TAB it will send TAB repeatedly, but it would stop after I unpressed TAB.

I have tried '_WinAPI_GetAsyncKeyState()' but it still reactivates itself, and thus a infinite loop.

I hope there are other options that won't interfere, so this works.

Thanks in advance.

Link to comment
Share on other sites

2 Examples that work to toggle on and off 2 different function calls

;HotKeySet("Key to press", Function to call)
Global $PressTab
Global $Paused
HotKeySet("{F1}","PressTab")
HotKeySet("{PAUSE}","TogglePause")

While 1
    Sleep(100)
WEnd

Func PressTab()
$PressTab = NOT $PressTab
While $PressTab
     Send("{TAB}")
     Sleep(50)
WEnd
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',350,0)
    WEnd
    ToolTip("")
EndFunc

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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