AutoHotkey Community

It is currently May 27th, 2012, 1:41 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 45 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Remapping a few keys
PostPosted: September 12th, 2005, 2:15 am 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 8:00 am 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 8:21 am 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
I'm trying to remap keyboard-mouse combinations. How will replacing strings help?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 8:46 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 9:24 am 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
Hihi, didn't recognice lmb as LeftMouseButton, saw only the string.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 11:37 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
:)

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 3:50 pm 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 4:03 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
try this
Code:
!LButton:: Send, !{MButton down}
!LButton Up:: Send, !{MButton Up}

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 4:07 pm 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 4:15 pm 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 5:52 pm 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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. :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2005, 8:10 am 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2005, 3:42 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2005, 9:23 pm 
Offline

Joined: September 12th, 2005, 2:12 am
Posts: 190
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2005, 12:41 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, JSLover, Tipsy3000 and 20 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