| View previous topic :: View next topic |
| Author |
Message |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Mon Sep 12, 2005 1:15 am Post subject: Remapping a few keys |
|
|
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 |
|
 |
garath
Joined: 24 Mar 2005 Posts: 398 Location: germany
|
Posted: Mon Sep 12, 2005 7:00 am Post subject: |
|
|
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 |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Mon Sep 12, 2005 7:21 am Post subject: |
|
|
| I'm trying to remap keyboard-mouse combinations. How will replacing strings help? |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Sep 12, 2005 7:46 am Post subject: |
|
|
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 |
|
 |
garath
Joined: 24 Mar 2005 Posts: 398 Location: germany
|
Posted: Mon Sep 12, 2005 8:24 am Post subject: |
|
|
| Hihi, didn't recognice lmb as LeftMouseButton, saw only the string. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Sep 12, 2005 10:37 am Post subject: |
|
|
:) _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Mon Sep 12, 2005 2:50 pm Post subject: |
|
|
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 |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Mon Sep 12, 2005 3:03 pm Post subject: |
|
|
try this | Code: | !LButton:: Send, !{MButton down}
!LButton Up:: Send, !{MButton Up} |
_________________ Ciao
toralf  |
|
| Back to top |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Mon Sep 12, 2005 3:07 pm Post subject: |
|
|
Fixed, but now I broke alt-shift-lmb somehow.
| 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 |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Mon Sep 12, 2005 3:15 pm Post subject: |
|
|
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 |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Mon Sep 12, 2005 4:52 pm Post subject: |
|
|
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.  |
|
| Back to top |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Tue Sep 13, 2005 7:10 am Post subject: |
|
|
| 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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Tue Sep 13, 2005 2:42 pm Post subject: |
|
|
| 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 |
|
 |
Kahz
Joined: 12 Sep 2005 Posts: 190
|
Posted: Tue Sep 13, 2005 8:23 pm Post subject: |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Tue Sep 13, 2005 11:41 pm Post subject: |
|
|
| 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 |
|
 |
|