MichaelDavid Posted April 1, 2009 Posted April 1, 2009 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.
WideBoyDixon Posted April 1, 2009 Posted April 1, 2009 You can remap all keys to the same function and check the value of @HotKeyPressed in your function. [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center]
MichaelDavid Posted April 1, 2009 Author Posted April 1, 2009 Perfect, thank you.Michael.You can remap all keys to the same function and check the value of @HotKeyPressed in your function.
Richard Robertson Posted April 1, 2009 Posted April 1, 2009 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.
martin Posted April 1, 2009 Posted April 1, 2009 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now