User:Ineuw/AutoHotKey

From Wikisource
Jump to: navigation, search

Introduction[edit]

Last updated: — Ineuw talk 02:13, 18 July 2015 (UTC)

  • Autohotkey.ahk keyboard macros script file for proofreading Wikisource text in Windows OS. These macros work in Firefox, Chrome and Opera browsers, but not with Internet Explorer 11.
  • The scripts are in two files: Autohotkey.ahk is the main file, and the Proofread.ahk script is the second file linked into the Autohotkey.ahk.
  • The installation generates a sample Autohotkey.ahk file in the My Documents folder. Both the file name and the folder are defaults, which means that on start Autohotkey.exe will look for the Autohotkey.ahk scrip in the my Documents folder without any redirection. The contents of sample Autohotkey.ahk file is to be replaced with the code below, but any drive, folder, and file name with the .ahk extension can be specified on the command line of the program shortcut link as follows.
"C:\Program Files\AutoHotkey\AutoHotkey.exe" D:\AHKFunctionsLibrary\Autohotkey.ahk
  • It is recommended the a shortcut link is also placed in the Windows Startup folder.
  • Note that in the script, the working drive "D:\" and the "\AHKFunctionsLibrary" is both my working and library folder. These are my choices of location. Update these to your preferred location.
  • The software's limitation is that the U.S. keyboard layout definition is to be used and when editing, the scripts are to be pasted into a text editor which supports ANSI and PC encoding (i.e: Windows Notepad). This is not a limitation when working with text directly in browsers.
  • Most keyboard key combination can assigned to satisfy one's preference, with some exceptions of the keys assigned by Microsoft, for their Windows keyboard. These exceptions are noted in my keyboard assignments macro key assignment list.
  • The cripts can be reassigned to different keyboard key combinations, deleted, or neutralized by placing the (;) semicolon at the beginning of the lines of code. This means every line of code beginning with the keyboard key assignment and including the "return" at the end of the code segment.
  • Some key combinations were omitted because they conflict with Windows, or are needed for more important tasks.
    • Ctrl+p for printer/printing is omitted.
    • Win+l locks out the user - in Vista and later Windows versions, (but not in XP).
  • After changes, the file is to be saved and then reloaded using either of the two following options:
    • The Ctrl+\ (Control and backslash) key combination which is assigned to reload the script or,
    • Using the right mouse button click on the system tray AutoHotkey icon and select from the context menu options "Reload This Script."
  • The script actions were thoroughly tested. The Proofread.ahk macro, in the section below is linked by the #include declaration of the first line of this file. It's location is to be edited according to one's personal preference.

Autohotkey macro key assignment list[edit]

Last updated: — Ineuw talk 22:06, 16 June 2015 (UTC)

This lists the current keyboard key assignments. No uppercase characters used. Key combinations with numerals refer to the keys above the characters and not the Number Pad keys.


;alt-'          ''selected text''
;alt-.          proofread macro - see proofread.ahk file.
;alt-0
;alt-1          }}
;alt-2          {{fqm}}
;alt-3          {{|}}
;alt-4          {{Dhr}} {{rule|4em}} {{Dhr}}
;alt-5          {{Dhr}}{{rule|65%}}{{rule|65%}}{{Dhr}}
;alt-6          {{Dhr}}{{rule|12em}}{{Dhr}}
;alt-7          {{c|{{fs75|selected text}}}}
;alt-8          {{c|{{fs85|selected text}}}}
;alt-9          {{c|{{fs90|selected text}}}}
;alt-=          remove braces from {{—}}
;alt-a
;alt-b          '''selected text'''
;alt-c          {{c|selected text}}
;alt-d          {{Dhr}}
;alt-e          | vertical bar at the beginning of the row for tables
;alt-f          FIS images container
;alt-g          {{gap}}
;alt-h          {{fs75|{{sfrac||}}}} OR {{fs75|{{over||}}}} both are the same
;alt-i          <i>selected text</i>
;alt-j          {{left|selected text|2em}}
;alt-k          |ptb.5  ((ts    table style code
;alt-l          {{Plr|selected text}}
;alt-m          emdash —
;alt-n          {{nop}}
;alt-o          {{rh||'' ''|}}
;alt-p          {{rh||''THE POPULAR SCIENCE MONTHLY.''|}}
;alt-q          <ref></ref>
;alt-r          <ref>selected text</ref>
;alt-s          {{sc|selected text}}
;alt-shift-0    <div>selected text<div>
;alt-shift-a    {{color|red|''Arabic missing''}}
;alt-shift-b    <br />
;alt-shift-g    {{color|red|''Greek missing''}}
;alt-shift-h    {{he|}} hebrew
;alt-shift-l    reserved by Windows
;alt-shift-w    {{PSM link|T|V|M&Y|author=}}
;alt-t          {{ts|}}|
;alt-v          {{di|D}}rop initial at the beginning of the line
;alt-w          width=
;alt-y          ·
;alt-z          replace <ref>footnote</ref> with <ref>*</ref>
;ctrl-\         re-load this edited and saved .ahk file
;ctrl-b
;ctrl-i         cleaned image and improved contrast
;ctrl-j         Replaced Google copyright notice(s) with blank page(s)
;ctrl-k         {{sic}}
;ctrl-m         <ce></ce>
;ctrl-p         {{ping|}}
;ctrl-shift-0   <div>selected text<div>
;ctrl-shift-4   4 spaces
;ctrl-shift-8   {{fs85/s}}selected text{{fs85/e}}
;ctrl-shift-9   {{fs90/s}}selected text{{fs90/e}}
;ctrl-shift-b   |pb.5
;ctrl-shift-f   {{fs||selected}}
;ctrl-shift-i   [[selected text|selected text]]
;ctrl-shift-l   colspan=
;ctrl-shift-m   :-) smiley
;ctrl-shift-n   Irfanview negative image - do not use
;ctrl-shift-o   Now Commons
;ctrl-shift-p   <p>
;ctrl-shift-s   possibly reserved by firefox display the code window
;ctrl-shift-t   pt.5    {{ts    table style code
;ctrl-shift-w   rowspan=
;ctrl-win-y     {Asc 0176} ° degree indicator 
;win-'          Search for first "
;win--          {{fs|%|{{sc|selected text}}}}
;win-0          {{fs|%|''selected text''}}
;win-1          <section end=E />
;win-2          <section end=E /><section begin=B />{Left 3}
;win-3          <section end=B />
;win-8          {{fs85|selected text}} without centering
;win-9          {{fs90|selected text}}
;win-a          {{anchor|D}}
;win-b          <b>selected text</b>
;win-c          {{color|red / blue|selected text}}
;win-d          <div {{ts|width:480px;|ma|aj|sm85|lh11|it}}>selected text</div>
;win-down       {{hwe|
;win-e          {{anchor|D}}
;win-f          reserved by windows
;win-h          {{hi|selected text}}
;win-i          {{SIC|selected text|selected text|}}
;win-l          reserved by Windows, do not use
;win-m          <!-- selected text -->
;win-n           
;win-o          {{smaller|selected text}}
;win-p          <poem style=>
;win-q
;win-r          {{right|selected text|2em}}
;win-s          {{smallrefs}}
;win-t          {| {{ts|mc|sm85|lh11|ar|bc|bgt}} <!-- border -->
;win-u          <sup>selected text</sup>
;win-up         {{hws|
;win-v          <sub>selected text</sub>
;win-w
;win-z

Autohotkey.ahk[edit]

Last updated: — Ineuw talk 22:41, 4 August 2016 (UTC)


SetWorkingDir, D:\AHKFunctionsLibrary

#Include D:\AHKFunctionsLibrary

#Include Proofread.ahk

#SingleInstance force

#InstallKeybdHook

#NoEnv

#Warn

clipboard:=

; temporary key assignments
; -------------------------

;alt-z  replace <ref>footnote</ref> with <ref>*</ref>
!z::
clipboard:=
send, ^a^c
in_put:= chr(0xfffd)
out_put:= ""
clipboard:=regexreplace(clipboard, in_put, out_put)
send, ^v^ {bs}{bp}{bs}{bs}
;{Home}
return

; permanent key assignments
; -------------------------

;alt-=          remove braces from {{—}}
!=::
clipboard:=
sendinput, ^a^c
clipwait, 0
        in_put:=chr(0x007b)chr(0x007b)chr(0x2014)chr(0x007d)chr(0x007d)
        out_put:=chr(0x2014)
        clipboard:=regexreplace(trim(clipboard), in_put, out_put)
sleep, 0
        sendinput, ^v^{home}
return

;alt-'          ''selected text''
!'::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard=''%selected%''%A_space%
}
Else
{
        selected:=trim(selected)
        clipboard=''%selected%''
}
        sendinput, ^v
return

;alt-.          assigned to the proofread.ahk macro file.

;alt-0          
!0::
return

;alt-1          }}
!1::
        sendinput, {raw}}}
return

;alt-2          {{fqm}}
!2::
        sendinput, {raw}{{fqm}}
        ;sendinput, {Left 2}
return

;alt-3          {{|}}
!3::
        sendinput, {{}{{}bar|2{}}{}} ;{left 3}
return

;alt-4          {{Dhr}} {{rule|4em}} {{Dhr}}
!4::
        sendinput, {Home}`n
        sendinput, {raw}{{Dhr}}
        sendinput, `n`n
        sendinput, {raw}{{rule|4em}}
        sendinput, `n`n
        sendinput, {raw}{{Dhr}}
        sendinput, `n
return

;alt-5          {{Dhr}}{{rule|65%}}{{rule|65%}}{{Dhr}}
!5::
        sendinput, {Home}`n
        sendinput, {raw}{{Dhr}}
        sendinput, `n`n
        sendinput, {raw}{{rule|65`%}}{{rule|65`%}}
        sendinput, `n`n
        sendinput, {raw}{{Dhr}}
        sendinput, `n
return

;alt-6          {{Dhr}}{{rule|12em}}{{Dhr}}
!6::
        sendinput, {Home}`n
        sendinput, {raw}{{Dhr|3em}}
        sendinput, `n`n
        sendinput, {raw}{{rule|12em}}
        sendinput, `n`n
        sendinput, {raw}{{Dhr}}
        sendinput, `n
return

;alt-7          {{c|{{fs75|selected text}}}}
!7::
selected:=
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{c|{{fs75|%selected%}}}}
        sendinput, ^v
return

;alt-8          {{c|{{fs85|selected text}}}}
!8::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{c|{{fs85|%selected%}}}}
        sendinput, ^v
return

;alt-9          {{c|{{fs90|selected text}}}}
!9::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{c|{{fs90|%selected%}}}}
        sendinput, ^v
return

;alt-a
!a::
return

;alt-b          '''selected text'''
!b::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard='''%selected%'''%A_space%
}
Else
{
        selected:=trim(selected)
        clipboard='''%selected%'''
}
        sendinput, ^v
return

;alt-c          {{c|selected text}}
!c::
selected:=
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{c|%selected%}}
        sendinput, ^v
return

;alt-d          {{Dhr}}
!d::
        sendinput, {Home}`n{{}{{}Dhr{}}{}}`n
return

;alt-e          | vertical bar at the beginning of the row for tables
!e::
        sendinput, {Home}|{Down}
return

;alt-f          FIS images container
!f::
        sendinput, {Home}{{}{{}FIS`n
        sendinput, {Home} | file         = `n
        sendinput, {Home} | width        = 500px|250px`n
        sendinput, {Home} | cstyle       = margin-top:8px; margin-bottom:-0px`n
        sendinput, {Home} | float        = left|none|right`n
        sendinput, {Home} | caption      = `n
        sendinput, {Home} | talign       = center|justify`n
        sendinput, {Home} | tstyle       = font-size:83`%;font-variant:small-caps`n
        sendinput, {Home} | margin-right = 14px`n
        sendinput, {Home} | margin-left  = 14px`n
        sendinput, {Home} | tmleft       = 11px`n
        sendinput, {Home} | indent       =-11px`n
        sendinput, {Home}{}}{}}
return

;alt-g          {{gap}}
!g::
        sendinput, {raw}{{gap}}
return

;alt-h          {{fs75|{{sfrac||}}}} OR {{fs75|{{over||}}}} both are the same
!h::
        sendinput, {raw}{{fs75|{{sfrac||}}}}
        sendinput, {Left 5}
return

;alt-i          <i>selected text</i>
!i::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard=<i>%selected%</i>%A_space%
}
Else
{
        selected:=trim(selected)
        clipboard=<i>%selected%</i>
}
        sendinput, ^v
return

;alt-j          {{left|selected text|2em}}
!j::
        sendinput, {Home}
        sendinput, {raw}{{left|
        sendinput, {End}
        sendinput, {raw}|2em}}
return

;alt-k          |ptb.5  ((ts    table style code
!k::
        sendinput, `|ptb.5`{left 6`}{`down`}
return

;alt-l          {{Plr|selected text}}
!l::
clipboard:=
sendinput, ^c
clipwait, 0
        clipboard:=trim(clipboard)
        clipboard={{Plr|%clipboard%}}
        sendinput, ^v
return

;alt-m          emdash —
!m::
        sendinput, {u+2014}
return

;alt-n          {{nop}}
!n::
        sendinput, {Home}
        sendinput, {raw}{{nop}}
return

;alt-o          {{rh||'' ''|}}
!o::
clipboard:=
    send, ^x+{tab}
        clipboard:=trim(clipboard)
        clipboard = `{`{rh||''%clipboard%''|`}`}
        sleep, 100
        send, ^v{end}   
        sleep, 100
        send, {end}{left 2}
return

;alt-p          {{rh||''THE POPULAR SCIENCE MONTHLY.''|}}
!p::
        sendinput, {raw}{{rh||''THE POPULAR SCIENCE MONTHLY.''|}}
        sendinput, {Home}{Right 5}
return

;alt-q          <ref></ref>
!q::
clipboard:=
        sendinput, <ref></ref>{left 6}
return

;alt-r          <ref>selected text</ref>
!r::
clipboard:=
autotrim, on
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=<ref>%selected%</ref>
        sendinput, ^v
return

;alt-s          {{sc|selected text}}
!s::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard={{sc|%selected%}}%A_space%
}
else
{
        selected:=trim(selected)
        clipboard={{sc|%selected%}}
}
        sendinput, ^v
return

;alt-t          {{ts|}}|
!t::
        sendinput, {raw}{{ts|}}|
        sendinput, {Left 3}
return

;alt-v          {{di|D}}rop initial at the beginning of the line
!v::
        sendinput, {Home}
        sendinput, {raw}{{di|
        sendinput, {Right}
        sendinput, {raw}}}
return

;alt-w          width=
!w::
        sendinput, width= {left}
return

;alt-y          ·
!y::
        sendinput, {Asc 0183}
return

;======================================

;alt-shift-0            <div style="">selected</div>
!+0::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:= trim(clipboard)
        clipboard=`<div style="text-align:center; padding:1em; font-size:100`%; letter-spacing:0px; font-family:serif; font-weight:600;"`>%selected%`</div`>
        sendinput, ^v
return

;alt-shift-a     {{color|red|''Arabic missing''}}
!+a::
        sendinput, {raw}{{color|red|''Arabic missing''}}
return

;alt-shift-b    <br />
!+b::
        sendinput, `<br `/`>
return

;alt-shift-h    {{he|}} hebrew
!+h::
        sendinput, {{}{{}he|{}}{}}{Left 2}
return

;alt-shift-g    {{color|red|''Greek missing''}}
!+g::
        sendinput, {raw}{{color|red|''Greek missing''}}
return

;alt-shift-l     reserved by Windows
!+l::
return

;alt-shift-w    {{PSM link|T|V|M&Y|author=}}
!+w::
        sendinput, {raw}{{PSM link|Title|Vol|Mo&Yr|author=}}
return

;======================================

;ctrl-\  re-load this edited and saved .ahk file
^\::
        Reload
return

;ctrl-b
^b::
return

;ctrl-i  Cleaned image and improved contrast
^i::
        sendinput, {raw}Cleaned image and improved contrast
return

;ctrl-j  Replaced Google copyright notice(s) with blank page(s)
^j::
        sendinput, {raw}Replaced Google copyright notice(s) with blank page(s)
return

;ctrl-k  {{sic}}
^k::
        sendinput, {raw}{{sic}}
return

;ctrl-m  <ce></ce>
^m::
        sendinput, `<ce`>`</ce`>{left 5}
return

;ctrl-p  {{ping|}}
^p::
        sendinput, {raw}{{ping|}}
        sendinput, {Left 2}
return

;======================================

;ctrl-shift-0           <div>selected text<div>
^+0::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=`<div`>%selected%`</div`>
        sendinput, ^v
return

;ctrl-shift-4   4 spaces
^+4::
        sendinput, %A_Space%%A_Space%%A_Space%%A_Space%
return

;ctrl-shift-8   {{fs85/s}}selected text{{fs85/e}}
^+8::
clipboard:=
sendinput, ^c
clipwait, 0
        clipboard={{fs85/s}}%clipboard%{{fs85/e}}
        sendinput, ^v
return

;ctrl-shift-9   {{fs90/s}}selected text{{fs90/e}}
^+9::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{fs90/s}}%selected%{{fs90/e}}
        sendinput, ^v
return

;ctrl-shift-b   |pb.5   {{ts    table style code
^+b::
        sendinput, `|pb.5`{left 5`}`{down`}
return

;ctrl-shift-f           {{fs||selected}}
^+f::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{fs|`%|%selected%}}
        sendinput, ^v{home}{right 5}
return

;ctrl-shift-i   [[selected text|selected text]]
^+i::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=`[`[wikt:%selected%|%selected%`]`]
        sendinput, ^v
return

;ctrl-shift-l   colspan=        ((ts    table style code
^+l::
        sendinput, colspan= {left}
return

;ctrl-shift-m   :-) smiley
^+m::
        sendinput, [[File:Biggrin-smiley.svg|15px]]
return

;ctrl-shift-n   Irfanview negative image - do not use

;ctrl-shift-o   Now Commons
^+o::
        sendinput, {raw}{{Now Commons}}
return

;ctrl-shift-p   <p>
^+p::
        sendinput, `n`<p`>`n
return

;ctrl-shift-s   possibly reserved by firefox display the code window
^+s::
return

;ctrl-shift-t   pt.5    {{ts    table style code
^+t::
        sendinput, `|pt.5`{left 5`}`{down`}
return

;ctrl-shift-w   rowspan=
^+w::
        sendinput, rowspan= {Left 1}
return

;ctrl-win-y     {Asc 0176} ° degree indicator 
^+y::
        sendinput, {Asc 0176}
return

;======================================

;win-'  Search for first "
#'::
clipclear:=
sleep, 500
        send, ^{Home}
        send, ^f
        send, ^a
        send, {Del}
sleep, 500
        send, "{esc}{right}+{left}
return

;win-down        {{hwe|
#down::
        sendinput, {Home}
        sendinput, {raw}{{hwe|
return

;win-up  {{hws|
#up::
        sendinput, {raw}{{hws|
        sendinput, {end}|
return

;win--          {{fs|%|{{sc|selected text}}}}
#-::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard={{fs|`%|{{sc|%selected%''}}}}%A_space%
}
else
{
        selected:=trim(selected)
        clipboard={{fs|105`%|{{sc|%selected%}}}}
}
        sendinput, ^v
return

;win-0          {{fs|%|''selected text''}}
#0::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard={{fs|`%|''%selected%''}}%A_space%
}
else
{
        selected:=trim(selected)
        clipboard={{fs|`%|''%selected%''}}
}
        sendinput, ^v
return

;win-1          <section end=E />
#1::
        sendinput, {Home}`<section begin=E `/`>{Left 3}
return

;win-2          <section end=E /><section begin=B />{Left 3}
#2::
        sendinput, `n
        sendinput, `<section end=E `/`>`<section begin=B `/`>
        sendinput, {Left 22}
return

;win-3          <section end=B />
#3::
        sendinput, `<section end=B `/`>{Left 3}
return

;win-8          {{fs85|selected text}} without centering
#8::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard={{fs85|%selected%}}%A_space%
}
else
{
        selected:=trim(selected)
        clipboard={{fs85|%selected%}}
}
        sendinput, ^v
return

;win-9          {{fs90|selected text}}
#9::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard={{fs90|%selected%}}
}
else
{
        selected:=trim(selected)
        clipboard={{fs90|%selected%}}
}
        sendinput, ^v
return

;win-a          {{anchor|D}}
#a::
        sendinput, {Home}
        sendinput, {raw}{{anchor|D}}
        sendinput, {Left 2}
return

;win-b          <b>selected text</b>
#b::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard=<b>%selected%</b>%A_space%
}
else
{
        selected:=trim(selected)
        clipboard=<b>%selected%</b>
}
        sendinput, ^v
return

;win-c          {{color|red / blue|selected text}}
#c::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=clipboard
        if (substr(selected, 0)=A_space)
        {
        selected:=trim(selected)
        clipboard={{color|blue|%clipboard%}}%A_space%
}
else
{
        selected:=trim(selected)
        clipboard={{color|blue|%clipboard%}}
}
        sendinput, ^v
return

;win-d          <div {{ts|width:480px;|ma|aj|sm85|lh11|it}}>selected text</div>
#d::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=`<div {{ts|width:470px;|ma|aj|sm85|`lh11|it}}`>`n%selected%`n`</div`>
        sendinput, ^v
return

;win-e          {{anchor|D}}
#e::
        sendinput, {raw}{{anchor|D}}
        sendinput, {Left 2}
return

;win-f          reserved by windows
#f::
return

;win-h          {{hi|selected text}}
#h::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{hi|%selected%}}
        sendinput, ^v
return

;win-i          {{SIC|selected text|selected text|}}
#i::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{SIC|%selected%|%selected%}}
        sendinput, ^v
return

;win-l          reserved by Windows, do not use
#l::return
return

;win-m          <!-- selected text -->
#m::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=`<!--%A_space%%selected%%A_space%--`>
        sendinput, ^v
return


;win-n           
#n::
        sendinput, {raw} 
return

;win-o          {{smaller|selected text}}
#o::
selected:=
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard={{smaller|%selected%}}
        sendinput, ^v
return

;win-p          <poem style="display:table; line-height:130%; font-size:90%; margin-left:auto; margin-right:auto; width:auto;">selected</poem>
#p::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=`<poem style="display:table; line-height:130`%; font-size:90`%; margin-left:auto; margin-right:auto; width:auto;"`>`n%selected%`n`<`/poem`>
        sendinput, ^v
return

;win-q
#q::
return

;win-r          {{right|selected text|2em}}
#r::
clipboard:=
        sendinput, {Home}
        sendinput, {raw}{{right|
        sendinput, {End}
        sendinput, {raw}|2em}}
return

;win-s          {{smallrefs}}
#s::
clipboard:=
        sendinput, ^a{Del}^{Home}
        sendinput, {{}{{}rule{}}{}}`n{{}{{}smallrefs{}}{}}`n
return

;win-t          {| {{ts|mc|sm85|lh11|ar|bc|bgt}} <!-- border -->
#t::
clipboard:=
sendinput, ^c
clipwait, 0
        clipboard=`{| `{`{ts|mc|sm85|lh11|ar|bc|bgt`}`} <!-- border -->
        sendinput, ^v
return

;win-u          <sup>selected text</sup>
#u::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=<sup>%selected%</sup>
        sendinput, ^v
return

;win-v          <sub>selected text</sub>
#v::
clipboard:=
sendinput, ^c
clipwait, 0
        selected:=trim(clipboard)
        clipboard=<sub>%selected%</sub>
        sendinput, ^v
return

;win-w
#w::
return

;win-z
#z::
return

;======================================

Proofread.ahk[edit]

Last update: — — Ineuw talk 22:39, 4 August 2016 (UTC)

  • The proofread script is assigned to the combination of he Alt + . keys, but any keyboard key, combinations of keys, or word typed on the keyboard, can be assigned to the user's preference.
  • This macro is in a separate file but linked to the Autohotkey.ahk by the #include declaration in the Autohotkey.ahk.

;Alt+. proofread
!.::

clipboard:=

autotrim, on

send, ^a^c

clipwait, 0     ;0 = slows clipboard action with a .5 second delay

;reduce two spaces to one
in_put:=A_Space . A_Space
out_put:=A_Space
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding a comma
in_put:=" ,"
out_put:=","
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding a period
in_put:=" ."
out_put:="."
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding a semicolon
in_put:=" \;"
out_put:=";"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;space preceeding a colon
in_put:=" :"
out_put:=":"
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding a question mark
in_put:=" \?"
out_put:="?"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding an exclamation mark
in_put:=" !"
out_put:="!"
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space following an open bracket
in_put:="( "
out_put:="("
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding a close bracket
in_put:=" )"
out_put:=")"
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove space preceeding a hyphen
in_put:=" -"
out_put:="-"
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;space following a hyphen
in_put:="- "
out_put:="-"
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;remove the caret
in_put:="`^"
out_put:=""
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;the word 'modem' to 'modern'
in_put:="modem"
out_put:="modern"
clipboard:=strreplace(clipboard, in_put, out_put)

clipwait, 0

;space preceeding a crlf
in_put:=" `r`n"
out_put:="`r`n"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;space following a crlf
in_put:="`r`n "
out_put:="`r`n"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;change three crlfs to two crlf
in_put:="`r`n`r`n`r`n"
out_put:="`r`n`r`n"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;two crlfs to ~~
in_put:="`r`n`r`n"
out_put:="~~"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;hyphen preceeding a crlf
in_put:="-`r`n"
out_put:=""
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;single crlf with space
in_put:="`r`n"
out_put:=" "
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;space and mdash
in_put:=chr(0x20)chr(0x2014)
out_put:=chr(0x2014)
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;mdash and space
in_put:=chr(0x2014)chr(0x20)
out_put:=chr(0x2014)
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;two tildes restore paragraph breaks
in_put:="~~"
out_put:="`r`n`r`n"
clipboard:=regexreplace(clipboard, in_put, out_put)

clipwait, 0

;two periods side by side
clipboard:=regexreplace(clipboard, "\.(?=\.)", ". ")
send, ^v^{Home}

sleep, 500

clipclear:=

sleep, 100
        send, ^{Home}
        send, ^f
        send, ^a
        send, {Del}
sleep, 100
        send, "{esc}{right}+{left}
return