Autohotkey Having Hotkeys & Hotstrings

1

0

How do I allow the Hotstrings to be triggered by remapped hotkeys so they work in Autohotkey?

r::Send e
::ee::by the way

So that when I press rr on the keyboard it prints "by the way".

Currently it prints that only when pressing ee.

NOTE: I'd like a solution that doesn't involve assigning multiple triggering abbreviations to expand to the same string.

William

Posted 2014-09-05T01:41:57.660

Reputation: 992

You gave your own answer, just repeat the last line and use rr instead of ee..... – Robert Ilbrink – 2014-09-05T14:59:13.210

@RobertIlbrink I have multiple keys assigned to the same key it seems like there might be a better way. Basically I have reassigned the entire keyboard to a different keyboard layout. – William – 2014-09-07T03:38:56.500

it's not direct answer, but I suggest you to create new layout using e.g. http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx instead of re-mapping all keys with AutoHotkey. It's way more effective, and less ambiguous.

– LogicDaemon – 2014-09-09T16:58:13.723

That doesn't work for a large set of keys in addition many applications have there shortcuts assigned from keycode so you have to reassign the key using autohotkey to get it to work properly – William – 2014-09-11T15:29:32.043

Why not store by the way as a variable and send it when rr or ee is pressed? – NonlinearFruit – 2017-02-02T14:20:42.877

Answers

2

You can use #InputLevel if you use AHK v1.1+ http://ahkscript.org/docs/commands/_InputLevel.htm

::ee::by the way
#InputLevel, 1
r::Send e

lintalist

Posted 2014-09-05T01:41:57.660

Reputation: 258

0

Using an * with the hotstring means that it won't wait for a space/tab character before substituting. This also allows multiple hotstrings to share a single definition.

r::Send e

:*:ee::
:*:rr::
  Send by the way
  Return

NonlinearFruit

Posted 2014-09-05T01:41:57.660

Reputation: 738

0

Use this instead:

r::Send {ASC 0101}
::ee::by the way
::rr::by the way

Vinayak

Posted 2014-09-05T01:41:57.660

Reputation: 9 310

I dont understand your answer it doesnt seem to work for what I was intending. I would like to avoid typing the different keyboard hotstrings. – William – 2014-09-07T13:00:09.723

What this does is send the ASCII code for "e" when you press "r". On pressing "r" twice successively and hitting the space bar, it expands to "by the way". The same thing happens when you press "e" twice in succession and hit the space bar. – Vinayak – 2014-09-07T15:49:12.517

@LiamWilliam what doesn't seem to work? Are you not getting "by the way" when you type "ee" or "rr" and hit space/enter/period? – Vinayak – 2014-09-07T16:35:39.740

yes but I dont want to have to redefine the keys two times – William – 2014-09-07T16:36:58.117

You might want to edit your question to specify that. – Vinayak – 2014-09-07T16:49:29.360

It seems quit clear as is, but you are welcome to propose an edit if you would like – William – 2014-09-11T13:36:39.303

I accepted your edit by manually editing the question. – William – 2014-09-14T03:41:55.760

0

Here is a code:

r::
Loop
{
    b:=GetKeyState("r")
    if (b !=1)
    {
        ccounter := 1
        Loop
        {
            c:=GetKeyState("r")
            if (c=1)
            {
                MsgBox, by the way
                return
            }
            Sleep, 50

            ccounter:= ccounter + 1

            if (ccounter = 60)
            {
                return
            }
        }
    }
}
return

It will pop message box "by the way" when r is pressed 2 times. But time between 2 r presses should be maximum 3 seconds. You can adjust that time by changing ccounter = 60 . Each value there equals to 50 milliseconds (1000 milliseconds = 1 second).

Also, always use AutoHotkey and its documenatation from http://ahkscript.org/ (current uptodate version, new official website)! AutoHotkey and its documentation from autohotkey.com is outdated and you may have some problems using them!

vasili111

Posted 2014-09-05T01:41:57.660

Reputation: 479

Your script completely hijacks the r key. I assume the OP doesn't want that. From what I understand, the OP wants the r key to send e when pressed. And when either ee or rr is typed, it must expand to "by the way". – Vinayak – 2014-09-08T14:11:01.367

@Vinayak For removing r hijacking just replace r:: with ~r::. If he wants other things, it will be nice if will tell what exactly he needs from script. – vasili111 – 2014-09-08T14:40:37.457

I believe it is quit clear as is. – William – 2014-09-11T13:37:39.747

-2

This will work:

:*:rr::  
Goto ::ee  
return  
::ee::  
Send by the way  
return

vaztran

Posted 2014-09-05T01:41:57.660

Reputation: 1

1Can you explain how and why it will work? Please see [answer] and take our [tour]. – Burgi – 2017-02-02T21:14:24.597