Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 02:22:02 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Per application keyboard remapper?  (Read 3541 times)

uuderzo

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 38
    • View Profile
    • Uderzo Software
    • Donate to Member
Per application keyboard remapper?
« on: June 03, 2010, 03:18:19 AM »
Hi guys! I'm looking for a per-application keyboard remapper.

I mean... i wish to remap some keys only when a specific application is on foreground.
Any hint?

Thank you! Umberto

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,664
    • View Profile
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #1 on: June 03, 2010, 03:40:13 AM »
If you can't find a dedicated application to do this, it is extremely easy to do using AutoHotkey and the #IfWinActive directive.

http://www.autohotke...nds/_IfWinActive.htm

Code: Autohotkey [Select]
  1. SetTitleModeMatch, 2
  2. #IfWinActive, Notepad
  3. {
  4.     ; Define Notepad-specifc hotkeys here.
  5. }
  6.  
  7. #IfWinActive, FireFox
  8. {
  9.     ; Define Firefox-specifc hotkeys here.
  10. }
  11. ; etc, etc...

uuderzo

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 38
    • View Profile
    • Uderzo Software
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #2 on: June 03, 2010, 04:35:28 AM »
Thanks for your hint skwire...

I'm trying to remap "è" and "+" keys (on italian keyboard) to "[" and "]" to control brush size under photoshop.

I wrote down this script:

#ifWinActive, ahk_class Photoshop
{
è::sendinput {raw}[
+::sendinput {raw}]
}


if I try, say, with notepad (changing window class name) it works well, but photoshop seems to receive the equivalent of ALT+[ and ALT+].

I also tried send {[}, send [, sendinput {[} and so on... but always the same result.

Sure my mistake, but cannot guess it...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,664
    • View Profile
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #3 on: June 03, 2010, 04:43:44 AM »
Try this:

è::[
+::]

uuderzo

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 38
    • View Profile
    • Uderzo Software
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #4 on: June 03, 2010, 04:58:58 AM »
Nope... with your script i get exactly the same result.

I tried to unload AHK and to press ALT+[ and ALT+] combinations and the result is identical, so I guess that photoshop interprets AHK keystrokes in an unusual way...

On italian keyboard, "è" and "+" keys are on the same position of "[" and "]" keys of US keyboard. If I switch to US keymapping with ALT+Shift i get the wanted behavior, but i get also all other unwanted key remappings and moreover it's annoying to switch keyboard each time you switch app...

Any oter hint please? AHK looks so good...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,664
    • View Profile
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #5 on: June 03, 2010, 05:06:45 AM »
Did you try SendPlay, by chance?

uuderzo

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 38
    • View Profile
    • Uderzo Software
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #6 on: June 03, 2010, 10:11:06 AM »
No way... sigh! Looks like PS intercepts keyboard events in strange way...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,664
    • View Profile
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #7 on: June 03, 2010, 10:25:48 AM »
Which version of Photoshop are you using?

uuderzo

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 38
    • View Profile
    • Uderzo Software
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #8 on: June 03, 2010, 10:34:59 AM »
I'm, using CS3... I purchased the English version because of lower price but trying to make correctly working the brush size keyboard shortcuts on the italian keyboard is a hassle... i'm forced to switch keyboard from IT to US every time but that's soo annoying...  :-\

Anyway... thank you for your time!

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,925
    • View Profile
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #9 on: June 03, 2010, 04:17:17 PM »
I don't know for certain that this will work, only briefly tried it, but you could try HotKeyz remapper feature.  It would be a bit tedious to set it up, but...  As far as I can see, when you limit it to which windows to work with, it will only accept single items, i.e. recognises "TED" but not "TED Notepad."

You could also look at Comfort Keys.  I don't know if you can make it program-specific but you can load alternate key maps with a hotkey, which should be smooth enough.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,258
    • View Profile
    • Coding Snacks by Lanux128
    • Read more about this member.
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #10 on: June 04, 2010, 12:32:23 AM »
... i'm forced to switch keyboard from IT to US every time but that's soo annoying...

you can also try this tool which switches the keyboard locale based on the active program. btw, it was written by me as requested by a forum member.

Auto-switch Locale.

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 2,925
    • View Profile
    • Donate to Member
Re: Per application keyboard remapper?
« Reply #11 on: June 04, 2010, 02:01:12 PM »
I looked in AHK's Help for scan code, and found this in the Send / Send Raw (etc.) page:

Quote
{vkXX}
{scYYY}
{vkXXscYYY}
 Sends a keystroke that has virtual key XX and scan code YYY. For example: Send {vkFFsc159}. If the sc or vk portion is omitted, the most appropriate value is sent in its place.

The values for XX and YYY are hexadecimal and can usually be determined from the main window's View->Key history menu item.
 

Would this work better than the other method, assuming you know the scan codes you want?