kneegrow Posted April 27, 2010 Posted April 27, 2010 I'm trying to create a script similar to this one (see code) expandcollapse popupAutoIt Version: 3.2.12.1 Author: Albert Script Function: Turns your QWERTY keyboard into a Dvorak Keyboard. Template AutoIt script. #ce ---------------------------------------------------------------------------- HotKeySet("SCROLLLOCK","Toggle") Global $VK_SCROLL = 0x91 Global $ON = False While 1 If $ON = True Then If a then send ("a") If b then send ("x") If c then send ("j") If d then send ("e") If e then send ("r") If f then send ("u") If g then send ("i") If h then send ("d") If i then send ("c") If j then send ("h") If k then send ("t") If l then send ("n") If m then send ("m") If n then send ("b") If o then send ("r") If p then send ("l") If q then send ("h") If r then send ("p") If s then send ("o") If t then send ("y") If u then send ("g") If v then send ("k") If w then send ("f") If x then send ("q") If y then send ("f") If z then send ("d") WEnd Func Toggle() If _Key_Is_ON($VK_SCROLL) Then send ("{SCROLLLOCK Toggle}") But as you can see, it's for autoit 3.2 and i'm using 3.3.. What i am trying to create is a script that when i press ''q'' it sends out ''r'', so on and so forth. If anyone understand's me can can help me, it will be much appreciated.
evilertoaster Posted April 27, 2010 Posted April 27, 2010 The closest thing I can think of that follows your methodology would be something like this:expandcollapse popupHotKeySet("{SCROLLLOCK}","Toggle") Global $ON = False While 1 Sleep(100) WEnd Func Toggle() $on=not($on) if $on Then HotKeySet("b","x") HotKeySet("c","j") HotKeySet("d","e") HotKeySet("e","r") ; ect... ;... Else HotKeySet("b") HotKeySet("c") HotKeySet("d") HotKeySet("e") ; ect... ;... EndIf EndFunc func x() send("x") EndFunc func j() send("j") EndFunc func e() send("e") EndFunc func r() send("r") EndFunc ;ect... ;...But I'd recommend finding a more elegant method... maybe like this: http://www.microsoft.com/enable/training/windowsvista/dvorak.aspx
Fulano Posted April 28, 2010 Posted April 28, 2010 Careful, as you have it, it'll end up in a (potentially) endless loop.User hits 'd' => triggers function 'e' => sends 'e' => triggers function 'r' ...Something like this would be marginally cleaner:HotKeySet("{SCROLLLOCK}","Toggle") Global $ON = False Global $KEYS_QUERTY [26] = ['a', 'b', 'c', 'd', 'e' ...] Global $KEYS_DVORAK [26] = ['a', 'x', 'j', 'e', 'r' ...] While 1 Sleep(100) WEnd Func Toggle() $ON=not($ON) if $ON Then For $index = 0 to 26 HotKeySet($KEYS_QUERTY[$index], 'SendDvorak') Next Else For $index = 0 to 26 HotKeySet($KEYS_QUERTY[$index]) Next EndIf EndFunc Func SendDvorak() Local $dvorak = $KEYS_DVORAK[Asc (@HotKeyPressed) - Asc ('a')] HotKeySet ($dvorak) Send ($dvorak) HotKeySet ($dvorak, 'SendDvorak') EndFuncDisclaimer: this is an example, the array that maps the keys is not complete, this will not compile. #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!
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