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 

Remapping a few keys
Goto page 1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Mon Sep 12, 2005 1:15 am    Post subject: Remapping a few keys Reply with quote

I'm an artist looking to remap the controls of my 3D package to something a little more tablet-friendly. Ideally the remap will be limited to function only within the process 3dsmax.exe. These are the following controls I'm trying to remap.

alt-lmb to function as alt-mmb
alt-ctrl-lmb to function as alt-ctrl-mmb
alt-shift-lmb to function as mmb

Will someone help me write a script for this? I'm still going through the documentation but I haven't coded anything in years and any help be appreciated.
Back to top
View user's profile Send private message
garath



Joined: 24 Mar 2005
Posts: 398
Location: germany

PostPosted: Mon Sep 12, 2005 7:00 am    Post subject: Reply with quote

Why don't read the helpfile and try it yourself,, first?
Read about HotStrings, test the examples, adjust them, and if it still doesn't work, call back.
RTM Hotstrings
Back to top
View user's profile Send private message
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Mon Sep 12, 2005 7:21 am    Post subject: Reply with quote

I'm trying to remap keyboard-mouse combinations. How will replacing strings help?
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Mon Sep 12, 2005 7:46 am    Post subject: Reply with quote

I think garath meant HotKeys.

Try this:
Code:
;alt-lmb to function as alt-mmb
!LButton:: Send, !{MButton}
;alt-ctrl-lmb to function as alt-ctrl-mmb
!^LButton:: Send, !^{MButton}
;alt-shift-lmb to function as mmb
!+LButton:: Send, {MButton}
This is the most simple solution. From here on you can extent it yourself.
- limit it to work only in one application
- send to a special window even if your mouse is somewhere else
- etc.
Happy scripting
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
garath



Joined: 24 Mar 2005
Posts: 398
Location: germany

PostPosted: Mon Sep 12, 2005 8:24 am    Post subject: Reply with quote

Hihi, didn't recognice lmb as LeftMouseButton, saw only the string.
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Mon Sep 12, 2005 10:37 am    Post subject: Reply with quote

:)
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Mon Sep 12, 2005 2:50 pm    Post subject: Reply with quote

Thanks Toralf, close, but not exactly what I'm looking for. I need the keys to function continuously as the lmb is held down and to stop when it is released. I've found this to work perfectly except that it dosn't stop even when I release the button.

Code:
;alt-lmb to function as alt-mmb
!LButton:: Send, !{MButton down}

;alt-ctrl-lmb to function as alt-ctrl-mmb
!^LButton:: Send, !^{MButton down}

;alt-shift-lmb to function as mmb
!+LButton:: Send, {MButton down}
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Mon Sep 12, 2005 3:03 pm    Post subject: Reply with quote

try this
Code:
!LButton:: Send, !{MButton down}
!LButton Up:: Send, !{MButton Up}

_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Mon Sep 12, 2005 3:07 pm    Post subject: Reply with quote

Fixed, but now I broke alt-shift-lmb somehow. Sad

Code:
;alt-lmb to function as alt-mmb
!LButton::
Send !{MButton down}
KeyWait LButton
Send {MButton up}
return

;alt-ctrl-lmb to function as alt-ctrl-mmb
!^LButton::
Send !^{MButton down}
KeyWait LButton
Send {MButton up}

;alt-shift-lmb to function as mmb
!+LButton::
Send {MButton down}
KeyWait LButton
Send {MButton up}
Back to top
View user's profile Send private message
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Mon Sep 12, 2005 3:15 pm    Post subject: Reply with quote

Your code is cleaner, Toralf, but alt-shift-lmb -> mmb still isn't working.

Edit:
Actually it IS working but 3dsmax seems to be recognizing it as alt-shift-mmb instead of mmb.

Is there a way to prioritize my new hotkey?
Back to top
View user's profile Send private message
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Mon Sep 12, 2005 4:52 pm    Post subject: Reply with quote

alt-shift-lmb -> mmb works in Firefox but it's broken in both 3dsmax as well as Wings3d, which has no command bound to alt-shift-lmb. I don't see any reason why it shouldn't work but it's not functioning in either application. Sad
Back to top
View user's profile Send private message
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Tue Sep 13, 2005 7:10 am    Post subject: Reply with quote

Code:
+LButton:: Send, {MButton down}
+LButton up:: Send, {MButton up}


Action:
With the above script I hold down shift and the lmb and move the mouse around.

Problem:
The application believes that I'm moving my mouse with the mmb depressed as well as holding down shift, shift-mmb, instead of just mmb.

I've been pecking at this for hours but haven't come up with a solution. +LButton should become MButton -- not +MButton.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Tue Sep 13, 2005 2:42 pm    Post subject: Reply with quote

Kahz wrote:
The application believes that I'm...holding down shift
Remapping mouse buttons to keys is sometimes difficult. I couldn't come up with an easy solution because there is no SendBlind command yet, but here is one that seems to work:

Code:

+LButton up:: MouseClick, Middle,,,,, U

+LButton::
VK_LSHIFT = 0xA0
SC_LSHIFT = 0x2A
KEYEVENTF_KEYUP = 2
; Simulate a LShift-Up keystroke (avoids the extra keystrokes produced by Send):
DllCall("keybd_event", Char, VK_LSHIFT, Char, SC_LSHIFT, Int, KEYEVENTF_KEYUP, Int, 0)
MouseClick, Middle,,,,, D
return
The above might fail to work unless you click the left button quickly after holding down the shift key. Otherwise, the shift key begins to auto-repeat, which produces shift-down events, which will likely cause the active window to think the Shift key is down. So what you might want to do is physically release the shift key immediately after you start holding down the left mouse button.

I've yet to find any way to stop a key from auto-repeating other than to physically press some other key. Pressing a mouse button isn't enough.
Back to top
View user's profile Send private message Send e-mail
Kahz



Joined: 12 Sep 2005
Posts: 190

PostPosted: Tue Sep 13, 2005 8:23 pm    Post subject: Reply with quote

No good. I still get the same problem.

Chris, have you ever considered the alternative of running a form of AutoHotkey at the driver in conjuction with the current system of catch-and-alter input?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Tue Sep 13, 2005 11:41 pm    Post subject: Reply with quote

Kahz wrote:
No good. I still get the same problem.
The script above produces the desired result according to KeyHistory (though I did add #InstallKeybdHook so that the shift key event could be seen). So one of the following probably explains why it doesn't work for you:

1) The program you're using checks the physical state of the shift key somehow, rather than its traditional/logical state. This is very unusual.

2) You're holding down Shift too long as I described in my previous post.

3) You're using the right shift key instead of the left.

Quote:
have you ever considered the alternative of running a form of AutoHotkey at the driver in conjuction with the current system of catch-and-alter input?
There is a plan to offer low-level remapping, but not as low as the driver level. The remap will transform one keystroke into another within the low-level keyboard and mouse hook. However, even this would probably not help with this shift key issue.

If you're interested in driver-level remapping, Astaelan made some progress in that area as described at http://www.autohotkey.com/forum/viewtopic.php?t=829
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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