Wikipedia:AutoHotkey

A page for tips, and sharing macros, for Wikipedians who edit using AutoHotkey (AHK), a free, open-source custom scripting language for Microsoft Windows.

Anyone using AHK for large-scale editing or article creation must comply with the policy at WP:BOTASSIST.

Typing aid

[edit]

Example scripts

[edit]

Simple blank template

[edit]
:*:\ac::{{}{{}Authority control{}}{}} ; typing \ac (one character at a time) sends {{Authority control}}

Complex template: Cite episode

[edit]

Keyboards with missing keys or characters needing the AltGr (right-Alt) key

[edit]

For a keyboard that needs the alternate graving AltGr (right-Alt) key to type the very frequently used characters "[", "]", "{", "}", and that has no key for "~", this script replaces the less used keys "ù", "µ", "ç", "à" with resp. "[", "]", "{", "}", and defines AltGr-s and AltGr-u to enter talk page signature, and an often used "warning template template":

Today's date

[edit]

In YYYY-MM-DD format

Apostrophes, curved and Wikipedia-compliant

[edit]

To use the curved apostrophe generally except when editing Wikipedia (where this is prohibited by MOS:STRAIGHT), one can take advantage of the fact that the page title when editing Wikipedia articles always contains the word "Editing". This doesn't work, though, when editing talk pages using the Replying feature.

With this code in effect, however, some other technique is needed to produce the left single quotation mark , used in America and Canada only for inner quotation marks; see Quotation marks in English § Single nested within double, or vice versa.

BLP talk page headers

[edit]

For a new BLP article's talk page.

Underlining in edit summaries

[edit]

Use of U+0332 COMBINING LOW LINE adds a nice u̲n̲d̲e̲r̲l̲i̲n̲e̲ to the preceding character in an edit summary. It has to be applied character by character (omitting characters with descenders), so sending it via AutoHotkey, e.g. with SendInput {U+0332} followed by SendInput {left}, makes inserting it much more practical (as well as more readable in the relevant text-entry box) than inserting ̲ (or ̲) throughout the relevant text. One starts at the end of a word to be underlined and presses the hotkey repeatedly until the entire word is underlined.

The approach also adds only one extra character per underlined character, rather than the five or six that would be required using ̲ or ̲ toward the maximum length of an edit summary. See, for example, the edit summary at the right-hand side of this page, which would have been too long if '̲' had been used.

Open Wikipedia watchlist

[edit]
#w::Run https://en.wikipedia.org/wiki/Special:Watchlist ; typing Win+w (Windows key, and "w", at the same time) opens watchlist in default browser

You must be logged in.

Search Wikipedia from clipboard

[edit]
#s:: Run http://en.wikipedia.org/wiki/Special:Search?search=%clipboard% ; typing Win+s searches Wikipedia using the content of the clipboard

Replace pieces of text in edit area by pressing F4 key

[edit]
[edit]