Welcome Guest.   Make a donation to an author on the site April 24, 2014, 03:50:46 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the full one-year retrospective report on DonationCoder.com.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: IDEA: remap extra keyboard keys for other tasks  (Read 3152 times)
noth(a)nk.you
Charter Member
***
Posts: 78


More than meets the eye.

View Profile Give some DonationCredits to this forum member
« on: March 22, 2006, 01:33:50 PM »

This is probably a quick thing to do in AHK, but I have not yet learned all the necessary commands so I'd really enjoy some help.  On to the task!

I own a MS Natural Ergonomic 4000 keyboard (stolen picture, click to zoom):


The bundled software does not allow many changes, so I was thinking that I could use AHK to alter the functionality of a few things.  In particular, the zoom slider (in the middle) and the back/forward keys (at the bottom).

Firstly, the slider.  From AHK's Key History view (which is only showing the key strokes), I believe it works by sending Ctrl+Scroll wheel up/down every ~.1s or so.  Since zoom is not very useful to me, I'd prefer this combination be mapped to just the scroll wheel up/down.  Is this doable?

Secondly, the back/fwd keys.  My mouse is already equipped with such buttons so the keyboard is redundant.  Instead, I'd like these keys to map to left/right mouse buttons (a throwback to my lappy).  Again with AHK, I see these keys are mapped to Alt+Left/Right in the following way: Alt d, Left d, Left u, Alt u--but all sequenced without delay.  The problem I'm running in to with coding is translating this to the analogous mousing.  That is, I'd like to be able to hold down the back/fwd keys and drag files/folders.  Is this doable?
 

I should also like to note that my mouse uses RightAlt+L/R, so there shouldn't be a conflict there if the script just recognizes LeftAlt. 
Thanks for reading, any help you can provide would be most appreciated.

Cheers,
noth(a)nk.you

P.S. Thanks for tolerating my playing with the spoiler tag!
« Last Edit: March 22, 2006, 02:26:00 PM by brotherS » Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: March 22, 2006, 04:51:57 PM »

EhEh.. So much text for such a small solution!

[copy or print]
^WheelDown::WheelDown
^WheelUp::WheelUp

<!Left::Lbutton
<!Right::RButton
Does that solve it? Wink
Logged

noth(a)nk.you
Charter Member
***
Posts: 78


More than meets the eye.

View Profile Give some DonationCredits to this forum member
« Reply #2 on: March 22, 2006, 06:36:14 PM »

Thanks a lot for your help, jgpaiva--it's close.

The scrolling wasn't working.  Ctrl was still down when AHK executed the Wheel commands, so (if anybody's interested) I changed it to
[copy or print]
^WheelDown::Send {^Up}{WheelDown}
^WheelUp::Send {^Up}{WheelUp}
Now it works pretty well, reverting back to the default behavior only when trying to scroll past the limits of the page (perhaps some timing issue?)

On the L/Rbuttons, though, I'm running into more trouble.

When pressing those keys in programs without "Back" support (e.g. Notepad and AHK), AHK reports:
[copy or print]
A4  038 d 1.30 Alt
25  14B h d 0.00 Left
01  000 i d 0.00 LButton
25  14B h u 0.00 Left
01  000 i u 0.00 LButton
A4  038 u 0.00 Alt
and it works beautifully.

But in those programs with back support (e.g. Firefox and Explorer), AHK reports:
[copy or print]
01  000 d 4.68 LButton
01  000 u 0.10 LButton
and the programs respond as though they were given the Back or Forward commands.

I'm thinking that the Back/Fwd commands might have some deeper hook into the OS?

Any thoughts?

Thanks,
noth(a)nk.you
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: March 22, 2006, 06:49:44 PM »

Hum.. Then. it's harder than i thought.
How about the following, to replace the back/forward?

[copy or print]
Browser_Back::Lbutton
Browser_Forward::RButton
Logged

noth(a)nk.you
Charter Member
***
Posts: 78


More than meets the eye.

View Profile Give some DonationCredits to this forum member
« Reply #4 on: March 22, 2006, 06:55:05 PM »

No, still getting just the LButton.
Interestingly, I get LButton for both the Back and Forward buttons.  Is that of some significance?
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: March 22, 2006, 07:03:58 PM »

That's very odd...
Please try the following:

Quit any running ahk script.
Open the following script:
[copy or print]
#Persistent
#KeyHistory
Then, press one of the keys.
Copy the full line, and post it here.

I think that keyboard works in a strange way (well.. it's microsoft's, is there any other way to expect it to work? Wink ).
Still, if it sends always one only key, there might be a way to remap it.
Logged

noth(a)nk.you
Charter Member
***
Posts: 78


More than meets the eye.

View Profile Give some DonationCredits to this forum member
« Reply #6 on: April 05, 2006, 05:49:43 AM »

Just gave it another try.

Through MS's software, I mapped the keys to something I wouldn't use (Media Track Fwd/Back), then opened up AHK again.  I found them coming through under SC169 and SC16A (fwd and back, respectively).  Then the [simple!] .ahk script
[copy or print]
SC16A::LButton
SC169::RButton
fixed it!

I think that the Back and Fwd commands were deep in the system, so AHK couldn't intercept them.  Changing MS' software to execute a shallower command then allowed AHK to do its magic.

Incidently, from the AHK page, it sounds like they would advocate completely uninstalling Microsoft's software and just using their's to execute all the required commands using these SC codes.  Not a half-bad idea, actually.  Maybe I'll do that some lazy morning.

Thanks for your assistance!
noth(a)nk.you
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: April 05, 2006, 08:17:49 AM »

Incidently, from the AHK page, it sounds like they would advocate completely uninstalling Microsoft's software and just using their's to execute all the required commands using these SC codes.  Not a half-bad idea, actually.  Maybe I'll do that some lazy morning.

Thanks for your assistance!
noth(a)nk.you
Yes, that might be the best way. I also don't have my mouse's software installed. However, that might make some of the keys not be possible to remap, as happens with one of my mouse buttons. On the other hand, i don't think that happens with keyboards since they have the scan code method, that is not usable with mouse keys. So, probably, the best way would be to just uninstall that software cheesy
Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.034s | Server load: 0.25 ]