Jump to content

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

SendHotkey


  • Please log in to reply
4 replies to this topic
hyqtvawf
  • Members
  • 11 posts
  • Last active: Aug 08 2017 11:12 PM
  • Joined: 26 Dec 2012

It was a long time since somebody requested

SendHotkey, A_ThisHotkey

or something :S . Any chance it will be added in the next decade?



space
  • Members
  • 520 posts
  • Last active:
  • Joined: 12 Aug 2014
Send, % A_ThisHotkey

hyqtvawf
  • Members
  • 11 posts
  • Last active: Aug 08 2017 11:12 PM
  • Joined: 26 Dec 2012

Send, % A_ThisHotkey

Please go away from this thread :angry:

#UseHook
#Persistent
$t::Send % A_ThisHotkey ; outputs "$t"
a & f::Send % A_ThisHotkey ; outputs "a & f"
a & NumLock::Send % A_ThisHotkey ; outputs "a & NumLock"


nnnik
  • Members
  • 1625 posts
  • Last active: Apr 11 2017 02:13 PM
  • Joined: 28 Jul 2012

Well you could simply implement it yourself with a few lines of code.

That's why i don't see the point.


Visit the new forum ahkscript.org.

http://ahkscript.org


hyqtvawf
  • Members
  • 11 posts
  • Last active: Aug 08 2017 11:12 PM
  • Joined: 26 Dec 2012

Well you could simply implement it yourself with a few lines of code.
That's why i don't see the point.

You guys like to reinvent the wheel. I don't. Why to parse what's already been parsed by ahk? It's a triple-parsing (because Send will also parse). And it will require much testing before it could completely imitate the original parser. Here is the draft in case somebody wants to write his "few lines of code".
if RegExMatch(HotkeyStr, "i)^"
       . "(?P<Modifiers>(?:<\^>!|[<>]?[#!^+]|[*~$])*)"
       . "(?P<First>[^ ]|[\w]+)"
       . "(?: & (?P<Second>[^ ]|[\w]+))?"
       . "(?: (?P<Up>up))?$", key)
{
    /* Analyze cases where hotkey contains "up", "*", "~", "$", "&", "<", ">"
       "<^" should send LControl, but "Send" function won't do this.
       "<^>!" should send AltGr, but "Send" function won't do this.
       Instead of sending "+<^>!a" we should implement something like this:
       {Shift Down}{LControl Down}{RAlt Down}a{RAlt Up}{LControl Up}{Shift Up}
       Instead of sending "a & f" we should implement:
       "{a Down}{f Down}{f Up}{a Up}"
       So our general approach is:
       {%mod1% Down}{%modN% Down}{%key1% Down}{%key2% Down}{%key2% Up}{%key1% Up}{%modN% Up}{%mod1% Up}
      
       But what if key1 contains word "up"? Should we send
       {%key1% Up}{%modN% Up}{%mod1% Up}
       or should we send
       {%mod1% Down}{%modN% Down}{%key1%}{%modN% Up}{%mod1% Up}
       What if a full pair defined
       a up::
       a::
       and what if only a half of a pair defined?
       a up::
       For me this behavior is undefined, unless we know
       that IsLabel(key without "up") and we know that it already sent itself.
       
       Also don't forget about letter hotkeys.
       In any layout this would output latin letter "t":
       t::Send % A_ThisHotkey
       Use GetKeyVK() here. */
}
Spoiler