Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Is possible to create any char representing key to make script clear?


  • Please log in to reply
3 replies to this topic
MIRKOSOFT
  • Members
  • 98 posts
  • Last active: Nov 01 2015 12:50 AM
  • Joined: 25 Jul 2014
Hi! I'm using AHK longer, but still like newbie... I have Japanese keyboard and my script contains also modifiers like NoConvert, Convert or Kana... I'm using these modifiers as scancodes what makes as is possible clear script still no clear. Windows modifier has character #, so hotkey Left Windows + Y is mapped <#y when I use Kana modifier - hotkey Kana + Y is mapped sc070 & y Is possible define in script any char which will represent any key like: Windows has # and Kana can be for example $ is it possible? Thank you all for each reply. Miro

Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

You can try out the Hotkey command.

 

#UseHook
var:="^"
Hotkey, %var%t, test
return

test:
MsgBox Hi
return

 

That's what I was able to test. I imagine you can do something like

 

Kana:="sc070"
Hotkey, %Kana% & y, Test


MIRKOSOFT
  • Members
  • 98 posts
  • Last active: Nov 01 2015 12:50 AM
  • Joined: 25 Jul 2014

Hi!

 

Man, you're like forum master - each time I posted any thread - you answered!

 

That's what I wanted! Real test I do later, here's 1:50AM

 

Thank you again, Exaskryz!



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Oh, I'm nowhere near being a master. Though I do spend a potentially unhealthy amount of time on this forum just out procrastination habits. I like to do it so I can practice with AHK and really learn it. This thread incidentally led me to learn about a rather curious effect with hotkey where the last positioned #If takes effect. Here's an example:

 

SetTitleMatchMode, 2
Hotkey, t, test
return
 
test:
MsgBox Hi
return
 
#IfWinActive Chrome
s::MsgBox Chrome Hi

 

If you had just that code, then the hotkey t would only activate when Chrome was active. You could fix it by doing this:

 

SetTitleMatchMode, 2
Hotkey, t, test
return
 
test:
MsgBox Hi
return
 
#IfWinActive Chrome
s::MsgBox Chrome Hi
#If