User:Ineuw/AutoHotKey

From Wikisource
Jump to: navigation, search

AutoHotkey.ahk keyboard macros script file for proofreading - in Windows XP or Windows 7 - .

Last update: — 03:11, 21 September 2014 (UTC)

Keyboard key macro combinations[edit]

;Alt+'  italics ''selected text''
;Alt+0  {{c|{{x-larger|selected text}}}}
;Alt+1  single set }}
;Alt+2  double set }}}}
;Alt+3  triple set }}}}}}
;Alt+4  {{rule|4em}}
;Alt+5  double {{rule|65%}}
;Alt+6  {{rule|6em}}
;Alt+7  {{c|{{fs75|selected text}}}}
;Alt+8  {{c|{{fs85|selected text}}}}
;Alt+9  {{c|{{fs90|selected text}}}}
;Alt+Dn {{hwe|
;Alt+Numlock    {|{{ts|sm85|mc|lh1|ar|bc}}
;Alt+Up {{hws|
;Alt+a  [[Category:]]
;Alt+b  '''selected text'''
;Alt+c  {{c|selected text}}
;Alt+d  {{Dhr}}
;Alt+e  |
;Alt+f  image template for all images
;Alt+g  {{gap}}
;Alt+h  {{fs70|{{over||}}}}
;Alt+i  <i>selected text</i>
;Alt+k  |rowspan= {{ts|it}}|
;Alt+l  {{Plr|selected text}} - PSM literary review paragraph format
;Alt+m  —
;Alt+n  {{nop}}
;Alt+o  {{rh||'' ''|}}
;Alt+p  {{rh||''THE POPULAR SCIENCE MONTHLY''|}}
;Alt+r  {{right|selected text|2em}}
;Alt+s  {{sc|selected text}}
;Alt+t  {{ts|al}}|
;Alt+v  {{di|selected character}}
;Alt+w  width= 
;Alt+y  ·
;Win+1  <section begin=E />
;Win+2  <section end=B />
;Win+3  <section end=E /><section begin=B />{Left 3}
;Win+8  {{fs85|selected text}}
;Win+9  {{fs90|selected text}}
;Win+a  {{anchor|D}}
;Win+b  <b>selected text</b>
;Win+c  {{color|red|
;Win+d  <div>selected text</div>
;Win+e  run Explorer++
;Win+h  hanging indent|selected text
;Win+i  SIC|selected text|duplicates selected text}}
;Win+l  locks computer cannot be used in Windows 7
;Win+m  Neutralizes Windows super key
;Win+n   
;Win+o  {{smaller|selected text}}
;Win+p  {{block center/s}}{{fs90/s}}|<poem>selected text</poem>{{fs90/e}}{{block center/e}}
;Win+q  {{SUBPAGENAME}}
;Win+r  <ref>selected text</ref>
;Win+s  {{smallrefs}}
;Win+u  <sup>selected text</sup>
;Win+v  <sub>selected text</sub>
;Win+y  º
;Win+z  {{rh||{{smaller|}}|}}
;win+-  {{fs|105%|{{sc|selected text}}}}
;win+0  {{fs|105%|''selected text''}}
;AltShift+a     {{color|red|''Arabic missing''}}
;AltShift+b     <br />
;AltShift+h     {{he|}}
;AltShift+w     {{Psm link|art|vol|mo&yr|author=}}
;Ctrl+\         Reload this macro file
;Ctrl+i         Cleaned image and improved contrast
;Ctrl+m         <math></math>
;Ctrl+o         Popular Science Monthly/Contributors
;CtrlShift+b    neutralized
;CtrlShift+e    {{fs90/e}}
;CtrlShift+i    [[selected text|selected text]]
;CtrlShift+l    colspan= 
;CtrlShift+m    smiley
;CtrlShift+n    {{under construction}}
;CtrlShift+p    <p>
;CtrlShift+s    {{fs90/s}}
;CtrlShift+t    {{PSMTable}}
;CtrlShift+u    {{fs85|{{ua|note=.~~~~}}}}
;CtrlShift+w    rowspan= 
;CtrlShift+y    {Asc 0186} º

Keyboard macro script[edit]

#InstallMouseHook

AutoTrim, Off

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

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

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

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

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

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

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

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

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

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

;Alt+0  {{c|{{x-larger|selected text}}}}
!0::
clipboard =
Sendinput, ^c
clipwait, 1
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{c|{{x-larger|%Trimmed%}}}}
Sendinput, ^v
Return

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

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

;Alt+'  ''selected text''
!'::
clipboard =
send ^c
clipwait, 1
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 2}
Return

;Alt+b  '''selected text'''
!b::
clipboard =
send ^c
clipwait, 1
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  {{c|selected text}}
!c::
clipboard =
Sendinput, ^c
clipwait, 1
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  image template for all images
!f::
Sendinput, {Home}{{}{{}FIS{Enter}
Sendinput, {Home} | cstyle       = margin-top:8px;margin-bottom:8px; <{!}-- no dhr needed -->{Enter}
Sendinput, {Home} | file         = {Enter}
Sendinput, {Home} | width        = 430px|215px <{!}-- 430px is page width -->{Enter}
Sendinput, {Home} | float        = center|left|right <{!}-- One of the three -->{Enter}
Sendinput, {Home} | caption      = {Enter}
Sendinput, {Home} | talign       = center|justify <{!}-- One of the two -->{Enter}
Sendinput, {Home} | tstyle       = font-variant:small-caps;{Enter}
Sendinput, {Home} | margin-right = 8px <{!}-- if floating to the left -->{Enter}
Sendinput, {Home} | margin-left  = 8px <{!}-- if floating to the right -->{Enter}
Sendinput, {Home} | tmleft       = 11px <{!}-- For Caption Indent when justified -->{Enter}
Sendinput, {Home} | indent       = -11px <{!}-- For Caption outdent when justified -->{Enter} 
Sendinput, {Home}{}}{}}
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, 1
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = <i>%Trimmed%</i>
Sendinput, ^v
Return

;Alt+k  |rowspan= {{ts|it}}|
!k:: Sendinput, |rowspan= {{}{{}ts|it{}}{}}|{Left 11}
Return

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

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

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

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

;Alt+p  {{rh||''THE POPULAR SCIENCE MONTHLY''|}}
!p:: Sendinput, {{}{{}rh||''THE POPULAR SCIENCE MONTHLY.''|{}}{}}{Home}{Right 5}
Return

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

;Alt+s  {{sc|selected text}}
!s::
clipboard =
Sendinput, ^c
clipwait, 1
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+v  {{di|selected character}}
!v:: Sendinput, {Home}{{}{{}di|{Right}{}}{}}
Return

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

;Alt+y  ·
!y:: Sendinput, {Asc 0183}
Return

;Alt+z  
!z:: Sendinput, {raw}{{DEFAULTSORT:}}


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

;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, {{}{{}PSM rule{}}{}}
Sendinput, {Enter}1
Sendinput, `<section end=E `/`>`<section begin=B `/`>
Sendinput, {Left 22}
Return

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

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

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

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

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

;Win+b  <b>selected text</b>
#b::
clipboard =
send ^c
clipwait, 1
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  {{color|red|
#c::
clipboard =
Sendinput, ^c
clipwait, 1
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = {{color|red|%Trimmed%}}
Sendinput, ^v
Return

;Win+d  <div>selected text</div>
#d::
clipboard =
send ^c
clipwait, 1
varDiv := clipboard
varDiv := Trim(varDiv)
clipboard = <div {{ts|width:400px;|aj|it|sm85|lh1|pb1}}>%varDiv%</div>
Sendinput, ^v
Return

;Win+e  run Explorer++
#e::
try {
    Run T:\Software\Explorer++\Explorer++.exe
} catch e {
  MsgBox Couldn't run Explorer++.`nPlease make sure it's in the same directory as this script (%A_ScriptDir%).
}
Return

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

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

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

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

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

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

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

;Win+q  {{SUBPAGENAME}}
#q:: Sendinput, {raw}{{SUBPAGENAME}}
Return

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

;Win+s  {{smallrefs}}
;~#s:: Sendinput, {{}{{}rule{}}{}}{Enter}{{}{{}smallrefs{}}{}}
;~#s:: Sendinput, {raw}{{block-center|{{smallrefs}}}}
#s:: Sendinput, {{}{{}smallrefs{}}{}}
Return

;Win+t
#t:: SendInput, {{}|{{}{{}ts|sm85|mc|lh1|ar|bc{}}{}}     <{!}-- border -->
Return

;Alt+Numlock    {|{{ts|sm85|mc|lh1|ar|bc}}
!Numlock:: Sendinput, {raw}{|{{ts|sm85|mc|lh1|ar|bc`}`}    <{!}-- border -->
Return

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

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

;Win+y  º
#y::
Sendinput, {Asc 0186}
Return

;Win+z  {{rh||{{smaller|}}|}}
#z::
clipboard =
Sendinput, ^c
clipwait, 1
lower := clipboard
StringUpper, Upper, lower
clipboard = {{rh||{{smaller|}}|}}
Sendinput, ^v{Home}{Right 5}
Return

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

;Ctrl+\ Reload this macro file
^\::Reload

;Ctrl+i Cleaned image and improved contrast
^i:: Sendinput, {raw}Cleaned image and improved contrast
Return

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

;Ctrl+o Popular Science Monthly/Contributors
^o:: Sendinput, {raw}Popular Science Monthly/Contributors
Return

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

;AltShift+a     {{color|red|''Arabic missing''}}
!+a:: Sendinput, {raw}{{color|red|''Arabic missing''}}
Return

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

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

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

;AltShift+w     {{Psm link|art|vol|mo&yr|author=}}
!+w:: Sendinput, {{}{{}PSM link|T|V|M&Y|author={}}{}}
Return

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

;CtrlShift+b    neutralized
^+b::
Return

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

;CtrlShift+i    [[selected text|selected text]]
^+i::
clipboard =
Sendinput, ^c
clipwait, 1
Trimmed := clipboard
Trimmed := Trim(Trimmed)
clipboard = [[%Trimmed%|%Trimmed%]]
Sendinput, ^v
Return

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

;CtrlShift+m    smiley
^+m:: Sendinput, [[File:Face-smile.svg|20px]]
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    {{fs85|{{ua|note=.~~~~}}}}
^+u:: Sendinput, {{}{{}fs85|{{}{{}ua|note=.~~~~}}}}{}}{}}{}}{}}
Return

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

;CtrlShift+y    {Asc 0186} º
^+y:: Sendinput, {Asc 0186}
Return

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