User:Celuici/Haz PE.ahk

From Wikisource
Jump to navigation Jump to search

; RELOAD SCRIPT
#'::Reload 

; ITALIC TAGS AROUND SELECTION
`::
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-s     small case {{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

;win-r    {{right|''selected text''  right and italicize selected text. Useful for article dates
#r::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
    selected:=trim(clipboard)
    if (substr(selected, 0)=A_space)
    {
    selected:=trim(selected)
    clipboard={{right|''%selected%''%A_space%
}
else
{
    selected:=trim(selected)
    clipboard={{right|''%selected%''
}
    sendinput, ^v
return

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

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

;win-n          BLOCK CENTRE around selection
#n::
autotrim, off
clipboard:=
sendinput, ^c
clipwait, 0
    selected:=trim(clipboard)
    if (substr(selected, 0)=A_space)
    {
    selected:=trim(selected)
    clipboard={{block center|%selected%}}%A_space%
}
else
{
    selected:=trim(selected)
    clipboard={{block center|%selected%}}
}
    sendinput, ^v
return

;win-q   REPLACE _"_, search for " in Chrome for visual inspection
#q::
Sleep 30
Send ^a 			     ; copy current selection to clipboard
Sleep 30 
Send ^c 			     ; copy current selection to clipboard
Sleep 30
StringReplace, clipboard, clipboard, %A_space%"%A_space%, %A_space%", All
Sleep 30
StringReplace = %clipboard%
Sleep 30
Send ^v
sleep 30
Send ^f"{Enter}
return