Jump to content

Has AutoIt changed event polling design?


Recommended Posts

This simple script substitutes IJKL keys for arrow keys.

When you click a [J] key with a [Ctrl] key,

it's same as pressing a [Left Arrow] key.

And the [J][K][L] configuration for arrow keys continue

until the [Ctrl] key is pressed again.

#include <Misc.au3>

HotKeySet( "^i", "PressUpStart" )
HotKeySet( "^j", "PressLeftStart" )
HotKeySet( "^k", "PressDownStart" )
HotKeySet( "^l", "PressRightStart" )

HotKeySet( "^q", "Escape" )


While 1
    Sleep( 50 )
WEnd

Func PressUpStart()
    Send( "{UP}" )
    HotKeySet( "i", "PressUp" )
    HotKeySet( "j", "PressLeft" )
    HotKeySet( "k", "PressDown" )
    HotKeySet( "l", "PressRight" )

    While Not _IsPressed( "11" )  ; CTRL key
        Sleep( 50 )
    WEnd
    HotKeySet( "i" )  ; release HotKey settings
    HotKeySet( "j" )
    HotKeySet( "k" )
    HotKeySet( "l" )
EndFunc

Func PressUp()
    Send( "{UP}" )
EndFunc

Func PressLeftStart()
    Send( "{LEFT}" )
    HotKeySet( "i", "PressUp" )
    HotKeySet( "j", "PressLeft" )
    HotKeySet( "k", "PressDown" )
    HotKeySet( "l", "PressRight" )

    While Not _IsPressed( "11" )
        Sleep( 50 )
    WEnd
    HotKeySet( "i" )
    HotKeySet( "j" )
    HotKeySet( "k" )
    HotKeySet( "l" )
EndFunc

Func PressLeft()
    Send( "{LEFT}" )
EndFunc


Func PressDownStart()
    Send( "{DOWN}" )
    HotKeySet( "i", "PressUp" )
    HotKeySet( "j", "PressLeft" )
    HotKeySet( "k", "PressDown" )
    HotKeySet( "l", "PressRight" )

    While Not _IsPressed( "11" )
        Sleep( 50 )
    WEnd
    HotKeySet( "i" )
    HotKeySet( "j" )
    HotKeySet( "k" )
    HotKeySet( "l" )
EndFunc

Func PressDown()
    Send( "{DOWN}" )
EndFunc

Func PressRightStart()
    Send( "{RIGHT}" )
    HotKeySet( "i", "PressUp" )
    HotKeySet( "j", "PressLeft" )
    HotKeySet( "k", "PressDown" )
    HotKeySet( "l", "PressRight" )

    While Not _IsPressed( "11" )
        Sleep( 50 )
    WEnd
    HotKeySet( "i" )
    HotKeySet( "j" )
    HotKeySet( "k" )
    HotKeySet( "l" )
EndFunc

Func PressRight()
    Send( "{RIGHT}" )
EndFunc

Func Escape( )
    SoundPlay( @WindowsDir & "\media\Windows XP Hardware Remove.wav", 1 )
    Exit
EndFunc

It had worked until v3.2.3.6-beta.

I've included a compiled .exe file with v.3.2.3.6-beta for you.

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