Jump to content

Recommended Posts

Posted

Does anyone know of a way to set a hotkey for multiple keys (or maybe even all keys) rather than writing a separate hotkeyset for every key?

Thanks in advance.

Posted

Hi!

Try this example:

; #### by JScript - 09/09/2012 ####

_HotKeySetEx("{ESC}", "_Exit")

_HotKeySetEx("{F1}|{F2}|{F3}|{F4}", "_Example")

While 1
    Sleep(100)
WEnd

Func _Example()
    MsgBox(4096, "Example", "Multiple hotkeys set")
EndFunc

Func _HotKeySetEx($sKeys, $sFunction)
    Local $asSplit

    $asSplit = StringSplit($sKeys, "|")
    If @error Then
        Return HotKeySet($sKeys, $sFunction)
    EndIf

    For $i = 1 To $asSplit[0]
        HotKeySet($asSplit[$i], $sFunction)
    Next
    Return 1
EndFunc

Func _Exit()
    Exit
EndFunc

Regards,

João Carlos.

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Posted (edited)

Thanks, it's been a while since I worked with AutoIT and that prompted me to think in this direction...

Edit: Should point out, that's not nearly as nefarious as it looks lol :)

Edited by Jon
Example removed.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...