summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter2022-04-27 10:09:29 +0100
committerPeter2022-04-27 10:09:29 +0100
commiteab25092d8e80c5496a110f145c8c0d6b871c678 (patch)
treec165dd44772eb21961277609d3c43978181d7546
parent16e2259b90021967bf4c4471cf6141430de4eb99 (diff)
downloadahka-eab25092d8e80c5496a110f145c8c0d6b871c678.tar.gz
ahka-eab25092d8e80c5496a110f145c8c0d6b871c678.tar.bz2
ahka-eab25092d8e80c5496a110f145c8c0d6b871c678.zip
Auto-indent script
-rw-r--r--ahk-assistant.ahk843
1 files changed, 423 insertions, 420 deletions
diff --git a/ahk-assistant.ahk b/ahk-assistant.ahk
index 86e0ef9..3652042 100644
--- a/ahk-assistant.ahk
+++ b/ahk-assistant.ahk
@@ -1,4 +1,3 @@
-
; ahk-assistant
; ^ctrl #win !alt +shift
@@ -76,320 +75,320 @@ Insert::appendClipboard()
; application specific hotkeys
#IfWinActive ahk_class #32770 ; misc save/load/time-date/find boxes and more!
- CapsLock::Send !{F4} ; quit
- F1::Send, {F2} ; rename, help is useless in explorer
- /::Send, \ ; forward slashes paths aren't accepted
- !/::Send, / ; just in case you need an incorrect slash
+CapsLock::Send !{F4} ; quit
+F1::Send, {F2} ; rename, help is useless in explorer
+/::Send, \ ; forward slashes paths aren't accepted
+!/::Send, / ; just in case you need an incorrect slash
#IfWinActive
#IfWinActive ahk_class CabinetWClass ; explorer
- CapsLock:: ; overflow
- RAlt & Up::Send {AltDown}{Up}{AltUp}
- Alt & Enter:: ; overflow
- Ralt & Enter::Send {AppsKey}{Up}{Enter} ; ralt-enter properties
- ^+Enter::Send {AppsKey}e ; C-S-enter opens in new window
- F1:: ; overflow to rename, help is useless in explorer
- F3::Send, {F2} ; rename for fun, nobody uses F3
- F6::Send !d ; addressbar
- ^Backspace::Send ^+{Left}{Backspace} ; backspace a word
- ^f::Return ; disable search in explorer, was always pretty useless
- ^h::explorerHidden()
- ^p::Send, !p ; C-p also works for toggle preview
- ^-::Send ^{WheelDown 2} ; zoom out
- ^=::Send ^{WheelUp 2} ; zoom in
+CapsLock:: ; overflow
+RAlt & Up::Send {AltDown}{Up}{AltUp}
+Alt & Enter:: ; overflow
+Ralt & Enter::Send {AppsKey}{Up}{Enter} ; ralt-enter properties
+^+Enter::Send {AppsKey}e ; C-S-enter opens in new window
+F1:: ; overflow to rename, help is useless in explorer
+F3::Send, {F2} ; rename for fun, nobody uses F3
+F6::Send !d ; addressbar
+^Backspace::Send ^+{Left}{Backspace} ; backspace a word
+^f::Return ; disable search in explorer, was always pretty useless
+^h::explorerHidden()
+^p::Send, !p ; C-p also works for toggle preview
+^-::Send ^{WheelDown 2} ; zoom out
+^=::Send ^{WheelUp 2} ; zoom in
#IfWinActive
#IfWinActive ahk_class ShockwaveFlashFullScreen ; full screen flash
- Ralt & Enter:: ; overflow
- Alt & Enter::toggleFullscreen() ; leave flash full screen with a keyboard command
+Ralt & Enter:: ; overflow
+Alt & Enter::toggleFullscreen() ; leave flash full screen with a keyboard command
#IfWinActive
#IfWinActive ahk_class FontViewWClass ; font previewer
- CapsLock::Send !{F4} ; quit
+CapsLock::Send !{F4} ; quit
#IfWinActive
#IfWinActive ahk_exe 7zFM.exe ; 7zip file manager
- !Up::Send {Backspace}
+!Up::Send {Backspace}
#IfWinActive
#If WinActive("ahk_exe AppMgrEX.exe") or WinActive("ahk_exe AppMgr.exe") or WinActive("ahk_exe AppMgrPx.exe") ; NEC programming tools
- global necUsername
- global necPassword
- global necPort
- :*?:__login::
- Send tech{Tab}12345678{Enter}
- Return
- Alt & Enter:: ; connect, paste IP, enter credentials, connect
- Send {F5}{Sleep 250}{Tab 5}{Sleep 250}
- pasteClipboard()
- Send {Tab}{Enter}{Tab}%necPort%{Tab 2}{Enter}{Tab}%necUsername%{Tab}%necPassword%{Tab}{Enter}{Sleep 250}{Enter}
- Return
+global necUsername
+global necPassword
+global necPort
+:*?:__login::
+ Send tech{Tab}12345678{Enter}
+Return
+Alt & Enter:: ; connect, paste IP, enter credentials, connect
+Send {F5}{Sleep 250}{Tab 5}{Sleep 250}
+pasteClipboard()
+Send {Tab}{Enter}{Tab}%necPort%{Tab 2}{Enter}{Tab}%necUsername%{Tab}%necPassword%{Tab}{Enter}{Sleep 250}{Enter}
+Return
#If
#If WinActive("ahk_class SciCalc") or WinActive("ahk_class CalcFrame") ; windows xp or windows 7 calculator
- CapsLock::Send !{F4} ; quit
+CapsLock::Send !{F4} ; quit
#IfWinActive
#IfWinActive ahk_class ShImgVw:CPreviewWnd ; photoviewer windows xp
- ^w:: ; overflow
- CapsLock::Send !{F4} ; quit
- ^-::Send {-} ; zoom out
- ^=::Send {+} ; zoom in
+^w:: ; overflow
+CapsLock::Send !{F4} ; quit
+^-::Send {-} ; zoom out
+^=::Send {+} ; zoom in
#IfWinActive
#IfWinActive ahk_class Photo_Lightweight_Viewer ; photoviewer windows 7
- q:: ; overflow
- ^w:: ; overflow
- CapsLock::Send !{F4} ; quit
- Up:: ; overflow
- Down::Return ; fixes up/down breaking left/right navigation
+q:: ; overflow
+^w:: ; overflow
+CapsLock::Send !{F4} ; quit
+Up:: ; overflow
+Down::Return ; fixes up/down breaking left/right navigation
#IfWinActive
#IfWinActive ahk_exe nomacs.exe
- q:: ; overflow
- ^w:: ; overflow
- CapsLock::Send !{F4} ; quit
+q:: ; overflow
+^w:: ; overflow
+CapsLock::Send !{F4} ; quit
#IfWinActive
#IfWinActive ahk_class IrfanView
- q:: ; overflow
- ^w:: ; overflow
- CapsLock::Send !{F4} ; quit
- !Left::Send l
- !Right::Send r
+q:: ; overflow
+^w:: ; overflow
+CapsLock::Send !{F4} ; quit
+!Left::Send l
+!Right::Send r
#IfWinActive
#IfWinActive ahk_class FullScreenClass ; irfanview fullscreen-o-mode
- q:: ; overflow
- ^w:: ; overflow
- CapsLock::Send !{F4}{sleep 15}!{F4} ; quit
+q:: ; overflow
+^w:: ; overflow
+CapsLock::Send !{F4}{sleep 15}!{F4} ; quit
#IfWinActive
#IfWinActive ahk_exe SumatraPDF.exe ; sumatra pdf
- CapsLock::Send !{F4} ; quit
- ^b::Send {F12} ; C-b toggles bookmarks
- ^t::Send !vt ; C-t toggles toolbar
- Alt & Enter:: ; overflow
- Ralt & Enter::Send ^l ; fullscreen
+CapsLock::Send !{F4} ; quit
+^b::Send {F12} ; C-b toggles bookmarks
+^t::Send !vt ; C-t toggles toolbar
+Alt & Enter:: ; overflow
+Ralt & Enter::Send ^l ; fullscreen
#IfWinActive
#IfWinActive ahk_class MediaPlayerClassicW ; mpc-hc
- 1::Send 2^1 ; 1 keeps borders
- Ralt & Enter::Send !{Enter} ; ralt-enter fullscreens
- CapsLock::Send !{F4} ; quit
- p::Send ^7 ; p for playlist
+1::Send 2^1 ; 1 keeps borders
+Ralt & Enter::Send !{Enter} ; ralt-enter fullscreens
+CapsLock::Send !{F4} ; quit
+p::Send ^7 ; p for playlist
#IfWinActive
#If WinActive("ahk_exe mpv.exe") or WinActive("ahk_exe mpvnet.exe") ; mpv and mpv.net
- Alt & Enter:: ; overflow to fullscreen below
- Ralt & Enter::Send f ; ralt-Enter fullscreens
- q:: ; overflow to quit, for mpv.net
- CapsLock::Send !{F4} ; quit
+Alt & Enter:: ; overflow to fullscreen below
+Ralt & Enter::Send f ; ralt-Enter fullscreens
+q:: ; overflow to quit, for mpv.net
+CapsLock::Send !{F4} ; quit
#IfWinActive
#IfWinActive ahk_class rctrl_renwnd32 ; outlook
- ^Enter::Return ; disable accidentally send email shortcut
- ^f::Send ^e ; C-f finds instead of forwards
- ^t::Send !go ; C-t goes to today, on calendar view
+^Enter::Return ; disable accidentally send email shortcut
+^f::Send ^e ; C-f finds instead of forwards
+^t::Send !go ; C-t goes to today, on calendar view
#IfWinActive
#IfWinActive ahk_class OpusApp ; word 2003
- ^=::Send ^{WheelUp} ; zoom in
- ^-::Send ^{WheelDown} ; zoom out
- ^0::Send !vzp{Enter} ; fit to page zoom
+^=::Send ^{WheelUp} ; zoom in
+^-::Send ^{WheelDown} ; zoom out
+^0::Send !vzp{Enter} ; fit to page zoom
#IfWinActive
#IfWinActive ahk_class XLMAIN ; excel 2003/2007
- ^!t::Send {AppsKey}f{Tab}{End}{Up 2}{Enter} ; sets cell format to text to allow leading zeroes
- ^+v::Send ^'{Down} ; C-S-v copies above cell contents into current
- ^!+v::pasteClipboard() ; C-A-S-v past clipboard as above steals C-A-v
- ^+n::Send !iw ; new sheet
- ^+w::Send !el ; delete current sheet
- !F2:: ; overflow
- ^F2::Send !ohr ; rename sheet
- F3::Send +{F4} ; f3 searches for the same string again
- F6::Send {F2} ; shortcut to formula bar
- F11::Send !vu ; fullscreen
- ^Tab::Send ^{PgDn} ; next sheet
- ^+Tab::Send ^{PgUp} ; prev sheet
- ^0::Send !vz1{Enter} ; reset zoom
- ^-::Send ^{WheelDown} ; zoom out
- ^=::Send ^{WheelUp} ; zoom in
- ^Backspace::Send {CtrlDown}{ShiftDown}{Left}{CtrlUp}{ShiftUp}{Backspace} ; C-Backspace deletes word when in formula bar, can't ^!LB due to it not releasing and deleting the whole line
+^!t::Send {AppsKey}f{Tab}{End}{Up 2}{Enter} ; sets cell format to text to allow leading zeroes
+^+v::Send ^'{Down} ; C-S-v copies above cell contents into current
+^!+v::pasteClipboard() ; C-A-S-v past clipboard as above steals C-A-v
+^+n::Send !iw ; new sheet
+^+w::Send !el ; delete current sheet
+!F2:: ; overflow
+^F2::Send !ohr ; rename sheet
+F3::Send +{F4} ; f3 searches for the same string again
+F6::Send {F2} ; shortcut to formula bar
+F11::Send !vu ; fullscreen
+^Tab::Send ^{PgDn} ; next sheet
+^+Tab::Send ^{PgUp} ; prev sheet
+^0::Send !vz1{Enter} ; reset zoom
+^-::Send ^{WheelDown} ; zoom out
+^=::Send ^{WheelUp} ; zoom in
+^Backspace::Send {CtrlDown}{ShiftDown}{Left}{CtrlUp}{ShiftUp}{Backspace} ; C-Backspace deletes word when in formula bar, can't ^!LB due to it not releasing and deleting the whole line
#IfWinActive
#IfWinActive ahk_class wxWindowNR ; hydrus client
- CapsLock::Send !{F4} ; quit
+CapsLock::Send !{F4} ; quit
#IfWinActive
#IfWinActive ahk_class ConsoleWindowClass ; command prompt
- ^l::Send ^c{Enter}cls{Enter} ; clear screen as in linux
+^l::Send ^c{Enter}cls{Enter} ; clear screen as in linux
#IfWinActive
#IfWinActive ahk_class MozillaWindowClass ; firefox
- ^+w::Send ^w ; quit window closes tab
- ^+n::Send ^+p ; new incognito window
- ^q::Send ^w ; quit now closes tab, the two keys are too close for this sort of thing
- ^!d::Send ^j ; why Downloads is ctrl+j while addons is ctrl+alt+a will never make sense
- ^d::Send ^f ; bookmark remapped to find
- ^b::Send ^v ; replace bookmarks with paste
- ^+m::Send, ^+n ; why is this feature even a thing
- #o::Send, ^c{F6}^v{Enter} ; copy selected uri and open in current tab
- #+o::Send, ^c^t^v{Enter} ; copy selected uri and open in new tab
- ^+o::Send, !t{sleep 150}s ; C-S-o options
- F1:: ; overflow
- F2::Send {Sleep 25}{Esc}{Sleep 25}{F6}{ShiftDown}{Tab 2}{ShiftUp}{AppsKey}w{Sleep 250} ; split current tab from window
- F7:: ; overflow
- F6::Send ^l ; F6 jumps to address bar
- +PgDn::Send {Space 4}{Down 5} ; scroll down to specific part of a specific page, not really
- +PgUp::Send {Home} ; makes sense, kinda
- RAlt & Left::Send, !{Left}
- RAlt & Right::Send, !{Right}
- Ralt & Enter:: ; overflow
- Alt & Enter::toggleFullscreen() ; leave flash full screen with a keyboard command
- :*?:_crm::
- insertCRMFooter()
- return
+^+w::Send ^w ; quit window closes tab
+^+n::Send ^+p ; new incognito window
+^q::Send ^w ; quit now closes tab, the two keys are too close for this sort of thing
+^!d::Send ^j ; why Downloads is ctrl+j while addons is ctrl+alt+a will never make sense
+^d::Send ^f ; bookmark remapped to find
+^b::Send ^v ; replace bookmarks with paste
+^+m::Send, ^+n ; why is this feature even a thing
+#o::Send, ^c{F6}^v{Enter} ; copy selected uri and open in current tab
+#+o::Send, ^c^t^v{Enter} ; copy selected uri and open in new tab
+^+o::Send, !t{sleep 150}s ; C-S-o options
+F1:: ; overflow
+F2::Send {Sleep 25}{Esc}{Sleep 25}{F6}{ShiftDown}{Tab 2}{ShiftUp}{AppsKey}w{Sleep 250} ; split current tab from window
+F7:: ; overflow
+F6::Send ^l ; F6 jumps to address bar
++PgDn::Send {Space 4}{Down 5} ; scroll down to specific part of a specific page, not really
++PgUp::Send {Home} ; makes sense, kinda
+RAlt & Left::Send, !{Left}
+RAlt & Right::Send, !{Right}
+Ralt & Enter:: ; overflow
+Alt & Enter::toggleFullscreen() ; leave flash full screen with a keyboard command
+:*?:_crm::
+ insertCRMFooter()
+return
#IfWinActive
#IfWinActive ahk_exe mspaint.exe ; mspaint
- ^=::Send ^{PgUp} ; zoom in
- ^-::Send ^{PgDn} ; zoom out
+^=::Send ^{PgUp} ; zoom in
+^-::Send ^{PgDn} ; zoom out
#IfWinActive
#If WinActive("ahk_class Notepad2") or WinActive("ahk_class Notepad3") ; notepad 2 and 3
- ^0::Send ^/ ; remap transparency feature to reset zoom level, in keeping with other hotkeys
- !t::Return ; disable always on top
- ^+Down:: ; overflow
- ^Down::Send {Down} ; disable (alt) shift line down feature
- ^+Up:: ; overflow
- ^Up::Send {Up} ; disable (alt) shift line up feature
- !u::Send ^a!o ; remap delete last character to sort lines, after selecting everything
+^0::Send ^/ ; remap transparency feature to reset zoom level, in keeping with other hotkeys
+!t::Return ; disable always on top
+^+Down:: ; overflow
+^Down::Send {Down} ; disable (alt) shift line down feature
+^+Up:: ; overflow
+^Up::Send {Up} ; disable (alt) shift line up feature
+!u::Send ^a!o ; remap delete last character to sort lines, after selecting everything
#IfWinActive
#IfWinActive ahk_exe calibre-parallel.exe ; calibre reader
- q:: ; overflow
- CapsLock::Send !{F4} ; quit
+q:: ; overflow
+CapsLock::Send !{F4} ; quit
#IfWinActive
#IfWinActive ahk_exe audacity.exe ; audacity
- ^=::Send ^1 ; zoom in
- ^-::Send ^3 ; zoom out
- ^0::Send ^2 ; zoom reset
+^=::Send ^1 ; zoom in
+^-::Send ^3 ; zoom out
+^0::Send ^2 ; zoom reset
#IfWinActive
#IfWinActive ahk_class WinClass_FXS ; civilization 5
- F11::borderlessFullscreen()
- ^h::send {Home}{Esc} ; return to capital city, then close home screen
+F11::borderlessFullscreen()
+^h::send {Home}{Esc} ; return to capital city, then close home screen
#IfWinActive
#IfWinActive ahk_exe Teams.exe ; i hate ms teams
- ^a::Send {End}{ShiftDown}{Home}{ShiftUp}
+^a::Send {End}{ShiftDown}{Home}{ShiftUp}
#IfWinActive
; text insertion/replacements
:*?:_date::
- insertDate()
- Return
+ insertDate()
+Return
:*?:_time::
- insertTime()
- Return
+ insertTime()
+Return
:*?:_dttime::
- insertBlogDateTime()
- Return
+ insertBlogDateTime()
+Return
:*?:_dtime::
- insertDateTime()
- Return
+ insertDateTime()
+Return
:*?:_week::
- insertWeek()
- Return
+ insertWeek()
+Return
:*?:_gw::
- insertGateway()
- Return
+ insertGateway()
+Return
:*?:_lip::
- Send, %A_IPAddress1%
- Return
+ Send, %A_IPAddress1%
+Return
:*?:_sig::
- insertSignature()
- Return
+ insertSignature()
+Return
:*?:_reg::
- Send,`n`nRegards,`n%firstName%.
- Return
+ Send,`n`nRegards,`n%firstName%.
+Return
:*?:_kreg::
- Send,`n`nKind regards,`n%firstName%.
- Return
+ Send,`n`nKind regards,`n%firstName%.
+Return
:*:_hem::
- Send, %homeEmailAddress%
- Return
+ Send, %homeEmailAddress%
+Return
:*:_wem::
- Send, %workEmailAddress%
- Return
+ Send, %workEmailAddress%
+Return
:*:_wip::
- Send, %workIPAddress%
- Return
+ Send, %workIPAddress%
+Return
:*:_cbip::
- Send, %workCBIPAddress%
- Return
- :*:_ntp::
- Send, 0.uk.pool.ntp.org
- Return
+ Send, %workCBIPAddress%
+Return
+:*:_ntp::
+ Send, 0.uk.pool.ntp.org
+Return
:*:_mac::
- Send, %remoteMAC%
- Return
+ Send, %remoteMAC%
+Return
:*:_htel::
- Send, %homePhoneNumber%
- Return
+ Send, %homePhoneNumber%
+Return
:*:_wtel::
- Send, %workPhoneNumber%
- Return
+ Send, %workPhoneNumber%
+Return
:*:_wddi::
- Send, %workPhoneNumberDDI%
- Return
+ Send, %workPhoneNumberDDI%
+Return
:*:_mob::
- Send, %mobilePhoneNumber%
- Return
+ Send, %mobilePhoneNumber%
+Return
:*:_wmob::
- Send, %workMobilePhoneNumber%
- Return
+ Send, %workMobilePhoneNumber%
+Return
:*:_xmraddr::
- Send, %xmrAddress%
- Return
+ Send, %xmrAddress%
+Return
:*:_xrbaddr::
- Send, %xrbAddress%
- Return
+ Send, %xrbAddress%
+Return
:*:_banaddr::
- Send, %banAddress%
- Return
+ Send, %banAddress%
+Return
:*:_proid::
- Send, %prolificID%
- Return
+ Send, %prolificID%
+Return
:*:_haddr::
- Send, %homeAddress%
- Return
+ Send, %homeAddress%
+Return
:*:_waddr::
- Send, %workAddress%
- Return
+ Send, %workAddress%
+Return
:*:_hpc::
- Send, %homePostCode%
- Return
+ Send, %homePostCode%
+Return
:*:_wpc::
- Send, %workPostCode%
- Return
+ Send, %workPostCode%
+Return
:*:_salu::
- insertSalutation()
- Return
+ insertSalutation()
+Return
:*:_wdatfile::
- workDatFile()
- Return
+ workDatFile()
+Return
:*:_db::
- Send, %A_WorkingDir%\Vault\
- Return
+ Send, %A_WorkingDir%\Vault\
+Return
:*:_md::
- Send, %A_WorkingDir%
- Return
+ Send, %A_WorkingDir%
+Return
:*?:_foot::
- insertFooter()
- Return
+ insertFooter()
+Return
; special character insertion
; swedish
@@ -443,8 +442,8 @@ Insert::appendClipboard()
:c?*:(a-)::á
:c?*:(E-)::É
:c?*:(e-)::
- Send {ASC 130} ; C-A-e insertion for é is weird
- Return
+ Send {ASC 130} ; C-A-e insertion for é is weird
+Return
:c?*:(I-)::Í
:c?*:(i-)::í
:c?*:(O-)::Ó
@@ -562,260 +561,264 @@ Insert::appendClipboard()
; functions
insertGateway() {
- RunWait , %comspec% /c ipconfig > %A_Temp%\gw.txt,, Hide
- ArrayCount = 0
- Loop, Read, %A_Temp%\gw.txt
- {
- Count := RegExMatch(A_LoopReadLine, ".*Default Gateway .+ ((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)).*",ip)
- If ( %Count% != 0) {
- ArrayCount += 1
- IP_Array%ArrayCount% := ip1
- gateway := ip1
- }
- }
- FileDelete %A_Temp%\gw.txt
- Send, %gateway%
- }
+ RunWait , %comspec% /c ipconfig > %A_Temp%\gw.txt,, Hide
+ ArrayCount = 0
+ Loop, Read, %A_Temp%\gw.txt
+ {
+ Count := RegExMatch(A_LoopReadLine, ".*Default Gateway .+ ((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)).*",ip)
+ If ( %Count% != 0) {
+ ArrayCount += 1
+ IP_Array%ArrayCount% := ip1
+ gateway := ip1
+ }}
+ FileDelete %A_Temp%\gw.txt
+ Send, %gateway%
+}
insertSignature() {
- global firstName
- global lastName
- StringLeft, firstInitial, firstname, 1
- StringLeft, lastInitial, lastname, 1
- Send, %A_Space%-%firstInitial%%lastInitial%
- }
+ global firstName
+ global lastName
+ StringLeft, firstInitial, firstname, 1
+ StringLeft, lastInitial, lastname, 1
+ Send, %A_Space%-%firstInitial%%lastInitial%
+}
insertFooter() {
- Send, {Enter}
- insertDateTime()
- insertSignature()
- Return
- }
+ Send, {Enter}
+ insertDateTime()
+ insertSignature()
+ Return
+}
insertCRMFooter() {
- insertFooter()
- Send, {Tab}{Space} ; jump out of textarea and press save
- Return
- }
+ insertFooter()
+ Send, {Tab}{Space} ; jump out of textarea and press save
+ Return
+}
insertSalutation() {
- If(A_Hour <12)
- Send, Morning
- Else if (A_Hour <17)
- Send, Afternoon
- Else
- Send, Evening
- Return
- }
+ If(A_Hour <12)
+ Send, Morning
+ Else If (A_Hour <17)
+ Send, Afternoon
+ Else
+ Send, Evening
+ Return
+}
workDatFile() {
- global firstName
- Send order{Tab 3}`.dat file request{Tab}
- insertSalutation()
- Send, ,`n`nPlease can I get a .dat file generated for system ID: %clipboard%?`nThe order reference will be:{Space}`n`nRegards,`n%firstName%.{Up 3}{End}
- Return
- }
+ global firstName
+ Send order{Tab 3}`.dat file request{Tab}
+ insertSalutation()
+ Send, ,`n`nPlease can I get a .dat file generated for system ID: %clipboard%?`nThe order reference will be:{Space}`n`nRegards,`n%firstName%.{Up 3}{End}
+ Return
+}
insertDate() {
- FormatTime, CurrentDateTime,, yyyy-MM-dd
- Send %CurrentDateTime%
- Return
- }
+ FormatTime, CurrentDateTime,, yyyy-MM-dd
+ Send %CurrentDateTime%
+ Return
+}
insertTime() {
- FormatTime, CurrentDateTime,, HH:mm
- Send %CurrentDateTime%
- Return
- }
+ FormatTime, CurrentDateTime,, HH:mm
+ Send %CurrentDateTime%
+ Return
+}
insertBlogDateTime() {
- FormatTime, CurrentDateTime,, yyyy-MM-ddTHH:mm:00
- Send %CurrentDateTime%
- Return
- }
+ FormatTime, CurrentDateTime,, yyyy-MM-ddTHH:mm:00
+ Send %CurrentDateTime%
+ Return
+}
insertDateTime() {
- FormatTime, CurrentDateTime,, yyyy-MM-dd HH:mm
- Send %CurrentDateTime%
- Return
- }
+ FormatTime, CurrentDateTime,, yyyy-MM-dd HH:mm
+ Send %CurrentDateTime%
+ Return
+}
insertWeek() {
- yearWeek = %A_YDay%
- yearWeek /= 7
- yearWeek++ ; Convert from 0-base to 1-base
- Send %yearWeek%
- }
+ yearWeek = %A_YDay%
+ yearWeek /= 7
+ yearWeek++ ; Convert from 0-base to 1-base
+ Send %yearWeek%
+}
appendClipboard() {
- backupClipboard = %clipboard%
- Send, ^c
- clipboard = %backupClipboard%`r`n%clipboard%
- backupClipboard =
- Return
- }
-
-pasteClipboard() { ; manually paste clipboard, minus most formatting
- tempClipboard = %clipboard%
- StringReplace, tempClipboard, tempClipboard, ?,, All ; remove bullet points
- StringReplace, tempClipboard, tempClipboard, ·,, All ; remove middots
- StringReplace, tempClipboard, tempClipboard, %A_Tab%,, All ; remove tabs
- StringReplace, tempClipboard, tempClipboard, /,%A_Space%, All ; forward slashes mess up linux paths
- StringReplace, tempClipboard, tempClipboard, +44,0, All ; remove international dialling code without a space
- StringReplace, tempClipboard, tempClipboard, `r,, All ; remove half of line breaks
- StringReplace, tempClipboard, tempClipboard, `n,, All ; remove other half of line breaks
- tempClipboard = %tempClipboard% ; trim whitespace
- SendRaw %tempClipboard%
- tempClipboard =
- Return
- }
-
-toggleFullscreen() { ;double click the window
- CoordMode, Mouse, Relative
- MouseMove, 250, 250
- Send {Click 2}
- Return
- }
-
-explorerHidden() { ; toggle show/hide hidden folders, stolen from http://www.autohotkey.com/board/topic/68131-turn-off-show-hidden-files-at-boot/
- RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
- If HiddenFiles_Status = 2
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
- Else
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
- WinGetClass, eh_Class,A
- Send, {F5}
- Return
- }
-
-borderlessFullscreen() { ;borderless fullscreen script from PCGW (http://pcgamingwiki.com/wiki/Glossary:Borderless_fullscreen_windowed#Borderless_scripts)
- WinGet, WindowID, ID, A
- WinSet, Style, -0xC40000, ahk_id %WindowID%
- WinMove, ahk_id %WindowID%, , 0, 0, A_ScreenWidth, A_ScreenHeight
- Return
- }
+ backupClipboard = %clipboard%
+ Send, ^c
+ clipboard = %backupClipboard%`r`n%clipboard%
+ backupClipboard =
+ Return
+}
+
+pasteClipboard() {
+ ; manually paste clipboard, minus most formatting
+ tempClipboard = %clipboard%
+ StringReplace, tempClipboard, tempClipboard, ?,, All ; remove bullet points
+ StringReplace, tempClipboard, tempClipboard, ·,, All ; remove middots
+ StringReplace, tempClipboard, tempClipboard, %A_Tab%,, All ; remove tabs
+ StringReplace, tempClipboard, tempClipboard, /,%A_Space%, All ; forward slashes mess up linux paths
+ StringReplace, tempClipboard, tempClipboard, +44,0, All ; remove international dialling code without a space
+ StringReplace, tempClipboard, tempClipboard, `r,, All ; remove half of line breaks
+ StringReplace, tempClipboard, tempClipboard, `n,, All ; remove other half of line breaks
+ tempClipboard = %tempClipboard% ; trim whitespace
+ SendRaw %tempClipboard%
+ tempClipboard =
+ Return
+}
+
+toggleFullscreen() {
+ ;double click the window
+ CoordMode, Mouse, Relative
+ MouseMove, 250, 250
+ Send {Click 2}
+ Return
+}
+
+explorerHidden() {
+ ; toggle show/hide hidden folders, stolen from http://www.autohotkey.com/board/topic/68131-turn-off-show-hidden-files-at-boot/
+ RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
+ If HiddenFiles_Status = 2
+ RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
+ Else
+ RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
+ WinGetClass, eh_Class,A
+ Send, {F5}
+ Return
+}
+
+borderlessFullscreen() {
+ ;borderless fullscreen script from PCGW (http://pcgamingwiki.com/wiki/Glossary:Borderless_fullscreen_windowed#Borderless_scripts)
+ WinGet, WindowID, ID, A
+ WinSet, Style, -0xC40000, ahk_id %WindowID%
+ WinMove, ahk_id %WindowID%, , 0, 0, A_ScreenWidth, A_ScreenHeight
+ Return
+}
forceClose() {
- WinGet, PID, PID, % "ahk_id " WinExist("A")
- Process, Close, %PID%
- }
+ WinGet, PID, PID, % "ahk_id " WinExist("A")
+ Process, Close, %PID%
+}
dailyNotes() {
- formattime, todaysDate,, yyyy-MM-dd
- noteFilename := A_WorkingDir . "\Vault\docs\wfh\notes " . todaysDate . ".txt"
- Run notepad "%noteFilename%"
- Return
- }
-
-toggleAudioDevice() { ;toggle between default audio output (http://ml.pe/optimizing/2013/changing-the-default-sound-device-using-autohotkey/)
- switch := !switch
- If (switch)
- usePlaybackDevice(3)
- Else
- usePlaybackDevice(4)
- Return
- }
+ formattime, todaysDate,, yyyy-MM-dd
+ noteFilename := A_WorkingDir . "\Vault\docs\wfh\notes " . todaysDate . ".txt"
+ Run notepad "%noteFilename%"
+ Return
+}
+
+toggleAudioDevice() {
+ ;toggle between default audio output (http://ml.pe/optimizing/2013/changing-the-default-sound-device-using-autohotkey/)
+ switch := !switch
+ If (switch)
+ usePlaybackDevice(3)
+ Else
+ usePlaybackDevice(4)
+ Return
+}
usePlaybackDevice(device) {
- Run, mmsys.cpl
- WinWaitActive, Sound ahk_class #32770
- ControlSend, SysListView321,{Down %device%}, Sound ahk_class #32770
- ControlClick, Button2, Sound ahk_class #32770
- WinClose, Sound ahk_class #32770
- }
-
-kdeMove() { ;kde-windows (Easy Window Dragging -- KDE style (requires XP/2k/NT) -- by Jonny)
- MouseGetPos,KDE_X1,KDE_Y1,KDE_id
- WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
- If KDE_Win
- WinRestore, A
- WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id%
- Loop
- {
- GetKeyState,KDE_Button,LButton,P ; Break if Button has been released.
- If KDE_Button = U
- Break
- MouseGetPos,KDE_X2,KDE_Y2 ; Get the current Mouse position.
- KDE_X2 -= KDE_X1 ; Obtain an offset from the initial Mouse position.
- KDE_Y2 -= KDE_Y1
- KDE_WinX2 := (KDE_WinX1 + KDE_X2) ; Apply this offset to the window position.
- KDE_WinY2 := (KDE_WinY1 + KDE_Y2)
- WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% ; Move the window to the new position.
- }
- Return
- }
+ Run, mmsys.cpl
+ WinWaitActive, Sound ahk_class #32770
+ ControlSend, SysListView321,{Down %device%}, Sound ahk_class #32770
+ ControlClick, Button2, Sound ahk_class #32770
+ WinClose, Sound ahk_class #32770
+}
+
+kdeMove() {
+ ;kde-windows (Easy Window Dragging -- KDE style (requires XP/2k/NT) -- by Jonny)
+ MouseGetPos,KDE_X1,KDE_Y1,KDE_id
+ WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
+ If KDE_Win
+ WinRestore, A
+ WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id%
+ Loop
+ {
+ GetKeyState,KDE_Button,LButton,P ; Break if Button has been released.
+ If KDE_Button = U
+ Break
+ MouseGetPos,KDE_X2,KDE_Y2 ; Get the current Mouse position.
+ KDE_X2 -= KDE_X1 ; Obtain an offset from the initial Mouse position.
+ KDE_Y2 -= KDE_Y1
+ KDE_WinX2 := (KDE_WinX1 + KDE_X2) ; Apply this offset to the window position.
+ KDE_WinY2 := (KDE_WinY1 + KDE_Y2)
+ WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2% ; Move the window to the new position.
+ }
+ Return
+}
kdeResize() {
- MouseGetPos,KDE_X1,KDE_Y1,KDE_id
- WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
- If KDE_Win
- WinRestore, A
- ; Get the initial window position and size.
- WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
- ; Define the window region the mouse is currently in.
- ; The four regions are Up and Left, Up and Right, Down and Left, Down and Right.
- If (KDE_X1 < KDE_WinX1 + KDE_WinW / 2)
- KDE_WinLeft := 1
- Else
- KDE_WinLeft := -1
- If (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2)
- KDE_WinUp := 1
- Else
- KDE_WinUp := -1
- Loop
- {
- GetKeyState,KDE_Button,RButton,P ; Break if Button has been released.
- If KDE_Button = U
- Break
- MouseGetPos,KDE_X2,KDE_Y2 ; Get the current Mouse position.
- ; Get the current window position and size.
- WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
- KDE_X2 -= KDE_X1 ; Obtain an offset from the initial Mouse position.
- KDE_Y2 -= KDE_Y1
- ; Then, act according to the defined region.
- WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2 ; X of Resized window
- , KDE_WinY1 + (KDE_WinUp+1)/2*KDE_Y2 ; Y of resized window
- , KDE_WinW - KDE_WinLeft *KDE_X2 ; W of resized window
- , KDE_WinH - KDE_WinUp *KDE_Y2 ; H of resized window
- KDE_X1 := (KDE_X2 + KDE_X1) ; Reset the initial position for the next iteration.
- KDE_Y1 := (KDE_Y2 + KDE_Y1)
- }
- Return
- }
+ MouseGetPos,KDE_X1,KDE_Y1,KDE_id
+ WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
+ If KDE_Win
+ WinRestore, A
+ ; Get the initial window position and size.
+ WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
+ ; Define the window region the mouse is currently in.
+ ; The four regions are Up and Left, Up and Right, Down and Left, Down and Right.
+ If (KDE_X1 < KDE_WinX1 + KDE_WinW / 2)
+ KDE_WinLeft := 1
+ Else
+ KDE_WinLeft := -1
+ If (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2)
+ KDE_WinUp := 1
+ Else
+ KDE_WinUp := -1
+ Loop
+ {
+ GetKeyState,KDE_Button,RButton,P ; Break if Button has been released.
+ If KDE_Button = U
+ Break
+ MouseGetPos,KDE_X2,KDE_Y2 ; Get the current Mouse position.
+ ; Get the current window position and size.
+ WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
+ KDE_X2 -= KDE_X1 ; Obtain an offset from the initial Mouse position.
+ KDE_Y2 -= KDE_Y1
+ ; Then, act according to the defined region.
+ WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2 ; X of Resized window
+ , KDE_WinY1 + (KDE_WinUp+1)/2*KDE_Y2 ; Y of resized window
+ , KDE_WinW - KDE_WinLeft *KDE_X2 ; W of resized window
+ , KDE_WinH - KDE_WinUp *KDE_Y2 ; H of resized window
+ KDE_X1 := (KDE_X2 + KDE_X1) ; Reset the initial position for the next iteration.
+ KDE_Y1 := (KDE_Y2 + KDE_Y1)
+ }
+ Return
+}
scriptEdit:
- {
- Run notepad "%A_ScriptDir%\%A_ScriptName%"
- Return
- }
+{
+ Run notepad "%A_ScriptDir%\%A_ScriptName%"
+ Return
+}
scriptEditVariables:
- {
- Run notepad "%A_ScriptDir%\variables.ahk"
- Return
- }
+{
+ Run notepad "%A_ScriptDir%\variables.ahk"
+ Return
+}
; autorun script section in tray menu
scriptAutorun:
- {
- ; delete and recreate registry key
- RegDelete, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %A_ScriptName%
- RegWrite, REG_SZ, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %A_ScriptName%, "%A_ScriptDir%\%A_ScriptName%"
- Return
- }
+{
+ ; delete and recreate registry key
+ RegDelete, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %A_ScriptName%
+ RegWrite, REG_SZ, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %A_ScriptName%, "%A_ScriptDir%\%A_ScriptName%"
+ Return
+}
; auto-reload script on source change
changeReload:
- {
- FileGetAttrib, FileAttribs, %A_ScriptFullPath%
- IfInString, FileAttribs, A
- {
- FileSetAttrib, -A, %A_ScriptFullPath%
- TrayTip, Reloading Script..., %A_ScriptName%, , 1
- Reload
- Sleep, 5000
- TrayTip
- }
- Return
- }
-
+{
+ FileGetAttrib, FileAttribs, %A_ScriptFullPath%
+ IfInString, FileAttribs, A
+ {
+ FileSetAttrib, -A, %A_ScriptFullPath%
+ TrayTip, Reloading Script..., %A_ScriptName%, , 1
+ Reload
+ Sleep, 5000
+ TrayTip
+ }
+ Return
+} \ No newline at end of file