User:Ineuw/Windows AutoHotKey Scripts

From Wikisource
Jump to navigation Jump to search


Introduction[edit]

Last updated: — — Ineuw (talk) 19:17, 17 December 2019 (UTC)

  • Autohotkey.ahk is the main 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 (sub) file called by 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 are 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 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) 19:25, 17 December 2019 (UTC)

This lists the current keyboard key assignments. No uppercase characters used to activate macros.

;alt+'                         italicise selected text
;alt+.                         DO NOT USE, assigned to the 'eng-pr.ahk' text format script.
;alt+=                         emdash
;alt+0                         {{fs|150%|selected}}
;alt+1                         insert template end braces }}
;alt+2                         {{bar|2}} replacement for two or more emdashes
;alt+3                         {{brace2|2|l}} graphic curly braces
;alt+4                         {{fqm}} floating quotation mark
;alt+5                         insert 15% page width, enclosed by two {{Dhr}}
;alt+7                         {{c|{{fs75|selected text}}}}
;alt+8                         {{c|{{fs85|selected text}}}}
;alt+9                         {{c|{{fs90|selected text}}}}
;alt+a                         UNASSIGNED
;alt+b                         bold selected text using wiki markup
;alt+backspace                 DO NOT USE
;alt+c                         center selected text template
;alt+d                         double height row surrounded by a newline
;alt+del                       UNASSIGNED
;alt+e                         inserts vertical bar for table cell row
;alt+end                       insert {{fs90/s}} in header and {{fs90/e}} in the footer
;alt+f                         image container
;alt+f1                        strips space from the end of row
;alt+f12                       DO NOT USE - ASSIGNED to italics.ahk
;alt+f4                        UNASSIGNED
;alt+f5                        UNASSIGNED
;alt+g                         inserts a variable gap in text
;alt+h                         {{fs|80`%|{{frac||}}}} for reduced font-size fractions
;alt+i                         italicize <i>selected text<`/i>
;alt+j                         {{float left|selected text|2em}}
;alt+k                         |ptb.5  {{ts|table style code}} pad top and pad bottom .5 em
;alt+l                         {{Plr|selected text}}
;alt+m                         <math>`\<`/math>
;alt+n                         {{nop}}
;alt+o                         copy title from 1st line to the header with page number on the right
;alt+p                         copy title from 1st line to the header with page number on the left
;alt+pgdn                      format subscript in <math></math>
;alt+pgup                      format superscript in <math></math>
;alt+q                         USED by TextPad
;alt+r                         create reference tags and move cursor between the <ref></ref>
;alt+s                         small case selected text
;alt+shift+0                   <div style = > </div> with serif font code
;alt+shift+1                   UNASSIGNED
;alt+shift+2                   UNASSIGNED
;alt+shift+3                   UNASSIGNED
;alt+shift+4                   UNASSIGNED
;alt+shift+5                   chr(0146) ’ minutes
;alt+shift+6                   chr(148) ” seconds
;alt+shift+7                   insert 50% page width double rule, enclosed by two {{Dhr}}
;alt+shift+9                   title case selected text
;alt+shift+a                   chr(0225) á
;alt+shift+b                   inserts |pb.5 pad bottom .5em table style code}}
;alt+shift+c                   chr(0231) ç
;alt+shift+e                   chr(0233) é
;alt+shift+i                   chr(0237) í
;alt+shift+l                   inserts |pl.5 {{ts|pad left .5em table style code}}
;alt+shift+m                   UNASSIGNED
;alt+shift+n                   chr(0241) ñ
;alt+shift+o                   chr(0243) ó
;alt+shift+p                   PREVIEW KEY IN WIKIMEDIA SOFTWARE
;alt+shift+r                   inserts |pr.5 {{ts|pad right .5em table style code}}
;alt+shift+s                   SAVE KEY of Wikimedia SOFTWARE in Firefox
;alt+shift+t                   inserts |pt.5 {{ts|pad top .5em table style code}}
;alt+shift+u                   chr(0250) ú
;alt+t                         created {{ts|}}| for table style code input
;alt+u                         UNASSIGNED
;alt+v                         {{di|D}}rop initial at the beginning of the line
;alt+w                         width = table style code
;alt+x:                        save wikisource edit in firefox
;alt+y                         character spacing {{sp|selected text}}
;alt+z                         add an empty row between two rows
;ctrl+\                        reload script
;ctrl+a                        DO NOT USE - 'SELECT ALL' IN ALL OPERATING SYSTEMS
;ctrl+alt+l                    lowercase selected text
;ctrl+alt+p                    {{ping|}}
;ctrl+alt+t                    title case selected text
;ctrl+alt+u                    uppercase selected text
;ctrl+b                        <br />
;ctrl+c                        DO NOT USE - 'COPY' IN ALL OPERATING SYSTEMS
;ctrl+k                        {{sic}}
;ctrl+l                        lowercase selected text in Textpad
;ctrl+m                        <math>selected</math>
;ctrl+numpad1                  ALTERNATIVE TO THE 'End' KEY WHEN LAPTOP NUMPAD IS ON
;ctrl+numpad7                  ALTERNATIVE TO THE 'Home' KEY WHEN LAPTOP NUMPAD IS ON
;ctrl+p                        `n<p>`n
;ctrl+s                        DO NOT USE - 'SAVE' KEY IN ALL OPERATING SYSTEMS
;ctrl+Shift+1                  UNASSIGNED
;ctrl+Shift+2                  UNASSIGNED
;ctrl+Shift+3                  UNASSIGNED
;ctrl+shift+4                  inserts 4 spaces (instead of tab)
;ctrl+Shift+5                  UNASSIGNED
;ctrl+Shift+6                  UNASSIGNED
;ctrl+shift+8                  {{fs85`/s}}selected text{{fs85`/e}}
;ctrl+Shift+8                  UNASSIGNED
;ctrl+shift+9                  {{fs90`/s}}selected text{{fs90`/e}}
;ctrl+shift+i                  wiki link to wikionary or wikipedia
;ctrl+shift+l                  colspan = (table style code)
;ctrl+shift+n                  DO NOT USE - Irfanview switch to negative image key
;ctrl+shift+p                  {{Page break|label=|border-width=2px|border-style=solid|border-color=#6479FF}}
;ctrl+shift+r                  DO NOT USE - RESERVED BY FIREFOX
;ctrl+shift+s                  DO NOT USE - RESERVED BY FIREFOX
;ctrl+shift+t                  insert<></>
;ctrl+shift+v                  RESERVED BY WINDOWS
;ctrl+shift+w                  rowspan = (table code)
;ctrl+shift+y                  chr(0176) ° degree indicator
;ctrl+v                        DO NOT USE - 'PASTE' KEY IN ALL OPERATING SYSTEMS
;ctrl+x                        DO NOT USE - 'CUT SELECTED' KEY IN ALL OPERATING SYSTEMS
;ctrl+z                        DO NOT USE - REVERT LAST ACTION IN ALL OPERATING SYSTEMS
;shift+esc                     paragraph line height and font size templates combined
;win+'                         edit to search for floating single or double quote
;win+0                         <div>selected</div>
;win+1                         <section end = E `/>
;win+2                         <section end = E `/><section begin = B `/>{Left 3}
;win+3                         <section end = B `/>
;win+4                         UNASSIGNED
;win+5                         UNASSIGNED
;win+6                         UNASSIGNED
;win+7                         {{under construction}}  {{removed existing}}
;win+8                         {{fs85|selected text}} without centering
;win+9                         {{fs90|selected text}} without centering
;win+a                         {{anchor|D}} at the left margin
;win+b                         HTML bold <b>selected text<`/b>
;win+c                         {{c|''selected text''}} center and italicize selected text
;win+d                         block of text <div {{ts|width:500px;|mc|ac|sm85|lh11|pb.5}}>selected text<`/div>
;win+down                      inserts {{hwe| at the beginning of a row
;win+e                         {{anchor|D}} any place in the text
;win+f                         DO NOT USE RESERVED BY WINDOWS FOR FEEDBACK
;win+g                         {{c|sc|selected text}}
;win+h                         hanging indent
;win+i                         {{SIC|selected text|selected text|}}
;win+j                         {{float right|selected text|2em}}
;win+k                         search and remove caret
;win+l                         DO NOT USE, WINDOWS LOCK
;win+m                         <!-- comments out selected text -->
;win+n                          
;win+numpad1                   ALTERNATIVE TO THE 'Shift+End' KEY WHEN LAPTOP NUMPAD IS ON
;win+numpad7                   ALTERNATIVE TO THE 'Shift+Home' KEY WHEN LAPTOP NUMPAD IS ON
;win+o                         {{cdm||}}
;win+p                         <poem style = ""</poem>
;win+q                         {{sm|selected text}}
;win+r                         <ref></ref>
;win+s                         insert in footer {{rule}}\n{{smallrefs}}
;win+t                         table and style definition {| {{ts|bt|bb|mc|sm85|lh11|ar|bc|bgt}}
;win+u                         superscript selected text
;win+up                        encloses hyphenated text start with {{hws| - place at the end of line and activate
;win+v                         subscript <sub>selected text<`/sub>
;win+w                         for Wikisource images {{Do not move to Commons}}
;win+x                         WINDOWS MENU WHEN WINDOWS SHORTCUTS ARE ENABLED. Disabled with UWTweaks
;win+z                         z
;mbutton                       switch to newly opened tab

Autohotkey.ahk[edit]

;2020-03-27 2:11 PM UTC-4

;D:\ahk\eng.ahk

; english desktop version, numpad navigation keys are disabled
; english laptop version, numpad navigation keys are enabled

SetWorkingDir, D:\ahk

#include d:\ahk\eng_pr.ahk
#installkeybdhook
#noenv
#singleinstance force
#warn

SetTimer, AutoReload, 50000

~lwin::vk07
~rwin::return
~appskey::return
~#bs::return

; test keys =======================================================

;~'                           generate ''
;~'::
;	clipboard := ""
;	sendinput, '
return

; alt =============================================================

;alt+backspace                 DO NOT USE

;alt+f1                        strips space from the end of row
!f1::
	clipboard := ""
	autotrim, on
	send, ^a^c			       ; select everything on the page
	clipwait, 1
	in_put := " `r`n"          ; space preceeding crlf
	out_put := "`r`n"
	clipboard := regexreplace(clipboard, in_put, out_put)
	clipwait, 1
	send, ^v
	send, ^{Home}
return

;alt+f4                        UNASSIGNED
;!f4::
	clipboard := ""
return

;alt+f5                        UNASSIGNED
!f5::
	clipboard := ""
return

;alt+f12                       DO NOT USE - ASSIGNED to italics.ahk

;alt+pgup                      format superscript in <math></math>
!pgup::
	autotrim, on
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected= trim(clipboard)
	sendinput, {asc 0094}
	sendinput, %clipboard%
return

;alt+pgdn                      format subscript in <math></math>
!pgdn::
	autotrim, on
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected= trim(clipboard)
	sendinput, {asc 0095}
	sendinput, %clipboard%
return

;alt+del                       UNASSIGNED

;alt+end                       insert {{fs90/s}} in header and {{fs90/e}} in the footer
!end::
	clipboard := ""
	sendinput, {text}<div {{ts|sm90|lh11|aj}}>
	clipwait, 0
	sendinput, {tab 2}
	sendinput, {text}{{div end}}`n
	sendinput, +{tab}
	sendinput, ^{home}
return

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

;alt+.                         DO NOT USE, assigned to the 'eng-pr.ahk' text format script.

;alt+=                         emdash
!=::
	clipboard := ""
	sendinput, %A_Space%{u+2014}%A_Space%
return

;alt+0                         {{fs|150%|selected}}
!0::
	autotrim, off
	clipboard := ""
	sendinput, {home}+{end}
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard = {{fs|150`%|%selected%}}%A_space%
	}
	else
	{
	selected := trim(selected)
	clipboard = {{fs|150`%|%selected%}}
	}
	sendinput, ^v
	sendinput, {Home}
	sendinput, {right 5}
return

;alt+1                         insert template end braces }}
!1::
	clipboard := ""
	sendinput, {text}}}
return

;alt+2                         {{bar|2}} replacement for two or more emdashes
!2::
	clipboard := ""
	sendinput, {text}{{bar|2}}
return

;alt+3                         {{brace2|2|l}} graphic curly braces
!3::
	clipboard := ""
	sendinput, {text}{{brace2|2|l}}
	sendinput, {left 3}
return

;alt+4                         {{fqm}} floating quotation mark
!4::
	clipboard := ""
	sendinput, {text}{{fqm}}
return

;alt+5                         insert 15% page width, enclosed by two {{Dhr}}
!5::
	clipboard := ""
	sendinput, {home}
	sendinput, {text}`n
	sendinput, {text}{{Dhr}}
	sendinput, {text}`n`n
	sendinput, {raw}{{rule|15`%}}
	sendinput, {text}`n`n
	sendinput, {text}{{Dhr}}
	sendinput, {text}`n
return

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

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

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

;alt+a                         UNASSIGNED
	clipboard := ""
;!a::
return

;alt+b                         bold selected text using wiki markup
!b::
	clipboard := ""
	selected := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard := %selected%
	sendinput, ^v
return

;alt+c                         center selected text template
!c::
	clipboard := ""
	selected := ""
	sendinput, ^x
	clipwait, 1
	selected := trim(clipboard)
	clipboard := "{{c|" . %selected% . "}}"
	sendinput, ^v
return

;alt+d                         double height row surrounded by a newline
!d::
	clipboard := ""
	sendinput, {Home}`n
	sendinput, {text}{{Dhr}}`n
return

;alt+e                         inserts vertical bar for table cell row
!e::
	sendinput, {Home}|{Down}
return

;alt+f                         image container
!f::
	clipboard := ""
	autotrim, off
	sendinput, {home}{{}{{}FI `n{home}{space}
	sendinput, | file         = `n{home}{space}
	sendinput, | width        = 500px`n{home}{space}
	sendinput, | cstyle       = margin-top:10px`; margin-bottom:10px`n{home}{space}
;	sendinput, | float        = left|right`n{home}{space}
;	sendinput, | margin-right = 7px`n{home}{space}
;	sendinput, | margin-left  = 7px`n{home}{space}
	sendinput, | tstyle       = padding-top:.4em;  font-variant: small-caps; `n{home}{space}
	sendinput, | talign       = center`n{home}{space}
	sendinput, | caption      = `n{home}
	sendinput, {}}{}}`n{home}
return

;alt+g                         inserts a variable gap in text
!g::
	clipboard := ""
	sendinput, {text}{{gap}}
return

;alt+h                         {{fs|80`%|{{frac||}}}} for reduced font-size fractions
!h::
	clipboard := ""
	sendinput, {text}{{fs|75`%|{{sfrac|1|2}}}}
	sendinput, {left 6}
return

;alt+i                         italicize <i>selected text<`/i>
!i::
	clipboard := ""
	autotrim, off
	sendinput, ^c
	clipwait, 1
	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                         {{float left|selected text|2em}}
!j::
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard := "{{left|" . %selected% . "|2em}}"
	sendinput, ^v
return

;alt+k                         |ptb.5  {{ts|table style code}} pad top and pad bottom .5 em
!k::
	clipboard := ""
	sendinput, |ptb.5{left 6}{down}
return

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

;alt+m                         <math>`\<`/math>
!m::
	clipboard := ""
	sendinput, {text}<math>`\<`/math>
	sendinput, {left 7}
return

;alt+n                         {{nop}}
!n::
	clipboard := ""
	;sendinput, `n
	sendinput, {text}{{nop}}`n
;	sendinput, {text}{{nop}}`n|-`n|}`n`n
return

;alt+o                         copy title from 1st line to the header with page number on the right
!o::
	clipboard := ""
	sendinput, ^x
	clipwait, 0
	clipboard := trim(clipboard)
	sendinput, +{tab}
	sendinput, ^{home}
	sendinput, +{end}{del}
	sendinput, {text}{{rh||%clipboard%|}}
	sendinput, {end}
	sendinput, {left 2}
return

;alt+p                         copy title from 1st line to the header with page number on the left
!p::
	clipboard := ""
	sendinput, ^x
	clipwait, 0
	clipboard := trim(clipboard)
	sendinput, +{tab}
	sendinput, ^{home}
	sendinput, +{end}{del}
	sendinput, {text}{{rh||%clipboard%|}}
	sendinput, {home}
	sendinput, {right 5}
return

;alt+q                         USED by TextPad

;alt+r                         create reference tags and move cursor between the <ref></ref>
!r::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	if (substr(clipboard, 0) = A_space)
	{
	clipboard := trim(clipboard)
	clipboard= <ref>%clipboard%</ref>%A_space%
	}
	Else
	{
	selected := trim(clipboard)
	clipboard= <ref>%clipboard%</ref>
	}
	sendinput, ^v
return

;alt+s                         small case selected text
!s::
	clipboard := ""
	autotrim, off
	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                         created {{ts|}}| for table style code input
!t::
	clipboard := ""
	sendinput, {text}{{ts|}}|
	sendinput, {left 3}
return

;alt+u                         UNASSIGNED

;alt+v                         {{di|D}}rop initial at the beginning of the line
!v::
	clipboard := ""
	sendinput, {Home}
	sendinput, {text}{{di|
	sendinput, {Right}
	sendinput, {text}}}
return

;alt+w                         width = table style code
!w::
	clipboard := ""
	sendinput, {text}width = %A_Space%
return

;alt+x:                        save wikisource edit in firefox
!x::
	clipboard := ""
	sendinput, !+s
return

;alt+y                         character spacing {{sp|selected text}}
!y::
	clipboard := ""
	autotrim, off
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= {{sp|%selected%}}%A_space%
	}
	else
	{
	selected := trim(selected)
	clipboard= {{sp|%selected%|.4em}}
	}
	sendinput, ^v
return

;alt+z                         add an empty row between two rows
!z::
	clipboard := ""
	send, {home}
	send, {home}`n
	send, {down}
return

; alt+shift =======================================================

;alt+shift+0                   <div style = > </div> with serif font code
!+0::
	clipboard := ""
	selected =
	begin_div =
	end_div =
	sendinput, ^c
	clipwait, 0
	selected := trim(clipboard)
	begin_div = <div `{`{ts|mc|ffs|ac|pt4|pb1|bc|bgt`}`}>`n
	end_div = `n</div>`n
	clipboard := %begin_div%%selected%%end_div%
	sendinput, ^v
return

;alt+shift+1                   UNASSIGNED

;alt+shift+2                   UNASSIGNED

;alt+shift+3                   UNASSIGNED

;alt+shift+4                   UNASSIGNED

;alt+shift+5                   chr(0146) ’ minutes
!+5::
	clipboard := ""
	send, {text}’
return

;alt+shift+6                   chr(148) ” seconds
!+6::
	clipboard := ""
	send, {text}”
return

;alt+shift+7                   insert 50% page width double rule, enclosed by two {{Dhr}}
!+7::
	clipboard := ""
	sendinput, {home}
	sendinput, {text}`n
	sendinput, {text}{{Dhr}}
	sendinput, {text}`n`n
	sendinput, {raw}{{rule|50`%}}{{rule|50`%}}
	sendinput, {text}`n`n
	sendinput, {text}{{Dhr}}
	sendinput, {text}`n
return

+8::
	clipboard := ""
	sendinput, {text}`n{{***|3}}`n
return

;alt+shift+9                   title case selected text
!+9::
	clipboard := ""
	sendinput, ^c
	clipwait, 0
	stringlower, clipboard, clipboard, t
	sendinput, ^v
return

;alt+shift+a                   chr(0225) á
!+a::
	clipboard := ""
	sendinput, á
return

;alt+shift+b                   inserts |pb.5 pad bottom .5em table style code}}
!+b::
	clipboard := ""
	sendinput, |pb.5{left 5}{down}
return

;alt+shift+c                   chr(0231) ç
!+c::
	clipboard := ""
	sendinput, ç
return

;alt+shift+e                   chr(0233) é
!+e::
	clipboard := ""
	sendinput, é
return

;alt+shift+i                   chr(0237) í
!+i::
	clipboard := ""
	sendinput, í
return

;alt+shift+l                   inserts |pl.5 {{ts|pad left .5em table style code}}
!+l::
	clipboard := ""
	sendinput, `|pl.5{left 5}{down}
return

;alt+shift+m                   UNASSIGNED

;alt+shift+n                   chr(0241) ñ
!+n::
	clipboard := ""
	sendinput, ñ
return

;alt+shift+o                   chr(0243) ó
!+o::
	clipboard := ""
	sendinput, ó
return

;alt+shift+p                   PREVIEW KEY IN WIKIMEDIA SOFTWARE

;alt+shift+r                   inserts |pr.5 {{ts|pad right .5em table style code}}
!+r::
	clipboard := ""
	sendinput, `|pr.5{left 5}{down}
return

;alt+shift+s                   SAVE KEY of Wikimedia SOFTWARE in Firefox

;alt+shift+t                   inserts |pt.5 {{ts|pad top .5em table style code}}
!+t::
	clipboard := ""
	sendinput, |pt.5{left 5}{down}
return

;alt+shift+u                   chr(0250) ú
!+u::
	clipboard := ""
	sendinput, ú
return

; ctrl ============================================================

;ctrl+numpad1                  ALTERNATIVE TO THE 'End' KEY WHEN LAPTOP NUMPAD IS ON
;^Numpad1::
;	sendinput, {End}
return

;ctrl+numpad7                  ALTERNATIVE TO THE 'Home' KEY WHEN LAPTOP NUMPAD IS ON
;^Numpad7::
;	sendinput, {Home}
return

;ctrl+\                        reload script
^\::
	clipboard := ""
	reload
return

;ctrl+a                        DO NOT USE - 'SELECT ALL' IN ALL OPERATING SYSTEMS

;ctrl+b                        <br />
^b::
	clipboard := ""
	sendinput, <br `/>
return

;ctrl+c                        DO NOT USE - 'COPY' IN ALL OPERATING SYSTEMS

;ctrl+k                        {{sic}}
^k::
	clipboard := ""
	sendinput, {text}{{sic}}
return

;ctrl+l                        lowercase selected text in Textpad

;ctrl+m                        <math>selected</math>
^m::
	clipboard := ""
	selected := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= <math>{text}%selected%<`/math>%A_space%
	}
	else
	{
	selected := trim(selected)
	clipboard= <math>{text}%selected%<`/math>
	}
	sendinput, ^v
return

;ctrl+p                        `n<p>`n
^p::
	clipboard := ""
	sendinput, `n<p>`n
return

;ctrl+s                        DO NOT USE - 'SAVE' KEY IN ALL OPERATING SYSTEMS

;ctrl+v                        DO NOT USE - 'PASTE' KEY IN ALL OPERATING SYSTEMS

;ctrl+x                        DO NOT USE - 'CUT SELECTED' KEY IN ALL OPERATING SYSTEMS

;ctrl+z                        DO NOT USE - REVERT LAST ACTION IN ALL OPERATING SYSTEMS

; ctrl+alt =======================================================

;ctrl+alt+l                    lowercase selected text
^!l::
	clipboard := ""
	selected := ""
	replaced := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	stringlower, replaced, selected
	sendinput, %replaced%
	sendinput, {Home}
return

;ctrl+alt+p                    {{ping|}}
^!p::
	clipboard := ""
	sendinput, {text}{{ping|}}
	sendinput {left 2}
return

;ctrl+alt+t                    title case selected text
^!t::
	clipboard := ""
	selected := ""
	replaced := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	stringlower, replaced, selected, T
	sendinput, %replaced%
	sendinput, {Home}
return

;ctrl+alt+u                    uppercase selected text
^!u::
	clipboard := ""
	selected := ""
	replaced := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	stringupper, replaced, selected
	sendinput, %replaced%
	sendinput, {Home}
return

; ctrl+shift =====================================================

;ctrl+Shift+1                  UNASSIGNED

;ctrl+Shift+2                  UNASSIGNED

;ctrl+Shift+3                  UNASSIGNED

;ctrl+shift+4                  inserts 4 spaces (instead of tab)
^+4::
	clipboard := ""
	sendinput, %A_space%%A_space%%A_space%%A_space%
return

;ctrl+Shift+5                  UNASSIGNED

;ctrl+Shift+6                  UNASSIGNED

;ctrl+Shift+8                  UNASSIGNED

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

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

;ctrl+shift+i                  wiki link to [[wikt:]]ionary or [[w:]]ikipedia, [[wikt:selected text|selected text]]
^+i::
	clipboard := ""
	autotrim, off
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= `[`[wikt:%selected%|%selected%`]`]%A_space%
	}
	Else
	{
	selected := trim(selected)
	clipboard= `[`[wikt:%selected%|%selected%`]`]
	}
	sendinput, ^v
return

;ctrl+shift+l                  colspan = (table style code)
^+l::
	clipboard := ""
	sendinput, {text}colspan = %a_space%
	sendinput, {left 1}
return

;ctrl+shift+n                  DO NOT USE - Irfanview switch to negative image key

;ctrl+shift+p                  {{Page break|label=|border-width=2px|border-style=solid|border-color=#6479FF}}
^+p::

	clipboard := ""
	sendinput, {text}{{Page break|label=|border-width=2px|border-style=solid|border-color=#6479FF}}

return

;ctrl+shift+r                  DO NOT USE - RESERVED BY FIREFOX

;ctrl+shift+s                  DO NOT USE - RESERVED BY FIREFOX

;ctrl+shift+t                  insert<></>
^+t::
	clipboard := ""
	sendinput, {text}<></>
	sendinput, {left 3}
return

;ctrl+shift+v                  RESERVED BY WINDOWS

;ctrl+shift+w                  rowspan = (table code)
^+w::
	clipboard := ""
	sendinput, {text}rowspan = %a_space%
	sendinput, {left 1}
return

;ctrl+shift+y                  chr(0176) ° degree indicator
^+y::
	clipboard := ""
	sendinput, {text}°
return

; shift ======================================================= = = =

;shift+esc                     paragraph line height and font size templates combined
+esc::
	autotrim, on
	clipboard := ""
	sendinput, ^c
	clipwait, 0
	selected := trim(clipboard)
	clipboard= {{fs|85`%|{{lh|120`%|%selected%}}}}
	sendinput, ^v
return

; win ============================================================

;win+numpad1                   ALTERNATIVE TO THE 'Shift+End' KEY WHEN LAPTOP NUMPAD IS ON
;#Numpad1::
;	sendinput, +{end}
return

;win+numpad7                   ALTERNATIVE TO THE 'Shift+Home' KEY WHEN LAPTOP NUMPAD IS ON
;#Numpad7::
;	sendinput, +{home}
return

;win+'                         edit to search for floating single or double quote
#'::
	clipboard := ""
	sendinput, ^f
	clipwait, 0
	sendinput, ''
	clipwait, 0
	sendinput, {esc} {left 1}  ; Firefox
;	sendinput, {esc}           ; Vivaldi
return

;win+down                      inserts {{hwe| at the beginning of a row
#down::
	sendinput, {Home}
	sendinput, {text}{{hwe|
	sendinput, ^{right}{backspace}
	sendinput, {text}|x}}%A_space%
	sendinput, {left 4}
return

;win+up                        encloses hyphenated text start with {{hws| - place at the end of line and activate
#up::
	sendinput, {backspace}^{left}
	sendinput, {text}{{hws|
	sendinput, {end}
	sendinput, {text}|x}}
	sendinput, {left 3}
return

#-::
	autotrim, off
	selected =
	pasted =
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = %A_space%)
	{
	selected := trim(selected)
	stringlower, pasted, selected
	clipboard := %pasted%%A_space%
	}
else
	{
	selected := trim(selected)
	stringLower, pasted, selected
	clipboard := %pasted%
	}
	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<section end = E `/>`n<section begin = B `/>{Left 3}
return

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

;win+4                         UNASSIGNED

;win+5                         UNASSIGNED

;win+6                         UNASSIGNED

;win+7                         {{under construction}}  {{removed existing}}
#7::
	clipboard := ""
	sendinput, {text}removed existing
return

;win+8                         {{fs85|selected text}} without centering
#8::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	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}} without centering
#9::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= {{fs90|%selected%}}%A_space%
	}
	else
	{
	selected := trim(selected)
	clipboard= {{fs90|%selected%}}
	}
	sendinput, ^v
return

;win+0                         <div>selected</div>
#0::
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard= <div>%selected%<`/div>
	sendinput, ^v
return

;win+a                         {{anchor|D}} at the left margin
#a::
	sendinput, {Home}
	sendinput, {text}{{anchor|D}}
	sendinput, {left 2}
return

;win+b                         HTML bold <b>selected text<`/b>
#b::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	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                         {{c|''selected text''}} center and italicize selected text
#c::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= {{c|%selected%}}%A_space%
	}
	else
	{
	selected := trim(selected)
	clipboard= {{c|%selected%}}
	}
	sendinput, ^v
return

;win+d                         block of text <div {{ts|width:500px;|mc|ac|sm85|lh11|pb.5}}>selected text<`/div>
#d::
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard := "<div {{ts|width:500px;|mc|aj|sm90|lh12|pb.5}}>`n%selected%`n<`/div>"
	sendinput, ^v
return

;win+e                         {{anchor|D}} any place in the text
#e::
	sendinput, {text}{{anchor|D}}
	sendinput, {left 2}
return

;win+f                         DO NOT USE RESERVED BY WINDOWS FOR FEEDBACK

;win+g                         {{c|sc|selected text}}
#g::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard= {{c|{{sc|%selected%}}}}
	sendinput, ^v
return

;win+h                         hanging indent
#h::
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard= {{hi|%selected%}}
	sendinput, ^v
return

;win+i                         {{SIC|selected text|selected text|}}
#i::
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= {{SIC|%selected%|%selected%}}%A_space%
	}
	Else
	{
	selected := trim(selected)
	clipboard= {{SIC|%selected%|%selected%}}
	}
	sendinput, ^v
return

;win+j                         {{float right|selected text|2em}}
#j::
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard= {{right|%selected%|2em}}
	sendinput, ^v
return

;win+k                         search and remove caret
#k::
	critical, on
	clipboard := ""
	newtext := ""
	sendinput, ^a^c
	newtext := clipboard
	newtext := strreplace(newtext, "^")
	sleep, 500
	clipboard := newtext
	sendinput, ^v
	critical, off
return

;win+l                         DO NOT USE, WINDOWS LOCK

;win+m                         <!-- comments out selected text -->
#m::
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := trim(clipboard)
	clipboard= <!--%A_space%%selected%%A_space%-->
	sendinput, ^v
return

;win+n                          
#n::
	clipboard := ""
	sendinput, {text} 
return

;win+o                         {{cdm||}}
#o::
	clipboard := ""
	sendinput, {text}{{cdm||304}}
	sendinput, {left 6}q
return

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

;win+q                         {{sm|selected text}}
#q::
	clipboard := ""
	autotrim, off
	clipboard := ""
	sendinput, ^c
	clipwait, 1
	selected := clipboard
	if (substr(selected, 0) = A_space)
	{
	selected := trim(selected)
	clipboard= {{sm|%selected%}}%A_space%
	}
	else
	{
	selected := trim(selected)
	clipboard= {{sm|%selected%}}
	}
	sendinput, ^v
return

;win+r                         <ref></ref>
#r::
	clipboard := ""
	sendinput, {text}<ref></ref>
	sendinput, {left 6}
return

;win+s                         insert in footer {{rule}}\n{{smallrefs}}
#s::
	clipboard := ""
	sendinput, ^a{Del}^{Home}
	sendinput, {text}{{rule}}
	sendinput, `n			; without rule
;	sendinput, `n`n			; with rule
	sendinput, {text}{{smallrefs}}
	sendinput, `n
return

;win+t                         table and style definition {| {{ts|bt|bb|mc|sm85|lh11|ar|bc|bgt}}
#t::
	clipboard := ""
	sendinput, {text}{| {{ts|mc|sm95|lh13|aj|bc|bgt}}`n|-		; border
return

;win+u                         superscript selected text
#u::
	clipboard := ""
	sendinput, ^c
	clipwait, 0
	selected := trim(clipboard)
	clipboard= <sup>%selected%<`/sup>
	sendinput, ^v
	sendinput, {left 6}
return

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

;win+w                         for Wikisource images {{Do not move to Commons}}
#w::
	clipboard := ""
	sendinput, {text}{{Do not move to Commons}}
return

;win+x                         WINDOWS MENU WHEN WINDOWS SHORTCUTS ARE ENABLED. Disabled through Ultimate Windows Tweaks - Disable Winkey shortcuts

;win+z                         z
#z::
	sendinput, {text}<!--hwe joined with hws-->
return

; mouse ===========================================================

;mbutton                       switch to newly opened tab
#ifwinactive ahk_exe vivaldi.exe
	detecthiddentext, on
mbutton::send, {lshift down}{lbutton}{lshift up}
	detecthiddentext, off
#ifwinactive
return

return

AutoReload:

Reload

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