AutoHotkey Community

It is currently May 27th, 2012, 11:59 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Remapping keys bug?
PostPosted: November 20th, 2005, 8:44 pm 
I think I may have a bug to report. I want the windows key and r to open a cmd window, but I also want to remap the keyboard to dvorak (on a school computer). But the window opens twice instead of once!

;Works ok
#o::Run, cmd

;doesn't work together, it opens 2 windows
o::r ;map o to r for dvorak
#o::Run, cmd ;make the o key open a cmd prompt (maybe it should be r since we changed it)


Report this post
Top
  
Reply with quote  
 Post subject: Quick Fix
PostPosted: November 20th, 2005, 8:56 pm 
I got it to work by making a separate script for the dvorak and one for the hotkeys. This also made the mappings correct (Win + R is the r key on the dvorak layout).

;dvorak.ahk
o::r

;winshortcuts.ahk
#r::Run, cmd ;the r key on the dvorak keyboard


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2005, 9:58 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Since Win+R is an Explorer hotkey, the hook is required to override it. Consequently, the following info from the remapping page applies:
Quote:
Although a remapped key can trigger normal hotkeys, it cannot trigger mouse hotkeys or hook hotkeys. For example, if the remapping a::b is in effect, pressing Ctrl-Alt-A would trigger the ^!b hotkey if it is not a hook hotkey. If it is a hook hotkey, you can define ^!a as a hotkey if you want Ctrl-Alt-A to perform the same action as Ctrl-Alt-B. For example:

a::b
^!a::
^!b::
ToolTip You pressed %A_ThisHotkey%.
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Still get two windows
PostPosted: November 21st, 2005, 1:40 am 
I still get 2 windows coming up.


#usehook ;doesn't seem to affect what we are doing here

a::b
^!a::run, cmd
^!b::run, explore

;2 cmd windows pop up when we press ^!a


Note: the explorer hotkeys are disabled on this computer anyways.
Is there something I'm missing?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2005, 3:37 am 
If you get a full dvorak remap script going please post - I would do it myself but I'm just off to bed now, and it would be useful for tomorrow.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2005, 11:14 am 
Offline

Joined: November 12th, 2005, 10:25 pm
Posts: 73
With a basic test, I noticed your error happens because script calls the ^!a when you press the a button, AND when you release it...
To override this just use keywait:

Code:
#usehook on

a::b

^!a::
run, cmd
keywait a
return

^!b::run, explore



and this one should work too, when you release the A:
Code:
#usehook on

a::b
^!a up::run, cmd
^!b::run, explore


Don't know why, but this last will start cmd everytime you press the a button...
Chris?!?! :S

Chris, it seams that your script virtually press ^! when another hotkey is finishing running.
look at this example:
Code:
#usehook on

r::z
^!r Up::MsgBox You pressed and released Ctrl+Alt+R.


Even if you get the hook off, the ^!r will be called when you press r, and a z will be written too.
Strange error :S


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2005, 11:30 am 
Offline

Joined: November 12th, 2005, 10:25 pm
Posts: 73
I think I know why the error happens.

With this:
Code:
#usehook off

r::z
^!r up::MsgBox You pressed and released Ctrl+Alt+R.

The "hotkeys and their methods" window shows:
Code:
Type   Off?   Running   Name
-------------------------------------------------------------------
k-hook         *r
k-hook         *r up
k-hook         ^!r up


It may be giving the *r up to ^!r too, because when we use:
Code:
#usehook off

r::z
^!r::MsgBox You pressed and released Ctrl+Alt+R.


It works ok...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2005, 5:12 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks for posting your findings. I think this double-launch issue has been fixed in today's v1.0.40.09.

Please let me know if you have any more problems with it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks!
PostPosted: November 22nd, 2005, 9:53 pm 
Thanks, the new patch fixed the problem!

Full Dvorak script (real easy with the new :: operator):

-::[
=::]

q::'
w::,
e::.
r::p
t::y
y::f
u::g
i::c
o::r
p::l
[::/
]::=

;a::a
s::o
d::e
f::u
g::i
h::d
j::h
k::t
l::n
#CommentFlag // ; Change to C++ style of comments.
#EscapeChar \ ;
;::s
#CommentFlag ;
'::-

z::;
x::q
c::j
v::k
b::x
n::b
;m::m
,::w
.::v
/::z


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 27 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