User:Ineuw/AutoHotKey

From Wikisource
Jump to: navigation, search
AutoHotkey.ahk keyboard macros script file for proofreading - in Windows OS.

Last update: — — Ineuw talk 20:05, 13 October 2013 (UTC)

Keyboard key combinations
;Alt+'  italicize selected text
;Alt+1  single set of closing }
;Alt+2  double set of closing }
;Alt+3  triple set of closing }
;Alt+4  rule|4em
;Alt+5  rule|65%
;Alt+6  rule|6em
;Alt+7  center fs75|selected text
;Alt+8  center fs85|selected text
;Alt+9  center fs90|selected text
;Alt+Dn hwe|
;Alt+End        Delete row
;Alt+Up hws|
;Alt+a  Category:|
;Alt+b  bold selected text
;Alt+c  center|selected text
;Alt+d  Dhr
;Alt+e  |
;Alt+f  centered image template
;Alt+g  gap
;Alt+h  fs70 over||
;Alt+i  <i>selected text</i>
;Alt+j  Author
;Alt+l  Left|selected text|2em
;Alt+m  em dash
;Alt+n  nop
;Alt+o  RunningHeader||italicised text|
;Alt+p  RunningHeader|''THE POPULAR SCIENCE MONTHLY.''
;Alt+r  Right|selected text|2em
;Alt+s  small capitals|selected text
;Alt+t  ts|al
;Alt+u  Pt|Article title|
;Alt+v  drop initial
;Alt+w  width= 
;Alt+x  rh||smaller|.|
;Alt+y  °
;Alt+z  PSMPage1Title3|
;AltShift+a     arabic missing
;AltShift+b     br
;AltShift+h     he Hebrew
;Ctrl+\ Reload this document
;Ctrl+m <math>\scriptstyle </math>
;Ctrl+q SUBPAGENAME
;CtrlShift+e    fs90/e
;CtrlShift+i    in use
;CtrlShift+j    justify 430px fs85 sc
;CtrlShift+l    colspan=
;CtrlShift+n    under construction
;CtrlShift+p    <p>
;CtrlShift+s    fs90/s
;CtrlShift+t    PSMTable
;CtrlShift+u    user annotation
;CtrlShift+w    rowspan=
;CtrlShift+z    · {Asc 0183}
;Win+8  fs85|selected text
;Win+9  fs90|selected text
;Win+a  anchor|
;Win+b  <b>Bold selected text</b>
;Win+c  sic
;Win+f  complete image template used for floating images
;Win+h  hanging indent|selected text
;Win+i  SIC|selected text|duplicates selected text
;Win+l  Plr|selected text - PSM literary review paragraph format
;Win+m  Neutralizes Windows super key
;Win+n  nbsp
;Win+p  float-center|<poem>selected text
;Win+r  <ref>selected text</ref>
;Win+s  rule and smallrefs
;Win+t  table definition
;Win+u  <sup>selected text</sup>
;Win+v  <sub>selected text</sub>
;win+-  fs|105%|{{small case|selected text
;win+0  fs|105%|italicise selected text
;win+1  <section begin=E />
;win+2  <section end=B />
;win+3  <section end=E /><section begin=B />{Left 3}


Keyboard macro coding
AutoTrim, Off

;Alt+End        Delete row
!End::
Send, {Home}
Send, {Shift Down}
Send, {End}
Send, {Shift Up}
Send, {Delete 2}
Return

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

;Alt+1  single set of closing }
!1:: Sendinput, {}}{}}
Return

;Alt+2  double set of closing }
!2:: Sendinput, {}}{}}{}}{}}
Return

;Alt+3  triple set of closing }
!3:: Sendinput, {}}{}}{}}{}}{}}{}}
Return

;Alt+4  rule|4em
!4:: Sendinput, {Home}{Return}{{}{{}Dhr{}}{}}{Return}{Return}{{}{{}rule|4em{}}{}}{Return}{Return}{{}{{}Dhr{}}{}}{Return}
Return

;Alt+5  rule|65%
!5:: Sendinput, {raw}{{rule|65`%}}
Return

;Alt+6  rule|6em
!6:: Sendinput, {raw}{{rule|12em}}
Return

;Alt+7  center fs75|selected text
!7::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{c|{{fs75|%Trimmed%}}}}
Sendinput, ^v
Return

;Alt+8  center fs85|selected text
!8::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{c|{{fs85|%Trimmed%}}}}
Sendinput, ^v
Return

;Alt+9  center fs90|selected text
!9::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{c|{{fs90|%Trimmed%}}}}
Sendinput, ^v
Return

;Alt+Dn hwe|
!Down:: Sendinput, {raw}{{hwe|
Return

;Alt+Up hws|
!Up:: Sendinput, {raw}{{hws|
Return

;Alt+'  italicize selected text
!'::
clipboard =
send ^c
clipwait, 2
varItalics := clipboard
        if SubStr(varItalics, 0, 1)= Chr(32) {
        varItalics := Trim(varItalics)
        clipboard = ''%varItalics%''%A_Space%
}
Else
{
        varItalics := Trim(varItalics)
        clipboard = ''%varItalics%''
}

Sendinput, ^v
Return

;Alt+a  Category:|
!a:: Sendinput, [[Category:|]]{Left 3}
Return

;Alt+b  bold selected text
!b::
clipboard =
send ^c
clipwait, 2
varBold := clipboard
        if SubStr(varBold, 0, 1)= Chr(32) {
        varBold := Trim(varBold)
        clipboard = '''%varBold%'''%A_Space%
}
Else
{
        varBold := Trim(varBold)
        clipboard = '''%varBold%'''
}

Sendinput, ^v
Return

;Alt+c  center|selected text
!c::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{c|%Trimmed%}}
Sendinput, ^v
Return

;Alt+d  Dhr
!d:: Sendinput, {Home}{raw}{{Dhr}}
Return

;Alt+e  |
!e:: Sendinput, {Home}|{Down}{Home}
Return

;Alt+f  centered image template
!f::
Sendinput, {Home}{{}{{}Dhr{}}{}}{Enter}
Sendinput, {Home}{{}{{}FI{Enter}
Sendinput, {Home} | file    = {Enter}
Sendinput, {Home} | width   = 400px{Enter}
Sendinput, {Home} | caption = {Enter}
Sendinput, {Home} | talign  = center.justify{Enter}
Sendinput, {Home} | tstyle  = font-variant:small-caps;{Enter}
Sendinput, {Home}{}}{}}{Enter}
Sendinput, {Home}{{}{{}Dhr{}}{}}
Return

;Alt+g  gap
!g:: Sendinput, {raw}{{gap}}
Return

;Alt+h  fs70 over||
!h::
Sendinput, {raw}{{fs70|{{over||}}}}
Sendinput, {Left 5}
Return

;Alt+i  <i>selected text</i>
!i::
clipboard =
send ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = <i>%Trimmed%</i>
Sendinput, ^v
Return

;Alt+j  Author
!j::
Sendinput, {Home}{raw}{{c|
Sendinput, {raw}{{fs90|
Sendinput, {raw}{{sc|
Sendinput, {End}
Sendinput, {raw}}}}}}}
Sendinput, {Home}
Return

;Alt+l  Left|selected text|2em
!l:: Sendinput, {Home}{{}{{}left|{End}{raw}|2em}}
Return

;Alt+m  em dash
!m:: Sendinput, {Asc 0151}
Return

;Alt+n  nop
!n:: Sendinput, {Home}{{}{{}nop{}}{}}
Return

;Alt+o  RunningHeader||italicised text|
!o:: Sendinput, {{}{{}rh||'' ''|{}}{}}{Left 2}
Return

;Alt+p  RunningHeader|''THE POPULAR SCIENCE MONTHLY.''
!p:: Sendinput, {{}{{}rh||''THE POPULAR SCIENCE MONTHLY.''|{}}{}}{Left 36}
Return

;Alt+r  Right|selected text|2em
!r:: Sendinput, {Home}{{}{{}right|{End}{raw}|2em}}
Return

;Alt+s  small capitals|selected text
!s::
clipboard =
Sendinput, ^c
clipwait, 2
varSmallCaps := clipboard
        if SubStr(varSmallCaps, 0, 1)= Chr(32) {
        varSmallCaps := Trim(varSmallCaps)
        clipboard = {{sc|%varSmallCaps%}}%A_Space%
}
Else
{
        varSmallCaps := Trim(varSmallCaps)
        clipboard = {{sc|%varSmallCaps%}}
}

Sendinput, ^v
Return

;Alt+t  ts|al
!t:: Sendinput, {raw}{{ts|al}}|
Return

;Alt+u  Pt|Article title|
!u:: Sendinput, {Home}{{}{{}Pt|{End}|}}
Return

;Alt+v  drop initial
!v:: Sendinput, {Home}{{}{{}di|{Right}}}
Return

;Alt+w  width= 
!w:: Sendinput, width= {Left 1}

;Alt+x  rh||smaller|.|
!x:: Sendinput, {{}{{}rh||{{}{{}smaller|.{}}{}}|{}}{}}{Left 2}
Return

;Alt+y  °
!y:: Sendinput, {raw}°
Return

;Alt+z  PSMPage1Title3|
!z:: Sendinput, {Home}{{}{{}PSMPage1Title3|{End}{}}{}}
Return

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

;win+1  <section begin=E />
#1:: Sendinput, {Home}`<section begin=E `/`>{Left 3}
Return

;win+2  <section end=B />
#2:: Sendinput, ^{End}`<section end=B `/`>{Left 3}
Return

;win+3  <section end=E /><section begin=B />{Left 3}
#3::
Sendinput, {raw}{{Dhr}}
Sendinput, {Enter}
Sendinput, {raw}{{PSM rule}}
Sendinput, {Enter}
Sendinput, `<section end=E `/`>`<section begin=B `/`>
Sendinput, {Left 22}
Return

;Win+8  fs85|selected text
#8::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{fs85|%Trimmed%}}
Sendinput, ^v
Return

;Win+9  fs90|selected text
#9::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{fs90|%Trimmed%}}
Sendinput, ^v
Return

;win+0  fs|105%|italicise selected text
#0::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{fs|105`%|''%Trimmed%''}}
Sendinput, ^v
Return

;win+-  fs|105%|{{small case|selected text
#-::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{fs|105`%|{{sc|%Trimmed%}}}}
Sendinput, ^v
Return

;Win+a  anchor|
#a:: Sendinput, {Home}{{}{{}anchor|D{}}{}}{Left 2}
Return

;Win+b  <b>Bold selected text</b>
#b::
clipboard =
send ^c
clipwait, 2
varBold := clipboard
        if SubStr(varBold, 0, 1)= Chr(32) {
        varBold := Trim(varBold)
        clipboard = <b>%varBold%</b>%A_Space%
}
Else
{
        varBold := Trim(varBold)
        clipboard = <b>%varBold%</b>
}

Sendinput, ^v
Return

;Win+c  sic
#c:: Sendinput, {raw}{{sic}}
Return

;Win+f  complete image template used for floating images
#f::
Sendinput, {Home}{{}{{}FI{Enter}
Sendinput, {Home} | file         = {Enter}
Sendinput, {Home} | width        = 215px{Enter}
Sendinput, {Home} | caption      = {Enter}
Sendinput, {Home} | talign       = center.justify{Enter}
Sendinput, {Home} | tstyle       = font-variant:small-caps;{Enter}
Sendinput, {Home} | float        = left.right{Enter}
Sendinput, {Home} | margin-left  = 8px{Enter}
Sendinput, {Home} | margin-right = 8px{Enter}
Sendinput, {Home} | mleft        = 2em{Enter}
Sendinput, {Home} | indent       = -2em{Enter}
Sendinput, {Home}{}}{}}
Return

;Win+h  hanging indent|selected text
#h:: 
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{hi|%Trimmed%}}
Sendinput, ^v
Return

;Win+i  SIC|selected text|duplicates selected text
#i::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{SIC|%Trimmed%|%Trimmed%}}
Sendinput, ^v
Return

;Win+l  Plr|selected text - PSM literary review paragraph format
#l:: 
clipboard =
Sendinput, ^c
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{Plr|%Trimmed%}}
Sendinput, ^v
Return

;Win+m  Neutralizes Windows super key
#m::
Return

;Win+n   
#n:: Sendinput, {raw} 
Return

;Win+p  float-center|<poem>selected text
#p::
clipboard =
send ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{float-center|`<poem`>`n{{fs90/s}}%Trimmed%{{fs90/e}}`<`/poem`>}}
Sendinput, ^v
Return

;Win+r  <ref>selected text</ref>
#r::
clipboard =
send ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = `<ref`>%Trimmed%`<`/ref`> 
Sendinput, ^v
Return

;Win+s  rule and smallrefs
#s:: Sendinput, {{}{{}rule{}}{}}{Enter}{{}{{}smallrefs{}}{}}
Return

;Win+t  table definition
#t:: Sendinput, {{}|align=center {{}{{}ts|sm85|ar|bc|lh1{}}{}}
Return

;Win+u  <sup>selected text</sup>
#u::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = `<sup`>%Trimmed%`</sup`>
Sendinput, ^v
Return

;Win+v  <sub>selected text</sub>
#v::
clipboard =
Sendinput, ^c
clipwait, 2
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = `<sub`>%Trimmed%`</sub`>
Sendinput, ^v
Return

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

;Ctrl+\ Reload this document
^\::Reload

;Ctrl+m <math>\scriptstyle </math>
^m:: Sendinput, <math>\scriptstyle </math>{Left 7}
Return

;Ctrl+q SUBPAGENAME
^q:: Sendinput, {raw}{{SUBPAGENAME}}
Return

;======================================
;AltShift+a     arabic missing
!+a:: Sendinput, {raw}{{arabic missing}}
Return

;AltShift+b     br
!+b:: Sendinput, `<br `/`>
Return

;AltShift+h     he Hebrew
!+h:: Sendinput, {{}{{}he|{}}{}}{Left 2}
Return

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

;CtrlShift+e    fs90/e
^+e:: Sendinput, {raw}{{fs90/e}}
Return

;CtrlShift+i    in use
^+i:: Sendinput, {raw}{{in use}}
Return

;CtrlShift+j    justify 430px fs85 sc
^+j:: Sendinput, {raw}{{justify|width=430px|{{fs85|{{sc|
Return

;CtrlShift+l    colspan=
^+l:: Sendinput, colspan= {Left 1}
Return

;CtrlShift+n    under construction
^+n:: Sendinput, {raw}{{under construction}}
Return

;CtrlShift+p    <p>
^+p:: Sendinput, {raw}<p>
Return

;CtrlShift+s    fs90/s
^+s:: Sendinput, {raw}{{fs90/s}}
Return

;CtrlShift+t    PSMTable
^+t:: Sendinput, {raw}{{PSMTable}}
Return

;CtrlShift+u    user annotation
^+u:: Sendinput, {{}{{}fs85|{{}{{}ua|note=hyphenated word was joined on the previous page because of the intervening image.~~~~}}}}{}}{}}{}}{}}
Return

;CtrlShift+w    rowspan=
^+w:: Sendinput, rowspan= {Left 1}
Return

;CtrlShift+z    · {Asc 0183}
^+z:: Sendinput, {Asc 0183}
Return