Jump to content

SetHotKey without function call


Recommended Posts

Hi folks,

I am new to autoit and would like to remap a large number of keys, e.g. a->b, b->c, c->d etc. I can do this with the SetHotKey function, but then I need to define a separate function for all the keys that I want to rename.

Is there no better way? E.g. specifying the target key directly instead of a function, as in SetHotKey("a", "b"). Ideally I would like to do something like (pseudo-code):

hashmap remap

foreach key in remap do

SetHotKey(key, remap[key])

Can such a thing be done? Alternatively, I would have to generate my autoit script using an external programming language, and I would rather avoid this.

Any help is greatly appreciated.

Michael.

Link to comment
Share on other sites

You can remap all keys to the same function and check the value of @HotKeyPressed in your function.

Link to comment
Share on other sites

The problem with remapping keys is that you are going to run into the problem of trying to send a hotkeyed key. If you have "a" hotkeyed, and you have "b" send "a", it will just end up calling your hotkey again.

If you do want to use Send within your HotKey function that might not be a problem. Maybe something like this would work. (Haven't tried.)

Global $HotDog = false
   
   Func AllHotKeys()
     if $Hotdog then
      HotKeySet(@HotKeyPressed,"")
      Send(@HotKeyPressed)
      HotKeySet(@HotKeyPressed,"AllHotKeys")
      return
     endif
    
   $HotDog = true
   
   ; other stuff which might include Send
   
    $HotDog = false
   EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...