AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SC011::SC011

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
fmate14



Joined: 28 Oct 2007
Posts: 42
Location: Hungary, Érd

PostPosted: Mon Nov 12, 2007 11:11 am    Post subject: SC011::SC011 Reply with quote

I would like remap the keyboard. I use:
Code:
...
SC011::
...

if (...)
{
...
} else {
send {%A_ThisHotkey%}
}
return


But it is not work with Colemak layout. Sad AutoHotKey send the Virtual Key of Qwerty's E (which is on the position SC011)

So SC011 send always "E". Sad

Or I would like use:

Code:
SC011VK**::
send {VK%A_ThisHokeyVK%}
return


Sorry my english


Last edited by fmate14 on Wed Jan 16, 2008 9:35 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon Nov 19, 2007 5:50 pm    Post subject: Reply with quote

This probably won't be added anytime soon, so it's probably best to look for an alternate solution. I believe the Scripts forum has some keyboard hook and WM_INPUT examples that might help.
Back to top
View user's profile Send private message Send e-mail
fmate14



Joined: 28 Oct 2007
Posts: 42
Location: Hungary, Érd

PostPosted: Mon Dec 31, 2007 8:35 am    Post subject: Alternate solution Reply with quote

Chris wrote:
This probably won't be added anytime soon, so it's probably best to look for an alternate solution. I believe the Scripts forum has some keyboard hook and WM_INPUT examples that might help.


Okay, here is an alternate solution.

Code:
#NoEnv
#Persistent
#InstallKeybdHook
#SingleInstance force
return

; for ex. *SC015::
keyPress:
   ThisHotkey := Substr(A_ThisHotkey, 2)
keyPressNoSet:
   if ( 0 ) {
      ; blah…
   } else {
      vk := VK%ThisHotkey%
      Send {%vk%}
   }
return

; Get the virtual key of scan code, because
;   SC015::Send {SC015}
; work only with english QWERTY keyboard layout

*VK30::    ; 0
*VK31::    ; 1
*VK32::    ; 2
*VK33::    ; 3
*VK34::    ; 4
*VK35::    ; 5
*VK36::    ; 6
*VK37::    ; 7
*VK38::    ; 8
*VK39::    ; 9
*VK41::    ; A
*VK42::    ; B
*VK43::    ; C
*VK44::    ; D
*VK45::    ; E
*VK46::    ; F
*VK47::    ; G
*VK48::    ; H
*VK49::    ; I
*VK4A::    ; J
*VK4B::    ; K
*VK4C::    ; L
*VK4D::    ; M
*VK4E::    ; N
*VK4F::    ; O
*VK50::    ; P
*VK51::    ; Q
*VK52::    ; R
*VK53::    ; S
*VK54::    ; T
*VK55::    ; U
*VK56::    ; V
*VK57::    ; W
*VK58::    ; X
*VK59::    ; Y
*VK5A::    ; Z
*VKBA::    ; OEM_1
*VKBF::    ; OEM_2
*VKC0::    ; OEM_3
*VKDB::    ; OEM_4
*VKDC::    ; OEM_5
*VKDD::    ; OEM_6
*VKDE::    ; OEM_7
*VKDF::    ; OEM_8
*VKE2::    ; OEM_102
*VKBC::    ; OEM_COMMA
*VKBD::    ; OEM_MINUS
*VKBE::    ; OEM_PERIOD
*VKBB::    ; OEM_PLUS
   Critical
   ThisHotkey := getScanCodeFromVirtualKey( Substr(A_ThisHotkey, 2) )
   goto keyPressNoSet
return

getScanCodeFromVirtualKey(VK)
{
   static scancodes := "02,03,04,05,06,07,08,09,0a,0b,0c,0d,10,11,12,13,14,15,16,17,18,19,1a,1b,1e,1f,20,21,22,23,24,25,26,27,28,29,2b,2c,2d,2e,2f,30,31,32,33,34,35,39,56,53,"
   curr = ;
   Loop, parse, scancodes, `,
   {
      if ( getKeyState("SC0" . A_LoopField, "P") )
      {
         StringReplace, scancodes, scancodes, %A_LOOPFIELD%`,, , All
         curr := "SC0" . A_LOOPFIELD
         break
      }
   }
   if not curr
      return VK
   Hotkey *%VK%, Off
   setGlobal( "VK" . curr, VK )
   Hotkey *%curr%, keyPress
   return %curr%
}

setGlobal( var, value )
{
   global
   %var% := value
}


This works only, when the default keyboard layout is the active.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group