
In Praise of AutoHotKey - todsacerdoti
https://www.hillelwayne.com/post/ahk/
======
dguo
I've started[1] to do similar things on macOS using Hammerspoon[2]. So far
I've set it up to let me:

1\. Use shift when pasting something to simulate typing in the text instead,
getting around websites that block pasting.

2\. Use ";" as a hyper key. By holding it down and pressing another key, I can
switch between specific programs without cycling. I can also use hjkl as arrow
keys.

3\. Automatically switch audio input and output devices according to my
specified priority order. Because macOS would frequently get it wrong,
including treating my monitor as a speaker for some reason (it doesn't have
built-in speakers).

4\. Make control act as escape when tapped. I use this in conjunction with
remapping caps lock to control in macOS system preferences. I previously used
Karabiner Elements for making caps lock work as escape when tapped and control
when held, but I was able to uninstall Karabiner because Hammerspoon was
sufficient.

5\. Disable the insert key because I've never wanted its functionality, but I
would sometimes hit it accidentally.

[1]:
[https://github.com/dguo/dotfiles/blob/master/programs/hammer...](https://github.com/dguo/dotfiles/blob/master/programs/hammerspoon/init.lua)

[2]: [https://www.hammerspoon.org/](https://www.hammerspoon.org/)

~~~
airstrike
Having used both Hammerspoon and AHK, the latter is somehow both terser and
more ergonomic. I miss it dearly when I'm not on Windows.

And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps
lock, really?

I've actually gone kind of crazy with this idea and made my left ctrl, shift
and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h
actually does ctrl+left. Then I made fn+[ = pgup, fn+] = pgdn, fn+; = home,
fn+' = end and fn+\ = delete, with the same augmented fn+LHS modifiers.

Took me about a week for the muscle memory to catch up and allow me to
correctly hit ctrl+L with the right hand when I want to go to the address bar,
but now I'm ridiculously fast moving around in Excel without having to touch
the arrow keys.

Only downside is I have a relatively problematic left wrist and this set up
added to the already LHS stress to the already very imbalanced qwerty layout,
so it forced me off mechanical keyboards to a low profile logitech right
around the time COVID-19 hit.

If only Excel had vim bindings!!

~~~
slightwinder
> And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps
> lock, really?

Caps Lock is quite useful, because it's the perfect location for remapping the
Ctrl- and ESC-Keys. Which is no surprise, as they originally where located
there.

Under linux there is a nice tool for overloading keys, so they behave one way
when pressed short, and another way when holded longer. With programmable
keyboards you even have it OS-independant.

~~~
manishjhawar
> Under linux there is a nice tool for overloading keys...

Name please (TIA)

~~~
slightwinder
Oh, right. I knew I forgot something.

I use [https://github.com/alols/xcape](https://github.com/alols/xcape) for
some while now. It's old, reliable and straight forward, just does it's job.
Only downside is that it seems to be limted to X11. Not sure how well it will
play with wayland.

There are now also some alternative tools, with more ability, which allow
overloading just on the side. I have them on my list for a while now, but not
done much yet with them.

\- [https://github.com/david-janssen/kmonad](https://github.com/david-
janssen/kmonad)

\- [https://github.com/mooz/xkeysnail](https://github.com/mooz/xkeysnail)

\- [https://github.com/snyball/Hawck](https://github.com/snyball/Hawck)

Oh, and for rermapping capslock there are also options with X11. I use

    
    
       setxkbmap -option ctrl:nocaps
    

to map ctrl to capslock, then overload it with

    
    
        xcape -e "Control_L=Escape;"
    

to add ESC ontop.

------
silasdavis
I had a low paid data entry job one summer at university well over a decade
ago that involved a tortuous process for digitising gas mains installation
information. I discovered ahk and found I was able to install it, so I began
to script the repetitive entry screens spread between multiple different
programs. It allowed you to write a simple GUI form to collect various data up
front. There was a lot of window picking and timers and sending of mouse
clicks. It was really quite depraved but it worked. I could finish an hour's
work in about 10 minutes and spent most of my time listening to Tom Stoppard
plays.

I showed it to my immediate manager who I liked; they had a huge backlog and
issues with the health and safety executive. She was interested and I thought
I might get a slightly better low paid job maintaining my script, but alas the
overworked, underskilled, and somewhat frightened IT person couldn't stomach
the risk of getting in trouble for using it. So a hundred or so people went
back to doing things 6 times as slowly and much more error prone-edly. It's
stayed with me as some kind of lesson about inefficient use of human capital.

It was the first time I can remember really solving a problem I had with
software. Thanks ahk. You beautiful ugly thing.

~~~
WaxProlix
> It was really quite depraved but it worked

> but alas the overworked, underskilled, and somewhat frightened IT person
> couldn't stomach the risk

this seems like a reasonable call to me.

~~~
BeetleB
Not at all.

He could have written his own program and just used it, and IT would never
have gotten involved. Because it was using a 3rd party tool, IT got lazy.

My company, BTW, not only explicitly allows AHK, they actually encourage it. I
mean, if you're going to give people compilers to write arbitrary code, this
is not worse.

~~~
WaxProlix
It seems weird to expect someone with no programming training (an IT guy) to
either build or sign off on something they have no understanding of. In
large/high stakes settings, being risk averse and knowing the limits of your
understanding are very good traits.

Imho, this IT guy did his job, more or less. What was the testing plan for
this AHK script? What edge cases were considered? Unit tests, integ tests....
was there a preprod environment for it? A trial run? Can you safely roll back
if / when bad data shows up? What's the retry strategy for network or
up/downstream fault tolerance? Is there alarm or monitor coverage for bad
scenarios?

I'm not saying a bunch of people typing are error prone, if that's your take
on my post. I just think that there's a VERY different set of risks (and
therefore mitigations) between a distributed manual process and a large scale
automated one.

The IT guy might have on some level recognized this and judged the possible
loss to be way more than the "guaranteed loss" of the not-broken current
process.

If I were an IT guy with low level skills, I'd be proud of myself for making
that hard call.

~~~
jimmaswell
You absolutely do not need all that red tape to use a script written for a
well-known program. The IT guy just didn't care to spend the teensiest mental
energy to save people an enormous amount of work. "No" is the easiest, safest
call possible, not a hard call at all. People like him should be shamed.

~~~
WaxProlix
Spoken like someone who's never caused a prod outage at a real company, I
guess. I'd say that - outside of some startup or small company that has few
(or no?) users - the cautious approach is right. The IT guy knew that he was a
podunk pissant warden of a very, very small portion of very, very large
organization (an org of a few hundred people is basically nothing compared to
the vastness of many oil companies) and that the value that his org provided
was compromised by this automated approach, without knowing how to mitigate
that compromise. He made the right call, assuming he was just there as a
bulwark against exactly this.

~~~
airstrike
There's no "prod outage" here. It was a data entry script.

~~~
WaxProlix
What happens with that data, though? Is this a non production data entry job?

~~~
airstrike
Same that would happen with the manual typing process. The workflow either
includes a process for auditing data quality or it doesn't, regardless of how
it was entered in.

~~~
WaxProlix
Okay, is that a manual process or not? Why not start with automating the
testing and not the entry?

~~~
TeMPOraL
Because testing is probably not done at all. And even if it was, it isn't the
bottleneck in this story.

------
hateful
I absolutely love AutoHotKey. I've been using it for over 15 years. I used to
use it to format my HTML back when i only used a Text Editor (similar to what
this link is using for Markdown. I never use my right-control key so I map a
lot of stuff to it. I used to have macros on rightctrl+b = surround the
selection with <b></b> and later <strong></strong> (yes, it was that long
ago). I had some nifty ones with logic for adding <a>s (looking for @ and
[http://](http://)).

These days I use it for fewer things, but still really useful. One of those is
making chat applications that don't offer ctrl+enter to send a message - Like
Google Hangouts (basically flopping the functionality):

#IfWinActive Google Hangouts ahk_class Chrome_WidgetWin_1

    
    
        ^enter::
        Send {Enter}
        Return
    
        enter::
        Send +{Enter}
        Return
    

Another extremely useful is this one, which will type what's on the clipboard
rather than pasting it:

    
    
        >^v::
        SendRaw %clipboard%
        Return
    

And when I hit shift also, it does it slow (for input lag situations):

    
    
        >^+v::
        SetKeyDelay 500
        SendRaw %clipboard%
        Return
    

Extremely useful for two main reasons. 1 being input boxes on websites that
prevent pasting and 2. certain remote sessions that prevent pasting (like
Kesaya or any kind of Console remote application).

~~~
themodelplumber
What are all these websites that prevent pasting? I noticed a few people are
using tools to get around these.

~~~
CydeWeys
A common one I see is when you're entering in bank account information and
they force you to retype the account and/or routing number, even though you
never typed it in to begin with because you just copy-pasted it from your
bank's website :/

~~~
vxNsr
The worst is the banks that don’t let you copy it...

I don’t understand this insanity around bank account numbers... they should be
treated as public info, they’re on every single check, anyone you’ve given a
check to has your account number as does your employer...

------
dezmou
I've started programming using Autohotkey, I just wanted a script for age of
empire 2 to manage where catapult can efficiency dispatch attacks. After that
I made a bot that can auto fold poker hands, it worked, with AHK you can
search image on the screen and get position of the matched image. After that I
made a fully functional and autonomous poker bot

many years later I am now a software engineer, I just wanted to manage my
catapult on Age of empire 2 ....

So AHK is very powerfull, easy langage and awesome !

~~~
TeMPOraL
Yeah. I think it's also a perfect example of scope creep done right. As I
understand, its original purpose was closer to remapping Caps Lock to CTRL,
not to let you write a whole tiling window manager[0] for Windows in it. But
now it can do both, and established itself as the unofficial Windows scripting
language.

\--

[0] - [https://github.com/fuhsjr00/bug.n](https://github.com/fuhsjr00/bug.n)

------
infogulch
I learned programming with AutoHotkey when I was 15.

I first used it to automate grinding gold and items in a simple flash-based
RPG for me and my younger siblings around ~2005. At first it just clicked
certain locations that buttons would be on a fixed schedule to advance a quest
to the end and repeat. But then, being a flash game after all, sometimes it
would take a second to load the next screen which throws off the timings and
breaks the sequence. So I changed it to wait for pixels to change color as an
indication that something finished loading and to start the next sequence of
clicks. But that didn't end up being very reliable because the colors &
locations weren't always exactly the same, so I updated it to take a
screenshot and use it to find the _average_ color of an area of the game where
a button would be which ended up being a much more reliable timing indicator.
But then it was very slow/used a lot of CPU (and I needed all that CPU to go
to running the flash game in a 2005 browser on a 2002 dell), and using a
scripting language to sum up 100k pixels every frame just wasn't fast enough.
So I wrote a single C function to do the color averaging on a byte buffer,
_copied the raw compiled machine code (as hex) into AutoHotkey and directly
called it with DllCall_ to get the summed result: ah, much faster. But there
was still an unreliable aspect where the position of the game in the browser
window and the location of the browser window was fiddly to configure, and my
siblings had a hard time getting it set up. It turns out IE used standard
windows controls in the browser which (if you look in the right place) exposed
the location of the flash bounding box, and with some calculations relative to
the browser window I made all the click locations relative to the flash
window, which solved that problem. It think it also supported browser scaling
because we liked to play it at higher than 100% zoom.

I ended up being more interested in the programming than the game, and my
first published project was an array library to make working with associative
arrays (where each element is a separate variable myarray1, myarray2, myarray3
etc) easier with insert/delete/append etc operations, before AutoHotkey added
true arrays and objects.

Then I went to university for chemistry for 2 years before getting my wits
about me and realizing that I would probably be more interested in CS.

~~~
TeMPOraL
> _copied the raw compiled machine code (as hex) into AutoHotkey and directly
> called it with DllCall_

Holy potatoes, you can do that?! Or, I suppose, you _could_ do that, because I
half-expect you can't anymore with all the various security features that were
added to Windows over the last two decades. But cool stuff nonetheless.

It reminds me of my own foray into the space of running assembly output; back
in my teenage years, I compiled a small bit of assembly into an object file,
read it into a C++ program, casted the string into a function pointer and
executed. Surprisingly, it worked. I got the idea from StarCraft modding
scene; in those days, if you wanted to add a new button for your unit that did
something, you had to write the action in assembly, compile it with MASM, and
then let StarGraft tool patch the game executable with it (I don't remember if
it did it at runtime or modified the actual executable).

~~~
infogulch
Yep! Actually I'd bet it still works today. I was able to find it in my
Dropbox (2005 me's solution to version control). This is the function that
does the dirty work [1]. That gist also has the C source as well. Date
modified on these files are ~2008-9.

[1]:
[https://gist.github.com/infogulch/d88b956ddd86bd00b351649511...](https://gist.github.com/infogulch/d88b956ddd86bd00b35164951142d533#file-
regiongetcolor-ahk-L64)

------
geocrasher
A thousand times, this. I love AHK. It, along with Ditto Clipboard Manager
(Yes, I know W10 has its own. It sucks) changes my workflow so much for the
better. Some of my favorite examples:

Right Alt becomes Ctrl Tab: Ralt::^Tab

Common typos: ::teh::the ::alreadsy::already

::nopity::Call to undefined function pity()

::awk1::awk '{{} print $1 {}}'

::du-m::du -m --max-depth=1 | sort -n

But it goes waaay behond this. I once used AHK to assist my grandfather, who
in his old age had caused him to lose dexterity. He was clicking both right
and left mouse buttons at the same time. I used AHK to disable the might mouse
button and then mapped right click to Number Pad +. Worked beautifully.

I actually wrote a Big Long Article about it once:
[https://www.tidbitsfortechs.com/2013/10/using-autohotkey-
to-...](https://www.tidbitsfortechs.com/2013/10/using-autohotkey-to-assist-
the-elderly-disabled-and-more/)

~~~
function_seven
I'm a bit masochistic when it comes to typos. This is from my AHK script:

    
    
        :*:netowrk::
            Send, {Home}+{End}{Delete}
            return
    

What it does: I have a really bad habit of misspelling "network" that way. I
think my right hand is just so _eager_ to get that 'o' keyed in that it
doesn't wait for my left hand to hit the 'w' first. So I'm always screwing
that word up when typing quickly.

So now, when I make that mistake, I'm punished by having the entire line of
text deleted. '{Home}' moves the cursor to the start of the line, '+{End}' is
the [Shift]+[End] key to highlight the whole thing, then {Delete} metes out
the justice I deserve.

~~~
Noumenon72
You should add a popup that requires you to type in "network" correctly and
then issues a Ctrl+Z.

~~~
TeMPOraL
> add a system-modal popup that requires you to type in "network" correctly 50
> times in a row and then issues a Ctrl+Z; if you make a mistake, you start
> over.

There, fixed :).

~~~
function_seven
Working on it. And to make sure I don’t cheat, it’ll put me into a kiosk mode
and temporarily change my password to prevent me from escaping my punishment.

It’ll be like my very own ransomware!

~~~
TeMPOraL
Be sure the script also temporarily clears your keyboard; can't have you
cheating your way out by having "network" ready to paste at any moment!

------
ufo
The hotstrings feature is also present in Linux, where they are known as
compose sequences. The default compose sequences can be found in the Compose
files under /usr/share/X11/locale and you can also have custom compose
sequences in ~/.XCompose. Some of the compose sequences make use of a special
Compose key (written <Multi_key> in the rules). You may need to go to the
keyboard settings to enable the compose key.

[https://en.wikipedia.org/wiki/Compose_key](https://en.wikipedia.org/wiki/Compose_key)

Edit: by the way, these compose sequences also work under Wayland. The only
hiccup I found with wayland was that include directives didn't work so I had
to put everything in a single file.

~~~
Arkanosis
For more, sxhkd is easy to configure and powerful:
[https://github.com/baskerville/sxhkd](https://github.com/baskerville/sxhkd)

~~~
platz
or just use i3

------
skymt
I love AutoHotkey, and it works wonderfully in the niche of writing a bunch of
tiny UI- and workflow-smoothing functions, like how an Emacs user gradually
builds up tweaks in their config file. The one time I tried to use it for
scripting that required more than the most basic logic, I ran screaming back
to Python. Over a decade of well-meaning development and reasonable design
choices have resulted in AHK growing a syntax Frankensteined together from
Basic, JavaScript, and batch script. Thankfully the upcoming AHK 2 is cleaning
up a lot of the mess.

[https://www.autohotkey.com/v2/v2-changes.htm](https://www.autohotkey.com/v2/v2-changes.htm)

~~~
badsectoracula
Sounds like AHKv2 is doing the grave mistake of "cleaning up" by breaking all
the scripts and work that people have put towards using the tool.

~~~
airstrike
Seems to me like we need a 1to2.ahk file

------
ronjouch
Linux users, see
[https://github.com/autokey/autokey](https://github.com/autokey/autokey) . I
use it for purposes very similar to those described by the article (little
automation scripts, text expansion).

It's equally as {sometimes awesome, sometimes infuriatingly quirky} as its
Windows inspiration :D , but I guess it's the nature of such a tool :) .

Won't work (yet?) on Wayland, though,
[https://github.com/autokey/autokey/issues/87](https://github.com/autokey/autokey/issues/87)
.

~~~
mathfailure
Unfortunately, AutoKey is not similar to AutoHotkey. I tries to be, but fails
so far. Lacks a loooot of AHK functionality and contains lots of bugs. The
development is so slow that something new after Linux will come out sooner
than they reach AHK's state of, say, 2010.

~~~
konfekt
In the quest for an analogue on Linux of Autohotkey that exclusively runs on
Microsoft Windows, neither autokey nor espanso proved as reliable.

Instead, I derived my own little shell script snippy.sh [1] that expands a
fuzzy selected string by letting xdotool type it out.

[1]
[https://github.com/konfekt/snippy.sh](https://github.com/konfekt/snippy.sh)

------
gtbcb
Here's what we really need - a tool that monitors the various user actions
like specific application functionality used, website actions taken, and maybe
keystrokes too (but that gets dicey), and then every month or so it recommends
the most frequently done actions that you should automate with AHK or some
other tool. What does the community think of this?

PS - I use Alfred and Keyboard Maestro to get functionality similar to AHK on
a Mac.

~~~
hobs
It would be the best privacy invading tool you could come up with :)

~~~
badsectoracula
As long as it is only running locally and doesn't send any data anywhere it
wont be privacy invading.

------
swyx
I once automated myself out of a job, in my first banking internship, with
AutoHotkey. I would fire up a script and then head out to lunch and be done by
the time i got back, so then I went home.

wish I got the hint that i might have what it takes to be a developer right
then. instead I waited ~6 years climbing the rungs in finance.

~~~
smabie
Man you must have been lucky. The banking interns I've met certainly aren't
allowed to leave when they're work is done, that would be ridiculous!

------
nikivi
On macOS a similar tool is Keyboard Maestro
([https://www.keyboardmaestro.com/main/](https://www.keyboardmaestro.com/main/)).
I made over 1400+ macros in it over time that automate practically everything
for me now.

[https://wiki.nikitavoloboev.xyz/macos/macos-apps/keyboard-
ma...](https://wiki.nikitavoloboev.xyz/macos/macos-apps/keyboard-maestro)

~~~
simonklitj
Would love to have a bunch of macros, but I honestly have a hard time
imagining the 1400+ situations that are worth automating? Could you maybe
provide some obscure examples of yours? That would be pretty cool.

------
modernerd
AutoHotKey (in addition to WSL and VS Code) was enough to make me Windows-
curious and eventually try a Windows laptop again after 10+ years on Mac.

I first found out about AHK via Tom Scott's similar ode here:

[https://www.youtube.com/watch?v=lIFE7h3m40U](https://www.youtube.com/watch?v=lIFE7h3m40U)

He describes it as “a bodge that helps you make other bodges”, which is
beautifully put.

[For those outside the UK, a “bodge” is a clumsy hack or repair.]

~~~
antoncohen
The odd thing about that video is that Tom claims he uses Windows because 1)
it is cheaper, and 2) it allows him to "bodge" (aka create quick hacks). And
he explicitly dismissed Linux.

But his example, creating an emoji keyboard, would be far easier with Linux.
And Linux is cheaper (in terms of money, not necessarily time). Someone in the
YouTube comments actually posted how to do it in Linux, which is basically:

    
    
        xinput list
        xkbcomp $DISPLAY mapping.xkb
        vim mapping.xkb
        xkbcomp -i <id from xinput> mapping.xkb $DISPLAY

------
Stratoscope
One project I did in AutoHotkey is JKLmouse. This is a "mouse keys" program
that works on laptop keyboards. I wrote it specifically for ThinkPads, it's
not as good on laptops that have clickpads instead of dedicated mouse buttons.
(One of these days I will do something about that.)

If you run Windows on a ThinkPad or similar machine, and you ever wished you
could have precise pixel-by-pixel mouse movement from the keyboard home row,
try it out.

I think it's also a good example of some fairly well-written AutoHotkey code.
(Please ignore the messed-up indentation in the SetKeyMap function... Time to
add a .editorconfig file!)

I originally wrote JKLmouse as a native Windows app in C using keyboard hooks.
But when I saw that I could do the same thing in AutoHotkey it was a big
improvement.

[https://github.com/geary/jklmouse](https://github.com/geary/jklmouse)

[https://www.jklmouse.com/](https://www.jklmouse.com/)

------
ggcdn
Oh man, I am using (abusing?) AHK so hard. I work with legacy software
programs for structural analysis, where everything in the model has to be
input with clunky form fields. Thousands of properties need to be defined for
various structural components (beams, columns, etc). It used to be >2 weeks of
entering numbers into fields and clicking buttons.

Now, AHK is set up to just reads my design spreadsheets and define everything
in a few minutes. I hate the language syntax, but man is it useful! God bless
AHK!

------
evantahler
AutoIt was how I learned to program in 2007! We were using it to control show
effects for spaceship-themed exhibit at school!

All the buttons, TVs, lighting effects... all run from windows PCs with
AutoIt!

(there was a flash photo gallery, because 2007, but here are some of the
images)

[https://www.etc.cmu.edu/projects/lbe/S07/clients/ETC/gallery...](https://www.etc.cmu.edu/projects/lbe/S07/clients/ETC/gallery/images/02.JPG)
[https://www.etc.cmu.edu/projects/lbe/S07/clients/ETC/gallery...](https://www.etc.cmu.edu/projects/lbe/S07/clients/ETC/gallery/images/24.JPG)

------
rishav_sharan
AutoIt ( I know this is about AHK but hear me out) was my first actual coding
language. this was way back in 2008 when I was a manual tester and I decided
to work on an automation framework around testing our .net based app. the
documentation was amazing. the language are incredibly simple. and the windows
integration was insane. In a way, if I hadn't worked on the automation
framework using autoit, i probably wouldn't have decided to learn python, js
and other languages and really wouldn't be where I am.

So, much love to the AHK/Autoit team.

~~~
TravHatesMe
I believe AHK was an early fork of AutoIt. AutoIt was my first language as
well. A fun language to write code in. No static typing, easy to use. A little
code can do a whole lot. I miss the forums, I wonder what ever happened to
everybody there, Gary Valik Validator Larz SmokeN -- some names that come to
mind. To think of all the devs that used this language as a stepping stone in
their careers. Incredible. Hats off to Jon & Team!

------
TheCapn
AHK solved a quirky issue my work had me develop.

We have an excel sheet that gets updated periodically throughout the day by
various people. When the spreadsheet is saved it also publishes an MHT file to
be displayed on a webbrowser that refreshes every 5 minutes. That browser runs
on a little Intel stick plugged into a wall-mounted TV to show the spreadsheet
to various parts of the office / production floor.

At night the screens get turned off and through something that happens the
little computer thinks the resolution changed and takes the browser session
out of its fullscreen view to a tiny square in the corner.

No matter how many setting changes I made it still did it. AHK to the rescue.
On a periodic timer take ownership of the browser window and compare its
resolution to the desktop resolution. If it has changed send F11, pause, F11
to refresh the fullscreen command and boom, fixed.

That's the first use I had for AHK, I've expanded a lot on that since.

~~~
TeMPOraL
Ooh, I'm guessing Windows and its weird treatment of powered-off monitors.

I dual-boot and leave my home PC on for weeks at a time; I just power the
screens off when I stop working. My Linux system doesn't even notice; when I
come back, everything is at it was. Windows however, the second it notices I
powered off one screen, moves all the Windows to the other one. So the first
thing I have to do when I come back is to rearrange the windows back to where
they were.

I don't know the justification for this behavior of Windows.

~~~
smileypete
These might help:

[https://superuser.com/questions/453446/how-can-i-stop-
window...](https://superuser.com/questions/453446/how-can-i-stop-windows-re-
positioning-after-waking-from-sleep)

[https://answers.microsoft.com/en-
us/windows/forum/windows_10...](https://answers.microsoft.com/en-
us/windows/forum/windows_10-hardware-winpc/windows-10-multiple-display-
windows-are-moved-and/2b9d5a18-45cc-4c50-b16e-fd95dbf27ff3)

Particularly st99's answer on the second link.

~~~
TeMPOraL
Thanks!

------
winkeltripel
I'm using ahk to record programming tutorials without a typo. It pastes very
slowly, one character at a time and it appears as if a person is typing:
[https://winkeltriple.tumblr.com/post/177397119146/recording-...](https://winkeltriple.tumblr.com/post/177397119146/recording-
code-without-typos)

~~~
f1refly
I did this to present how programs works once: Did a medium sized presentation
and assembled the program piece by piece, only to have it type it's own source
code in the end and run another instance of itself. Confused the hell put of
everybody in retrospect, but immensely fun at the time nonetheless :)

------
bokwoon
Something I don't see mentioned in this thread is that Autohotkey is more than
just hotkeys. It can also create basic GUIs using native Windows widgets, and
is probably the fastest way of producing a GUI on windows (the resulting
script can be bundled into an .exe file)

~~~
disillusioned1
Quick Access Popup is a full-blown, highly configurable launcher for Windows.
I just started using it last week, fell in love with it, and was shocked to
discover it's written in AHK.

[https://www.quickaccesspopup.com](https://www.quickaccesspopup.com)

------
brumm
AutoHotKey!!! It single-handedly spurred my interest in software development.

I still remember my favorite scripts and miss them dearly:

\- a smart "spell check" of sorts that could look at previous characters or
words to contextually fix typos and expand abbreviations, powered by regex.
For instance it would recognize common typos like `AUtohotkey` where your
finger would linger on shift for too long. Or auto-add a closing parentheses,
if the previous character wasn't a colon (in case you wanted to type `:(` etc.

\- I was a huge fan of OSX and specifically wanted to have something like
Quicksilver back then but could not afford a Mac. So I built Quicksilver with
AutoHotKey and used that. It had a cache, contextual actions, periodic
rescanning, would search not only files but also Preferences and fuzzy search
with custom scoring. God I loved this thing.

Fun fact, the current logo was contributed by me waaaaay back in the day :)

------
hnick
I thought AutoHotKey was for automatically assigning simple actions to keys. I
was so wrong.

I started playing Path of Exile a while ago and soon found PoE Trade Macro
([https://github.com/PoE-TradeMacro/POE-TradeMacro](https://github.com/PoE-
TradeMacro/POE-TradeMacro)) which allows you to mouse over items, hit a hotkey
to send a web API request to a trade site, pops up an overlay with a pricing
summary, lets you adjust certain parameters and search again, and so much
more. All allowed by the game in case you're wondering, they encourage it.

There's a YT video in the link above showing just some of the features. And
I'm pretty sure newer overlays are even more impressive (I haven't checked
them out). AHK is far more developed and complex than I gave it credit for.

------
ulucs
In a similar spirit, another very useful Windows tool is Windows Keyboard
Layout Creator. I first started by editing the US English keyboard to have an
AltGr key which produced Turkish letters like ğ and Ş, and just recently I
added a Greek dead key which lets me type α, γ, Ω etc with two keystrokes.
What's really nice is that the usual keyboard is a single Win+Space away so my
friends don't need to struggle when using my PC.

------
naveen99
Best thing about autohotkey is the minimal boiler plate required and no walled
garden approach to welcoming non professional programmers.

Its free, light weight, and has an excellent user manual.

------
mnm1
Autohotkey is awesome. I used it as part of an automation workflow to remove
an hour or longer of daily routine work each engineer had to do each morning
as part of their job. Sometimes things failed, but it was used to automate,
among other things, a GUI only app.

For "Fast Window Switching":

Linux: Use jumpapp:
[https://github.com/mkropat/jumpapp](https://github.com/mkropat/jumpapp)

OS X: Use triggers in QuickSilver: [https://qsapp.com/](https://qsapp.com/)

This is one feature I could not do without in any OS now.

------
jedimastert
Fun AutoHotKey abuse: Tom Scott's emoji keyboard[0]. It's every single emoji
(at the time of recording) on 14 full keyboards with 1,000s of hand-placed
bespoke stickers. He goes into more detail here[1], but it's beautiful.

[0]:
[https://www.youtube.com/watch?v=3AtBE9BOvvk](https://www.youtube.com/watch?v=3AtBE9BOvvk)
[1]:
[https://www.youtube.com/watch?v=lIFE7h3m40U](https://www.youtube.com/watch?v=lIFE7h3m40U)

------
melling
“Let’s start with a simple one. I use Dragon voice to text for writing as I
can speak prose a lot faster than I can type.“

I often use Siri on my iPhone to write messages, etc. It’s pretty good but at
times frustrating.

How does Dragon on Windows compare? I like the tablet form factor. Does Dragon
work well on a Surface Go?

~~~
QuantumGood
Dragon works much better than Siri for me.

------
jakub_g
One thing I use AHK for:

I bought a logitech trackball, which is great for my RSI, but unfortunately it
has no scroll wheel/button, and man, life without scroll wheel and middle
click is just impossible!

Luckily, it has 4 buttons apart from the ball, so someone wrote a script to
make use of one of those buttons together with the ball to provide the scroll
wheel / middle click experience, and posted it on the forums.

Really great that a tool like this exist for this kind of situations.

------
omnibrain
Being too cheap to rent a photo booth for our wedding I used AutoHotKey to
glue a software to control my (then) fiancees Nikon and Irfanview together.
The software ran on my Laptop, the camera was connected via USB.

------
kyeb
AutoHotKey was my first programming language, years and years ago on my couple
hundred dollar laptop. It wasn't much, but it was definitely a great
introduction to basic CS concepts (if statements, loops, functions, etc.).

I remember using it to automate login for a variety of websites, and to
automate resource collection for a game I played (Lord of Ultima, in case
anyone remembers it).

------
imode
This software got me through a really rough hurdle in my earlier years. Had to
automate data capture from an accelerometer on a Windows machine. You could
only initiate the intended capture from a UI, so automating this for an
assembly line testing jig was going to be a real hassle if not for AHK.

Remarkable piece of software. Wish something like that was for *nix.

------
lucb1e
Did nobody else get a TLS (HTTPS) certificate warning for the site? For me it
shows it expired 2020-04-26T14:00:00+0200 (I guess that would be pretty crappy
for a MITM, unless that's exactly the point since an unknown CA would be more
suspicious than someone "forgetting to renew their cert").

~~~
softblush
Nope. The cert I get expires May 20, 2021

~~~
lucb1e
Same for me now, thanks for checking! I guess a lot of people just clicked
past the warning without even mentioning it in a comment until it was updated
:| (Assuming that is what happened.)

------
rpvnwnkl
I spent about a year writing a whole library of AHK scripts that could be
mixed and matched to completely automate working within a legacy database
system. Data entry people loved it and I even had a number of excel
integrations for the people who keep everything in spreadsheets. Also GUIs,
etc.

It beats the hell out of copy-pasting from one app to the other and hoping
you're doing it right. 8 hours of data entry you are bound to make mistakes.

AHK also helped me move into more technical work, so I have a real soft spot
for it. However, I am lamenting the move to SaaS websites because not only are
there about 3x as many clicks as a native app, but it's really hard to
automate with AHK.

------
chrismorgan
Fast window switching: pin Firefox in the task bar in the first position (so
that it’s always the same number), and Win+1 will do roughly what your RAlt+1
hotkey does out of the box in Windows 10.

------
arprocter
I used this when my mouse started opening more than one tab when I wheel
clicked

    
    
       MButton::   
          If (A_TimeSincePriorHotkey < 150)
             Return
          Send {MButton}
       Return

------
Yeet69
I've been writing AHK code almost every workday for the past year and a half
to automate my job and I'm in love with it. The power that I have in
comparison to my co-workers in completing tasks is almost unfair. The writer
of the article didn't mention GUI's in ahk which are super simple and I
encourage you to check them out.

------
flarg
AHK is such a good text expander that I came back to Windows for it. It
literally saves me thousands of keystrokes a month.

------
nightowl_games
I started using AutoHotkey to remap the control groups in Starcraft Brood War.

It was simply too far to reach 6,7,8,9!

Then I used it to make a hotkey to have a popout, always on top, no title bar,
browser window. I use that for youtube videos or documentation. Always on top
windows + a big monitor are really great for productivity, better than multi
monitor imo.

------
Timpy
I recently wrote a script that I call with Meta+F, assigned via a Linux Mint
keyboard shortcut. It will open Firefox, or focus it if it's already open.
Multiple presses will cycle through open instances. Meta+T does the same for
terminals. It's like a focused version of Alt+Tabbing through programs.

~~~
RMPR
For this kind of automation, I use pyautogui, but recently I made a kind of
front end for that
[https://github.com/rmpr/atbswp](https://github.com/rmpr/atbswp)

------
castillar76
It's a little different, but I've been using Typinator for this for a long
time. In addition to a bunch of default auto-swaps to correct common typos, it
has a bunch of built-in libraries for inserting things like Greek characters,
arrows, symbols, and emoji. One huge time-saver for me has been in grading: I
have to grade student assignments regularly, and I fill out a short text-based
rubric chart as I go. So I have a shortcut for it: I type "\\\gt" and I get
prompted for the student's name, then it creates a new rubric block with the
student's name already inserted and the cursor positioned to start entering
scores. Stuff like that is a huge time-saver in terms of wear-and-tear on the
arrow keys or moving to use the mouse.

------
suzzer99
I used to play online poker - 17 tables spread over 2 30" monitors. I used
auto-hotkey, combined with my MX Revolution mouse - to automate all kinds of
things to allow me to play that many tables - raise, fold, go all in,
rearrange the tables. It was great.

------
viggity
I use AHK so I can have emacs-like text navigation in all apps and not just
VS/VS Code. It is extremely liberating to be able to nav/select/delete all
from the home row regardless of if I'm in VS, Word, Chrome, FF, etc etc.

------
keithnz
what? windows is a second class citizen in the wider development world? The
"wider" development world covers a lot of areas... though I notice in certain
developer communities certain OS's are more dominant.

but yes autohotkey is great!

------
kissgyorgy
When I played poker full time, it made a huge difference. I was able to manage
poker tables with it fully automatically, so I could play on 12 tables
comfortably. I was able to implement features that PokerStars didn't have at
the time, like hiding the cashier lobby, or floating the Lobby window outside
of the screen and float back on mouse-hover so I had more screen-space for
tables.

Check out my script if you are interested:
[https://github.com/pokerregion/pokerstars-
autoit](https://github.com/pokerregion/pokerstars-autoit)

------
scottfr
My company is trying to solve similar challenges for automating common typing
tasks on web pages (email, chat, CRM, etc...) with our Chrome Extension Text
Blaze [1].

It was a pretty extensive formula support [2] enabling you to create dynamic
snippets. In many ways it's kind of like Excel but for documents.

[1] [https://blaze.today/](https://blaze.today/)

[2]
[https://blaze.today/formulas/reference/](https://blaze.today/formulas/reference/)

------
ahaferburg
I use AHK to make CapsLock a custom modifier key, mostly to make VIM style
movements available everywhere.

Caps+p Ctrl+Backspace Delete previous word Caps+f Backspace Caps+d Delete
Caps+h/j/k/l Left/Down/Up/Right Arrow Caps+u/i Home/End Caps+m/, Page Down/Up
Caps+e/r Ctrl+Left/Right (next/previous word) Caps+3 Insert current date, e.
g. 14.05.20 Caps+Shift+3 ISO format 2020-05-14

I also swapped Return with ' so it's closer to my pinky. Not sure if that was
worth it, though.

~~~
davebrny
i do something similar using the appskey or printscreen key as a modifier so i
so i only have to use my right hand. i used lp;' instead of the usual hjkl vim
keys though.

    
    
      printscreen::
      thumbMod := true
      return
      
      printscreen up::
      thumbMod := false
      return
      
      
      #if thumbMod
      
      l::    send {left}      ; move caret
      `;::   send {down}
      p::    send {up}
      '::    send {right}
      
      +l::   send +{left}     ; select text
      +`;::  send +{down}
      +p::   send +{up}
      +'::   send +{right}
      
      ,:: send {backspace} 
      .:: send {delete}
      
      #if

------
infogulch
I learned programming with AutoHotkey. I first used it to grind out gold and
items in a simple flash-based RPG for me and my younger siblings. At first it
was just timed clicks

------
Maha-pudma
Autohotkey is the only reason I still use windows at home and it makes work
(where I have to use windows) actually bearable.

I have enjoyed reading the comments here, I have picked up some good tips;
obvious ones I should have actually thought of.

I am glad I am not they only person who started programming using this
language. I have to say that in my limited experience the documentation for
Autohotkey is second to none despite that the syntax could use improvement.

------
jpl56
I love AHK!

It allows me to automate sentences or commands I frequently type. It also
helps improve ergonomy of given websites (e.g. "page down" key rather than
clicking on "next page").

It avoids the need to download dozens of software to do "this" or "that",
piling up in the windows tray. If I need something, I write my AHK snippet.

And of course I have AHK shortcuts to Excel macros. And I have Excel macros
that run AHK code :-)

------
cdaven
I actually built a micro break reminder in AutoHotkey yesterday; every 30
minutes a (top-most) message box shows up, telling me to move and look out a
window. The message box auto-closes after 30 seconds.

Extremely simple!
[https://gist.github.com/cdaven/360f0509f823d309e1b9de67bd826...](https://gist.github.com/cdaven/360f0509f823d309e1b9de67bd8265b1)

------
discreteevent
I had an AHK script that uses capslock+ijkl for navigation (plus a few other
things like modal space-bar for select) but it wasn't reliable enough at
speed. Maybe it was the way I programmed it.

So I wrote a Windows keyboard hook in C which turns out to be easy enough to
do. I just hard-coded the key mappings in a switch statement. Been using it
for about 10 years and find it hard to work without it.

------
leejoramo
I heavily use AHK to make my Windows 10 an enjoyable and keyboard focused
environment. Between AHK and an hardware keyboard with full keyboard macro's,
I have Windows working with my Macintosh inspired keyboard bindings.

Of course on the Mac, I heavily use Keyboard Maestro and LaunchBar so I am
really implementing my own keyboard centric UI

~~~
acqq
> hardware keyboard with full keyboard macros

Do you use one? Which? I used one, very convenient, in eighties(!) and haven't
seen something comparable since.

The functionality I had then that I liked was: any key could be programmed to
really anything else (except the special "macro" key) -- another key or
another sequence of the keys, and I regularly did some action once, recording
it with just one "start recording" and one "stop and assign to.." action and
after that just "playing" it when needed. It was a huge time / nerves saver at
these times, especially because it was fully independent of the programs and
even of which OS I've used (I've had to switch between two even then).

~~~
smabie
I'm not the parent, but I use the Kinesis Advantage and it supports macros.
Basically you can rebind any key to any other and also bind any key to a
sequence of other keys. I think you can also change the timing of each key
press, but I've never used that feature.

------
erhserhdfd
This is a great tool I use all the time. In addition to about 2 dozen
hotstrings, I have a script that will automatically open my email editor, a
script that will open my calendar to allow me to schedule a meeting, and a
script that will open a new message in Slack to allow me to quickly fire off a
message.

Huge time saver!

------
ethanpil
I used AHK to create my personal snippets tool which works across all IDEs,
editors, browsers, etc.

Have been using this for years and years and finally published to GitHub a
couple of years ago.

[https://github.com/ethanpil/snips](https://github.com/ethanpil/snips)

------
chris_wot
Oh god, I remember EMC made us use this to manage their god-awful support
system.

One of the worst experiences of my life in IT. Not the fault of AutoHotKey but
they used it to paper over the cracks in their massively flawed and sucky
support system. The only thing I’ve used that is worse than the SAP GUI.

~~~
jokab
The AHK scripts you mention was probably the work of somebody who automated
himself out of a job. Now upper managment thinks they would save $$$ by
maintaining the AHK scripts instead of the actual underlying support system.

~~~
chris_wot
No, he was promoted and fated. Those scripts required maintenance!

------
Der_Einzige
AutoHotKey scripts gets me some pretty insane lee-sin ward-hops so yeah its a
pretty awesome tool.

You can mess with league of legends folks a lot with it actually. You can use
it to spam 5 pings around someone instantly. You can spam emotes with it. You
can write messages quickly in chat.

------
bcassedy
AHK was how I got back into programming. I wrote some scripts to help reduce
RSI playing online poker and then later when I worked in a call center wrote
some scripts to automate dialing my phone and macros for basic notetaking.

A clunky as it is, it is a fantastic tool.

------
traes
I've used AHK a fair bit, and while it's quite helpful I can't help but want
for a better syntax and less limited core language. I think it would do much
better as a lisp with more obviously defined syntax boundaries.

~~~
frosted-flakes
Try the AHK v2 alpha. It removes a lot of the cruft and weird inconsistencies
of v1. Someone else on this page linked to a changelog.

------
BlackShade
I have been a big fan of Macro Express which has a GUI so if you aren’t a
developer, you can build Macros. Never used AHK myself. Anyone used both that
can comment on strengths of AHK vs Macro Express?

------
zmix
I would like to see much more work on "Generic Scripting Hosts", like
ActiveScripting (MS) and OSA (Apple)? But since everybody develops into the
cloud, goodbye elegant user experience...

------
jweather
The AHK script that has saved me the most RSI is mapping Caps Lock to double-
click. Sounds weird, but didn't take long to pick up, and has saved me
uncountable mouse clicks.

------
Tomte
I don't use much of AHK, but I love it.

[https://www.2uo.de/my-autohotkey-script/](https://www.2uo.de/my-autohotkey-
script/)

------
gfosco
I remember back in 2005-2007, using AHK to make data entry way more efficient,
at a few different companies. It's also great for macros in video games.

~~~
TravHatesMe
Pretty sure AHK/AutoIt made its way into many legitimate products despite its
binaries being false-positively flagged by anti-viruses

------
Tossrock
I use Autohotkey to set up my tmux bindings when working under WSL, it's
gotten my WSL environment nearly up to parity with an OSX iterm2 environment.

------
jerome-jh
Certainly Alt-Tab is annoying. In Ubuntu (default install) they even so dimly
highlight the selected window they completely screw up the functionality.

------
lihaciudaniel
I can tell you that this program is so useful, automated everything in my
system to be able to use it more smoothly and have saved a lot of time.

------
atoav
I am using AHK on Windows for ~10 years now. Does anyone know of a linux
equivalent?

~~~
koheripbal
I think it works on Linus as well, doesn't it?

~~~
atoav
There seems to be a Linux version called Autokey, indeed.

------
modzu
i used to use autohotkey for lots of stuff until steam started banning me from
paying games; they won't disclose why (ugh) but ahk seemed to be what was
triggering the false positives :(

------
toastflambe
Does anyone know if using AHK increases input latency at all?

~~~
geocrasher
In some programs, yes. I've found it works _horribly_ in Notepad++.

------
roryokane
Specific ways to reproduce these AutoHotkey scripts on macOS (a repost of my
comment on Lobsters):

## AutoHotkey equivalent

The closest equivalent to AutoHotkey in general is Keyboard Maestro
([https://www.keyboardmaestro.com/](https://www.keyboardmaestro.com/),
currently $36), a proprietary app. In Keyboard Maestro, you define macros
using a drag-and-drop scripting language. You can also embed shell scripts or
AppleScript. Each macro can have a number of triggers, most commonly Hot Key
triggers.

## (Keyboard and) mouse shortcuts

Keyboard Maestro’s triggers can associate custom shortcuts with your macros.
Most of my macros have Hot Key triggers, which capture to keyboard shortcuts.
For example, Shift+Ctrl+S triggers a macro that puts my laptop screen to
sleep.

However, to respond to a mouse input like Scroll Wheel Left, you would have to
use a Device Key trigger. A Device Key trigger responds to a single device
input, but sadly, it doesn’t block the input from being passed to the OS. In
this example, whatever your cursor is over would scroll left in addition to
the macro being activated.

To replicate the `Send, {NumpadAdd}` part of your script, you would add a Type
a Keystroke block to your macro. One nice thing about KeyboardMaestro is it
can record the keystroke, so you don’t have to remember names like
“NumpadAdd”.

If you don’t want to buy Keyboard Maestro, macOS’s built-in Automator
([https://support.apple.com/en-
ca/guide/automator/welcome/mac](https://support.apple.com/en-
ca/guide/automator/welcome/mac), free) can be used in some cases. For
examples, compare three of the solutions on
[https://apple.stackexchange.com/questions/137047/](https://apple.stackexchange.com/questions/137047/)
for working around bad default ⌘C behavior in Books: my simple Keyboard
Maestro solution, someone’s straightforward Automator solution, and my
shorter, situation-specific Automator solution.

## Hotstrings for math

I used to use TextExpander ([TextExpander]:
[https://textexpander.com/](https://textexpander.com/), currently $40/year)
for something like this. I had `ddate` mapped to the current date, and
`solang` marked to a block of markup I used on Stack Overflow. TextExpander
implements the direct equivalent to AutoHotkey hotstrings, and is probably the
best way to implement short hotstrings like `;a`.

However, for my purposes, I realized that I could insert pieces of text more
simply by using another program I was already using: LaunchBar
([https://obdev.at/products/launchbar/](https://obdev.at/products/launchbar/),
currently $30). While its most obvious feature is launching applications, one
of its many other features is inserting text snippets. You define text
snippets by putting text files in a certain folder. Your defined snippets are
then added to your global list of searcheable items, alongside applications
you can open and so on.

To insert a snippet such as the current date using LaunchBar, I open a
LaunchBar window with Command-Space, type `date` to find the “Current Date
(ISO format)” snippet, and press Return to insert it.

Also note that macOS makes typing special characters easier in general. All
macOS keyboard layouts let you access an alternate layer of characters by
holding Option. For example, Option-8 types ‘•’. If you would rather Option-A
typed ‘∀’ instead of ‘å’, you could set that up by defining a custom math-
focused keyboard layout with Ukelele
([https://software.sil.org/ukelele/](https://software.sil.org/ukelele/),
free). I have used Ukelele to define my own keyboard layout “U.S. – Rory
custom” that makes smart quotes and apostrophes (“”‘’) easier to type.

## Markdown links

You could do this with Keyboard Maestro. It has actions for reading from and
writing to the clipboard, and for appending to, prepending to, and searching
and replacing in text variables.

Just a few days ago I implemented a Vim editor mapping to do a similar thing:
turn the selected text into a link with the clipboard used as the URL. Of
course, it only works in Vim. Here’s the source:

    
    
      " create Markdown link from selected text using URL in clipboard
      " uses vim-surround, so can’t be vnoremap
      vmap <Leader>ml s]%a()<Esc>"*Pl
    
    

## Fast Window Switching

I used to have something set up for this. I used Karabiner (formerly
KeyRemap4MacBook) to map my fn key to the combination of Shift-Control-Option-
Command. Then, with Keyboard Maestro, I mapped ⇧⌃⌥⌘F to open the Finder and so
on. That let me type fn+F to switch directly to the Finder.

Karabiner was forced to be rewritten as Karabiner-Elements
([https://karabiner-elements.pqrs.org/](https://karabiner-elements.pqrs.org/),
free and open source) because of changes in macOS, and it lost some features
in the process. I haven’t checked if mapping of fn is one of them. I don’t use
Karabiner-Elements because I rarely used my fn mappings and my current model
of laptop doesn’t have real function keys to remap.

As for window groups to switch within, Keyboard Maestro doesn’t have a built-
in concept like that. I think you could implement it, though – “if” statements
can check the app of the current window.

## Remapping the calculator button

This would be a straightforward application of Keyboard Maestro.

## Scihubize

Same as above.

\---

That covers everything in your article as much as macOS software is capable
of. You may also be interested in…

## Features I use without equivalents in this article

Keyboard Maestro lets you define a Quick Macro – a sequence of keypresses and
clicks. I can press Ctrl-F1 to start recording, execute a sequence, then press
Ctrl-F1 to stop recording. After that, Option-F1 will run the sequence. I use
this, for example, in my browser to scroll many adjacent newly-opened tabs
down to the start of the content, by recording and replaying the sequence
Ctrl-Tab, Down, Down, Down, etc.

Keyboard Maestro also supports image recognition for clicking on the
screenshotted GUI element or waiting for something to appear on the screen.
I’ve used this to make a macro that uses the System Preferences GUI to toggle
a setting – it decides whether to move the selection up or down by recognizing
the image of the currently-selected preference. I’ve also used it to abort a
macro if I don’t see the expected window open after a certain step (which
could happen if the GUI was in a certain state), to avoid executing further
keypresses in the wrong window.

LaunchBar comes with a built-in clipboard history manager. I use this to copy,
for example, both a title and URL in one window, knowing they will be saved.
Then, after switching to another window, I use the clipboard history to paste
both of them where they need to go.

