 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
arkenflame
Joined: 12 Jan 2008 Posts: 3
|
Posted: Sat Jan 12, 2008 9:24 pm Post subject: Mac Style Dvorak QWERTY Command Layout Switcher for Windows |
|
|
On Macs, there is a way to have the keyboard layout Dvorak when you type, but when you use a hotkey (by holding alt, ctrl, etc) it switches back to QWERTY so you don't have to remap all the shortcuts or have them in inconvenient places.
This script does just that. You can also toggle back to QWERTY by pressing the right windows key. I find this helpful for playing games etc.
Here is the script:
| Code: |
SendMode Input
#NoEnv
Menu, Tray, Icon, main.cpl, 8
;----------- REMAP TO DVORAK
-::[
=::]
q::'
w::,
e::.
r::p
t::y
y::f
u::g
i::c
o::r
p::l
[::/
]::=
;\::\ ;no change
;a::a ;no change
s::o
d::e
f::u
g::i
h::d
j::h
k::t
l::n
SC027::s
SC028::-
z::SC027
x::q
c::j
v::k
b::x
n::b
m::m
,::w
.::v
/::z
;----------- RELEASE KEYS FROM REMAP WHEN MODIFIER DOWN
*Ctrl::
SetKeyDelay -1
Send {Blind}{Ctrl DownTemp}
Suspend On
return
*Ctrl up::
Suspend Off
SetKeyDelay -1
Send {Blind}{Ctrl Up}
return
*Alt::
SetKeyDelay -1
Send {Blind}{Alt DownTemp}
Suspend On
return
*Alt up::
Suspend Off
SetKeyDelay -1
Send {Blind}{Alt Up}
return
*LWin::
SetKeyDelay -1
Send {Blind}{LWin DownTemp}
Suspend On
return
*LWin up::
Suspend Off
SetKeyDelay -1
Send {Blind}{LWin Up}
return
;----------- TOGGLE DVORAK-QWERTY WITH RIGHT WINDOWS KEY
*RWin::
Suspend, Permit
Suspend, toggle
Hotkey, *Ctrl, toggle
Hotkey, *Ctrl up, toggle
Hotkey, *Alt, toggle
Hotkey, *Alt up, toggle
Hotkey, *LWin, toggle
Hotkey, *LWin up, toggle
return
|
I also keep a (compiled) version of this on my flash drive that has a small gui allowing others to "fix" their keyboards by closing the window, in case I want to type on their computers and forget to switch it back myself.
Here is that version:
| Code: |
SendMode Input
#NoEnv
;----------- CREATE INFORMATION WINDOW
Menu, Tray, Icon, main.cpl, 8
Gui, Add, GroupBox, x2 y2 w326 h130 , Information
Gui, Add, Text, x10 y20 w300, Your keyboard layout has been temporarily changed. Close this window to restore your prior layout.
Gui, Add, Text, x10 y60 w300, If your keys aren't working right, or you are confused, press toggle or close this window.
Gui, Add, Text, x10 y100 w300, Current Layout: Dvorak
Gui, Add, Button, x20 y138 w90 h30 , Toggle
Gui, Add, Button, x120 y138 w90 h30 , Minimize
Gui, Add, Button, x220 y138 w90 h30 , Close
Gui, Show, x552 y209 h175 w330, Dvorak Keyboard Layout Changer
Return
ButtonToggle:
Toggle()
Return
ButtonMinimize:
Gui, Show, Minimize
Return
GuiClose:
ButtonClose:
ExitApp
;----------- REMAP TO DVORAK
-::[
=::]
q::'
w::,
e::.
r::p
t::y
y::f
u::g
i::c
o::r
p::l
[::/
]::=
;\::\ ; no change
;a::a ; no change
s::o
d::e
f::u
g::i
h::d
j::h
k::t
l::n
SC027::s
SC028::-
z::SC027
x::q
c::j
v::k
b::x
n::b
;m::m ; no change
,::w
.::v
/::z
;----------- RELEASE KEYS FROM REMAP WHEN MODIFIER DOWN
*Ctrl::
SetKeyDelay -1
Send {Blind}{Ctrl DownTemp}
Suspend On
return
*Ctrl up::
Suspend Off
SetKeyDelay -1
Send {Blind}{Ctrl Up}
return
*Alt::
SetKeyDelay -1
Send {Blind}{Alt DownTemp}
Suspend On
return
*Alt up::
Suspend Off
SetKeyDelay -1
Send {Blind}{Alt Up}
return
*LWin::
SetKeyDelay -1
Send {Blind}{LWin DownTemp}
Suspend On
return
*LWin up::
Suspend Off
SetKeyDelay -1
Send {Blind}{LWin Up}
return
;----------- TOGGLE DVORAK-QWERTY WITH RIGHT WINDOWS KEY
*RWin::
Suspend, Permit
Toggle()
return
Toggle() {
Suspend, toggle
Hotkey, *Ctrl, toggle
Hotkey, *Ctrl up, toggle
Hotkey, *Alt, toggle
Hotkey, *Alt up, toggle
Hotkey, *LWin, toggle
Hotkey, *LWin up, toggle
if (A_IsSuspended = 1) {
GuiControl, Text, Static3, Current Layout: QWERTY (normal)
} else {
GuiControl, Text, Static3, Current Layout: Dvorak
}
return
}
|
I hope someone finds this as useful as I do. Enjoy! |
|
| Back to top |
|
 |
Jero3n
Joined: 19 Jan 2007 Posts: 149
|
Posted: Sat Jan 12, 2008 9:30 pm Post subject: |
|
|
Can ahk run on a mac?
Didn't knew that. |
|
| Back to top |
|
 |
arkenflame
Joined: 12 Jan 2008 Posts: 3
|
Posted: Sun Jan 13, 2008 11:20 pm Post subject: |
|
|
| No no no. This is just a script that allows you to do something on Windows you can normally only do on a Mac. |
|
| Back to top |
|
 |
Ian
Joined: 15 Jul 2007 Posts: 1077 Location: Enterprise, Alabama
|
Posted: Sun Jan 13, 2008 11:24 pm Post subject: |
|
|
Alls it does is remap the keys. It does nothing to altar the windows processes. _________________ 1,000 Posts achieved on Saturday April 26, 2008 1:45 am |
|
| Back to top |
|
 |
keybored
Joined: 18 Jun 2006 Posts: 67 Location: Phoenix, AZ
|
Posted: Thu Jan 17, 2008 11:39 pm Post subject: Thank You!! |
|
|
| arkenflame, Thank You so much! I couldn't figure out how to do this. I will be practicing Dvorak again. |
|
| Back to top |
|
 |
hatsat Guest
|
Posted: Fri Jan 25, 2008 7:29 am Post subject: sorry but how to make use of the above script |
|
|
i've never played with the scripts before could you please post a link or explain in brief how to use the above script ... i saved it in notepad but don't know what to do next?
Anyways, thanks a million arkenflame !! i've been searching for an easy way to switch between qwerty and dvorak ... there is a constant fight between me (dvorak) and my qwerty loving siblings over the keyboard layout... i have to do atleast 2-3 times/day... control panel ...regional and language options ..languages ...details .. add ...dvorak ...and back again. thanks again
Btw is there a way to change the keyboard layout from qwerty to dvorak and vice versa with a simple command from cmd.exe in windows ...like qw=qwerty and dv=dvorak |
|
| Back to top |
|
 |
arkenflame
Joined: 12 Jan 2008 Posts: 3
|
Posted: Thu Jan 31, 2008 4:40 am Post subject: |
|
|
hatsat, it's pretty easy.
Install AutoHotKey, right click on your dektop (or wherever) and select New > AutoHotKey Script, and name it what you want. Open it with notepad and paste in the code above. Then save it and double click on the file on your desktop. You can also right click on it and choose "Compile Script" if you want to run the (newly created) file without installing AutoHotKey elsewhere.
And just as a side note, my antivirus software (avast!) registers ahk-compiled programs as trojans, so you may need to add the program to an exception list. |
|
| Back to top |
|
 |
KayDat
Joined: 19 Feb 2008 Posts: 1 Location: Melbourne, Victoria, Australia
|
Posted: Tue Feb 19, 2008 12:09 pm Post subject: |
|
|
What an excelent idea. I was just starting to do the same thing, but it looks like you beat me to it  |
|
| Back to top |
|
 |
Patulo Guest
|
Posted: Sat Apr 19, 2008 5:30 am Post subject: |
|
|
| Such a useful piece of code! I was using a Dvorak configuration before (with Windows Control Panel Regional Settings), but I had to memorize the new hotkeys and it wasn't easily customizable. Then I found this script and was pretty happy with it except for one problem: I can't use it with Jim Biancolo's AutoCorrect.ahk ( http://www.autohotkey.com/download/AutoCorrect.ahk ). That script won't work properly when I use it simultaneously with this code. Anybody have a solution? |
|
| Back to top |
|
 |
Claes Guest
|
Posted: Thu May 08, 2008 12:10 pm Post subject: Running in to a circle reference problem |
|
|
I run in to a strange problem...
I tried the script and when I press "f" and get "g" when I expect "u". The circle reference is f::u u::g. What can I do to fix this? |
|
| Back to top |
|
 |
Jag02
Joined: 16 Apr 2008 Posts: 28
|
Posted: Sun May 11, 2008 8:53 pm Post subject: |
|
|
| Can this script be shortened? |
|
| Back to top |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 64 Location: KC, MO
|
Posted: Mon May 12, 2008 8:32 pm Post subject: |
|
|
You don't have to Add the keyboard layout every time, just switch it. In fact, I have a couple hotkeys to switch it between English and dvorak. Just go to "Text services and input languages" (See *), "[Button:]Key Settings..." and set up some hotkeys to switch between the two layouts. (All within windows, btw) I have Windows use !+1 for regular layout, and !+2 for the dvorak, so if you have issues with other people using it, hit the hotkey to change it to dvorak, and when you're done, hit the hotkey to change it back.
*That's under "Control Panel>Reigonal and Language options>[Tab:]Languages>[Button:]Details". If you didn't have the new layout installed already, continue: "[Button:]Add...>[CheckBox:]Keyboard Layout". Then select the layout you want.
 _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|