AutoHotkey Community

It is currently May 27th, 2012, 10:39 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: June 6th, 2010, 3:49 am 
Offline

Joined: June 4th, 2010, 4:21 pm
Posts: 3
Location: Kyiv, Ukraine
The great code by Long Bong didn't work for me, as I need to use 3 layouts. In non-English layout the script simply disabled all hotkeys.
I played with the code trying to change it so, that it would activate only if Dvorak layout in current window is active.
For some strange reason adding several lines of code made the trick
Before:
Code:
~*Ctrl::
~*Alt::
~*LWin::
~*RWin::
Sleep, 1
If GetKeyState("RAlt") ; This prevents from switching if it was AltGr pressed.
   return
MakeQwerty()
WaitRelease()
MakeDefault()
return

After:
Code:
~*Ctrl::
~*Alt::
~*LWin::
~*RWin::
Sleep, 1
If GetKeyState("RAlt") ; This prevents from switching if it was AltGr pressed.
   return
WinGet, WinID,, A
  ThreadID:=DllCall("GetWindowThreadProcessId", UInt, WinID, UInt, 0)
  InputLocaleID:=DllCall("GetKeyboardLayout", UInt, ThreadID, UInt)
  if (InputLocaleID=ceil(4026663945)) MsgBox, 1

MakeQwerty()
WaitRelease()
MakeDefault()
return


It is weird as all the code does is getting the number of active layout :shock:. I even failed to make "If" check if layout is 4026663945 (Dvorak) and display some message. "If" doesn't work as i expect it to.

I would appreciate any feed back from gurus, why it is happens.
(I would like to know it, just in case I discover more bugs and will need to improve the script further)

Thank you in advance, Roman.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 24th, 2011, 4:55 am 
I like the original script very much. Thanks for sharing.

However, I find two issues. One, as someone posted earlier, Alt + Tab keeps the switch window hovering above. Is their a way to retain normal Alt + Tab function? Mapping it to something else is not a good solution, I think. I'm using Windows 7, by the way.

Second, I also use the Hindi language layout and use the default LAlt + Shift to switch to it. This script in it's present state overrides the other language settings. How can this script be changed so that the dvorak key mapping be applied only when the language selected is English.

Thanks.


Report this post
Top
  
Reply with quote  
PostPosted: January 24th, 2011, 1:50 pm 
Offline

Joined: June 4th, 2010, 4:21 pm
Posts: 3
Location: Kyiv, Ukraine
joy wrote:
Second, I also use the Hindi language layout and use the default LAlt + Shift to switch to it. This script in it's present state overrides the other language settings. How can this script be changed so that the dvorak key mapping be applied only when the language selected is English.
Thanks.


I'm also have to deal with several layouts (EN Dvorak-RU-UA, occasionally Qwerty, when I have to input very long password, which I may mistype in Dvorak).

Window's layout cycling is not good. It is time consuming as you shall follow task bar to make sure that you are in a correct layout. Sometimes tray icon lags and do not display actual layout, which is very annoying.

I workarounded the issue by binding each layout to shortcut (Text Services and Input Languages -> Advanced Key Settings): Cntrl+6, Cntrl+7, etc. This way it is much more ergonomic.

The Windows may have trouble binding these shortcuts, so create Restore Point, delete all sub-keys under HKEY_USERS\S-1-5-21-2894075098-358675243-3485955507-1000\Control Panel\Input Method\Hot Keys, reboot and proceed with the binding.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2011, 1:44 am 
Thank you guys so much for this. I've been on dvorak for years, and had basically given up frequent shortcutting because it's been so uncomfortable.
Some of the really important shortcuts, like ctrl z I've committed to muscle memory- I don't actually know where the z key is, I just know that it's down in the bottom right somewhere. Anyway, I'm hugely happy.

Thank you!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2011, 8:49 am 
Offline

Joined: June 4th, 2010, 4:21 pm
Posts: 3
Location: Kyiv, Ukraine
Tynanr wrote:
Some of the really important shortcuts, like ctrl z I've committed to muscle memory- I don't actually know where the z key is, I just know that it's down in the bottom right somewhere. Anyway


They are there because their location is convenient for one-hand operation.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 31st, 2012, 5:19 am 
Offline

Joined: January 31st, 2012, 5:01 am
Posts: 1
romanshein wrote:
It is weird as all the code does is getting the number of active layout :shock:. I even failed to make "If" check if layout is 4026663945 (Dvorak) and display some message. "If" doesn't work as i expect it to.

I would appreciate any feed back from gurus, why it is happens.
(I would like to know it, just in case I discover more bugs and will need to improve the script further)

Thank you in advance, Roman.

Roman, thanks for the modified version of the code!

I'm slightly changed it as it is not working properly in cmd (this is where I totally need "ctrl+c" command, man), but only could do it after disabling "ctrl+i" command :-( Anyway, for now it works just fine, so whatever. Here is the code:

Before:
Code:
SetBatchLines -1
SleepDuration = 1
TimePeriod = 1

~*Ctrl::
~*Alt::
~*LWin::
~*RWin::
Sleep, 1 ;                 This prevents from
If GetKeyState("RAlt") ;   switching if it
   return ;                was AltGr pressed.
   
WinID := WinExist("A") ; changed the method to more suitable according to documentation: http://l.autohotkey.net/docs/commands/WinGet.htm
ThreadID:=DllCall("GetWindowThreadProcessId", UInt, WinID, UInt, 0)
InputLocaleID:=DllCall("GetKeyboardLayout", UInt, ThreadID, UInt)
if (InputLocaleID=ceil(4026663945)) { ; Added brackets and "else" condition, now "if" condition works just fine
   Qwerty = 1
}      
else {   
   Qwerty = 0                     
}      

Loop ;    Waits for keys to be released.
{
   If !(GetKeyState("Ctrl")
   or GetKeyState("Alt")
   or GetKeyState("LWin")
   or GetKeyState("RWin"))
      Break
   Sleep, 10 ;    This makes the script less CPU consuming.
}
Qwerty = 0
return


; ##############################
;         QWERTY MAPPING
; ##############################
#if Qwerty
SC0x2::1
SC0x3::2
SC0x4::3
SC0x5::4
SC0x6::5
SC0x7::6
SC0x8::7
SC0x9::8
SC0xa::9
SC0xb::0
SC0xc::-
SC0xd::=
SC0x10::q
SC0x11::w
SC0x12::e
SC0x13::r
SC0x14::t
SC0x15::y
SC0x16::u
;SC0x17::i ; commented "i" mapping because otherwise "ctrl+c" is not working in cmd, for example
SC0x18::o
SC0x19::p
SC0x1a::[
SC0x1b::]
SC0x1e::a
SC0x1f::s
SC0x20::d
SC0x21::f
SC0x22::g
SC0x23::h
SC0x24::j
SC0x25::k
SC0x26::l
SC0x27::`;
SC0x28::'
SC0x29::vkC0 ;    ( ` ) key
SC0x2b::\
SC0x2c::z
SC0x2d::x
SC0x2e::c
SC0x2f::v
SC0x30::b
SC0x31::n
SC0x32::m
SC0x33::,
SC0x34::.
SC0x35::/
SC0x56::vkE2 ;    the additional key, backslash ( \ ) on standard qwerty
#if


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 36 posts ]  Go to page Previous  1, 2, 3

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group