From 12b05bbc72643b2c3a03b287c88f45f43d177934 Mon Sep 17 00:00:00 2001 From: breadcat Date: Fri, 30 Oct 2015 10:43:50 +0000 Subject: Large, overdue commit Merge Send/Sleep commands Uniform comment style Reorganise order to make more sense Add more typo replacements Add more hotkeys Script can now send to RDP --- ahk-assistant.ahk | 316 ++++++++++++++++++++++++++++-------------------------- functions.ahk | 37 ++++--- 2 files changed, 186 insertions(+), 167 deletions(-) diff --git a/ahk-assistant.ahk b/ahk-assistant.ahk index fdc00a9..ea41846 100644 --- a/ahk-assistant.ahk +++ b/ahk-assistant.ahk @@ -1,76 +1,73 @@ +; ahk-assistant ; ^ctrl #win !alt +shift -;environment +; environment #NoEnv #SingleInstance,Force -SetTimer, ScriptReload, 1000 +SetTimer, changeReload, 1000 +SetTimer, remoteReload, 1000 CoordMode,Mouse SetWorkingDir %A_MyDocuments%\..\ -ProgramFilesX86 := A_ProgramFiles . (A_PtrSize=8 ? " (x86)" : "") ;pfx86 variable from http://www.autohotkey.com/board/topic/79160-a-programfiles-for-programs-in-windows-7-x86-directory/ - -;reduce delays -SetWinDelay,0 -SetControlDelay,0 - -;keystates +ProgramFilesX86 := A_ProgramFiles . (A_PtrSize=8 ? " (x86)" : "") ; pfx86 variable from http://www.autohotkey.com/board/topic/79160-a-programfiles-for-programs-in-windows-7-x86-directory/ +SetWinDelay,1 +SetKeyDelay,1 +SetControlDelay,1 SetCapsLockState, AlwaysOff SetScrollLockState, AlwaysOff SetNumLockState, AlwaysOn +#Include, *i %A_ScriptDir%\variables.ahk ; physical and ip address completions, only included if exists. See .gitignore for details +#Include, %A_ScriptDir%\functions.ahk ; all those long winded functions -;includes -#Include, *i %A_ScriptDir%\variables.ahk ;physical and ip address completions, only included if exists. See .gitignore for details -#Include, %A_ScriptDir%\functions.ahk ;all those long winded functions -;hotkeys +; global hotkeys #q::Run notepad -^q::Send !{F4} ;quit most programs +^q::Send !{F4} ; quit most programs #+q::Run notepad "%A_MyDocuments%\Vault\docs\faulties.txt" #w::Run firefox #+w::Run firefox.exe -private-window #e::dirWorking() #+e::dirSync() -^!e::Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ;my computer -^!r::Run mstsc ;remote desktop connection +^!e::Run ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ; my computer +^!r::Run mstsc ; remote desktop connection ^!+r::mstscSpecific() #t::launchTerminal() #+t::Run cmd ^!t::pasteTelephone() -#p::Run "%ProgramFilesX86%\PuTTY\putty.exe" ;putty +#p::Run "%ProgramFilesX86%\PuTTY\putty.exe" ; putty #Enter::dialTelephone() #+Enter::searchCustomer() -^!b::Run %programfiles%\TeamViewer\Version9\TeamViewer.exe -^!v::Run %ProgramFilesX86%\TightVNC\tvnviewer.exe +*CapsLock::BackSpace ^!k::launchKeepass() -#c::Run calc -^+v::Send %clipboard% ;manually paste clipboard, minus formatting -#\::SendMessage 0x112, 0xF170, 2, , Program Manager ;W-\ - screen standby +#\::SendMessage 0x112, 0xF170, 2, , Program Manager ; W-\ - screen standby ^!\::DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0) ; C-A-\ - system standby -SC029::Send, 0 ;Backtick send zeroes -+SC029::Send, `` ;S-Backtick send backticks -^SC029::Send, `¬ ;C-Backtick send negations +#c::Run calc +^!v::Run %ProgramFilesX86%\TightVNC\tvnviewer.exe +^+v::pasteClipboard() +^!Space::toggleAudioDevice() RAlt & j::ShiftAltTab RAlt & k::AltTab -*CapsLock::BackSpace -!^0::Send {Volume_Mute} ;C-A-0 volume mute toggle -!^-::Send {Volume_Down 3} ;C-A-- volume down -!^=::Send {Volume_Up 3} ;C-A-+ volume up +Ralt & PgUp::Send {WheelUp} +Ralt & PgDn::Send {WheelDown} +SC029::Send, 0 ; Backtick send zeroes ++SC029::Send, `` ; S-Backtick send backticks +^SC029::Send, `¬ ; C-Backtick send negations +!^0::Send {Volume_Mute} ; C-A-0 volume mute toggle +!^-::Send {Volume_Down 3} ; C-A-- volume down +!^=::Send {Volume_Up 3} ; C-A-+ volume up ^!+Up::changeResolution(1920,1080) ^!+Down::changeResolution(1280,720) -XButton1::Send {Click 2} ;remap logitech m570 x1 to double click -XButton2::Send {MButton} ;remap logitech m570 x2 to wheel click +XButton1::Send {Click 2} ; remap logitech m570 x1 to double click +XButton2::Send {MButton} ; remap logitech m570 x2 to wheel click Insert::appendClipboard() -^!Space::toggleAudioDevice() -Ralt & PgUp::Send {WheelUp} -Ralt & PgDn::Send {WheelDown} +#LButton::WinSet, Style, -0x840000, A ; W-Click - remove window borders !LButton::kdeMove() !RButton::kdeResize() - ;tiling #Up::WinMaximize, A #Down::WinMinimize, A -#+Down::Send !{Esc} ;Send to bottom instead of minimise +#+Down::Send !{Esc} ; Send to bottom instead of minimise #Left::Tile("L") #Right::Tile("R") #Numpad1::Tile("BL") @@ -83,9 +80,10 @@ Ralt & PgDn::Send {WheelDown} #Numpad8::Tile("T") #Numpad9::Tile("TR") #Numpad0::winSplit() -#NumpadIns::winSplitH() ;W-S-Num0 +#NumpadIns::winSplitH() ; W-S-Num0 -;text replacements + +; text insertion/replacements :*?:_date:: insertDate() Return @@ -98,6 +96,9 @@ Ralt & PgDn::Send {WheelDown} :*?:_gw:: insertGateway() Return +:*?:_ip:: + Send, %A_IPAddress1% + Return :*?:_sig:: insertSignature() Return @@ -140,31 +141,31 @@ Ralt & PgDn::Send {WheelDown} :*:_cw:: insertCygwin() Return - -;swedish +; special character insertion +; swedish :c*?:(Ao)::Å :c*?:(ao)::å :c*?:(Ai)::Ä :c*?:(ai)::ä :c*?:(Oi)::Ö :c*?:(oi)::ö -;norwegian +; norwegian :c*?:(AE)::Æ :c*?:(ae)::æ :c*?:(O/)::Ø :c*?:(o/)::ø -;german +; german :c*?:(Ui)::Ü :c*?:(ui)::ü :*?:(ss)::ß -;spanish +; spanish :c?*:(N~)::Ñ :c?*:(n~)::ñ :c?*:(A-)::Á :c?*:(a-)::á :c?*:(E-)::É :c?*:(e-):: - Send {ASC 130} ;C-A-e insertion for é is weird + Send {ASC 130} ; C-A-e insertion for é is weird Return :c?*:(I-)::Í :c?*:(i-)::í @@ -174,7 +175,7 @@ Ralt & PgDn::Send {WheelDown} :c?*:(u-)::ú :*?:(!!)::¡ :*?:(??)::¿ -;symbols +; symbols :*?:(c)::© :*?:(r)::® :*?:(tm)::™ @@ -184,7 +185,10 @@ Ralt & PgDn::Send {WheelDown} :*?:(quart)::¼ :*?:(div)::÷ :*?:(micro)::µ -;stupid fingers +:*?:(bull)::• +:*?:(middot)::· +; stupid fingers +:*:i'::I' :*:adn::and :*:teh::the :*:tehy::they @@ -196,14 +200,18 @@ Ralt & PgDn::Send {WheelDown} :*:attendent::attendant :*:consistant::consistent :*:propogate::propagate +:*:occurance::occurence :*:refridgeration::refrigeration :*:secratery::secretary +:*:cinammon::cinnamon +:*:competative::competitive :*:fiber::fibre :*:liase::liaise +:*:liasing::liaising :*:sieze::seize :*:imediate::immediate :*:excercise::exercise -;work stuff +; work stuff :*:ctsty::Called to speak to you, their number is :*:gtacb::Called to speak to you, can you give them a call back? :*:ctt::Feel free to close the ticket. @@ -241,164 +249,159 @@ Ralt & PgDn::Send {WheelDown} :*:btk::BT Elements 1K :*:btd::BT Diverse 7110+ -;application specific hotkeys -#IfWinActive ahk_class #32770 ;save/load dialog - F1:: ;overflow to rename, help is useless in explorer - F2::explorerRename() ;rename commands + +; application specific hotkeys +#IfWinActive ahk_class #32770 ; save/load dialog + F1:: ; overflow to rename, help is useless in explorer + F2::explorerRename() ; rename commands #IfWinActive -#IfWinActive ahk_class CabinetWClass ;explorer +#IfWinActive ahk_class CabinetWClass ; explorer CapsLock::explorerUp() - Alt & Enter:: ;overflow + Alt & Enter:: ; overflow Ralt & Enter::Send {AppsKey}{Up}{Enter} ; ralt-enter properties - F1:: ;overflow to rename, help is useless in explorer - F2::explorerRename() ;rename commands + F1:: ; overflow to rename, help is useless in explorer + F2::explorerRename() ; rename commands F3::explorerCMD() - F6::Send !d ;addressbar + F6::Send !d ; addressbar + ^Backspace::Send ^+{Left}{Backspace} ; backspace a word ^h::explorerHidden() ^+n::explorerNewDir() ^!+n::explorerNewFile() - ^s::Send !vb ;view > status bar - ^0::Send !vd ;view > details - ^-::Send ^{WheelDown 2} ;zoom out - ^=::Send ^{WheelUp 2} ;zoom in + ^s::Send !vb ; view > status bar + ^0::Send !vd ; view > details + ^-::Send ^{WheelDown 2} ; zoom out + ^=::Send ^{WheelUp 2} ; zoom in + #+Space::Send !vl!v+h ; fix weird xp explorer bug where you get no labels on thumbnails #IfWinActive -#IfWinActive ahk_class ShockwaveFlashFullScreen ;full screen flash - Ralt & Enter:: ;overflow - Alt & Enter::toggleFullscreen() ;leave flash full screen with a keyboard command +#IfWinActive ahk_class ShockwaveFlashFullScreen ; full screen flash + Ralt & Enter:: ; overflow + Alt & Enter::toggleFullscreen() ; leave flash full screen with a keyboard command #IfWinActive -#IfWinActive ahk_class #32770 ;windows xp date/time picker - CapsLock::Send !{F4} ;quit +#IfWinActive ahk_class #32770 ; windows xp date/time picker + CapsLock::Send !{F4} ; quit #IfWinActive -#IfWinActive ahk_class FontViewWClass ;font previewer - CapsLock::Send !{F4} ;quit +#IfWinActive ahk_class FontViewWClass ; font previewer + CapsLock::Send !{F4} ; quit #IfWinActive #IfWinActive ahk_class SciCalc ; windows xp calc - CapsLock::Send !{F4} ;quit + CapsLock::Send !{F4} ; quit #IfWinActive #IfWinActive ahk_class CalcFrame ; windows 7 calc - CapsLock::Send !{F4} ;quit + CapsLock::Send !{F4} ; quit #IfWinActive -#IfWinActive ahk_class ShImgVw:CPreviewWnd ;photoviewer windows xp - CapsLock::Send !{F4} ;quit - ^-::Send {-} ;zoom out - ^=::Send {+} ;zoom in +#IfWinActive ahk_class ShImgVw:CPreviewWnd ; photoviewer windows xp + CapsLock::Send !{F4} ; quit + ^-::Send {-} ; zoom out + ^=::Send {+} ; zoom in #IfWinActive -#IfWinActive ahk_class Photo_Lightweight_Viewer ;photoviewer windows 7 - CapsLock::Send !{F4} ;quit - Up:: ;overflow - Down::Return ;fixes up/down breaking left/right navigation +#IfWinActive ahk_class Photo_Lightweight_Viewer ; photoviewer windows 7 + CapsLock::Send !{F4} ; quit + Up:: ; overflow + Down::Return ; fixes up/down breaking left/right navigation #IfWinActive -#IfWinActive ahk_class SUMATRA_PDF_FRAME ;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 +#IfWinActive ahk_class SUMATRA_PDF_FRAME ; 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 #IfWinActive -#IfWinActive ahk_class MediaPlayerClassicW ;mpc-hc - 1::Send 2^1 ;1 keeps borders +#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 + CapsLock::Send !{F4} ; quit + p::Send ^7 ; p for playlist #IfWinActive -#IfWinActive ahk_class mpv ;mpv - Alt & Enter:: ;overflow to fullscreen below - Ralt & Enter::Send f ;ralt-Enter fullscreens - CapsLock::Send !{F4} ;quit +#IfWinActive ahk_class mpv ; mpv + Alt & Enter:: ; overflow to fullscreen below + Ralt & Enter::Send f ; ralt-Enter fullscreens + 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 +#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 #IfWinActive -#IfWinActive ahk_class XLMAIN ;excel - ^+v::Send ^'{Down} ;C-S-v copies above cell contents into current - ^+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 +#IfWinActive ahk_class XLMAIN ; excel + ^+v::Send ^'{Down} ; C-S-v copies above cell contents into current + ^+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::excelFormulaBar() - F11::Send !vu ;fullscreen - ^Tab::Send ^{PgDn} ;next sheet - ^+Tab::Send ^{PgUp} ;prev sheet -#IfWinActive - -#IfWinActive ahk_class WindowsForms10.Window.8.app.0.2004eee ;act - ^Enter:: - Send ^{End}{Space} - insertSignature() - Send +{Tab 3}{Enter} ;save note with footer - Return - ^n::Send {F9} ;insert note - ^f::Send !LC ;search for company + F11::Send !vu ; fullscreen + ^Tab::Send ^{PgDn} ; next sheet + ^+Tab::Send ^{PgUp} ; prev sheet #IfWinActive -#IfWinActive ahk_class ConsoleWindowClass ;command prompt - ^c::Send {Enter} ;copy - +Insert:: ;overflow to paste - ^v::cmdPaste() ;paste +#IfWinActive ahk_class ConsoleWindowClass ; command prompt + +Insert:: ; overflow to paste + ^v::cmdPaste() ; paste #IfWinActive -#IfWinActive ahk_class ahk_class 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 - #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 !to ;C-S-o options - F1:: ;overflow - F2::tabSplit() ;split current tab from window and tile, kinda flakey and in need of improvement - 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 & Enter:: ;overflow - Alt & Enter::toggleFullscreen() ;leave flash full screen with a keyboard command +#IfWinActive ahk_class ahk_class 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 + #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 25} o ; C-S-o options + F1:: ; overflow + F2::tabSplit() ; split current tab from window and tile, kinda flakey and in need of improvement + 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 & Enter:: ; overflow + Alt & Enter::toggleFullscreen() ; leave flash full screen with a keyboard command + :*?:_foot:: + insertCRMFooter() + return #IfWinActive -#IfWinActive ahk_class MSPaintApp ;mspaint - ^=::Send ^{PgUp} ;zoom in - ^-::Send ^{PgDn} ;zoom out +#IfWinActive ahk_class MSPaintApp ; mspaint + ^=::Send ^{PgUp} ; zoom in + ^-::Send ^{PgDn} ; zoom out #IfWinActive -#IfWinActive ahk_class Notepad2 ;notepad2-mod - !z::Return ;disable delete first char of line 'feature; - ^0::Return ;disable annoying transparency feature - !t::Return ;disable always on top - ^+Down:: ;overflow +#IfWinActive ahk_class Notepad2 ; notepad2-mod + ^0::Return ; disable annoying transparency feature + !t::Return ; disable always on top + ^+Down:: ; overflow ^Down::Send {Down} ; disable (alt) shift line down feature - ^+Up:: ;overflow + ^+Up:: ; overflow ^Up::Send {Up} ; disable (alt) shift line up feature #IfWinActive -#IfWinActive ahk_class wxWindowClassNR ;audacity - ^=::Send ^1 ;zoom in - ^-::Send ^3 ;zoom out - ^0::Send ^2 ;zoom reset +#IfWinActive ahk_class wxWindowClassNR ; audacity + ^=::Send ^1 ; zoom in + ^-::Send ^3 ; zoom out + ^0::Send ^2 ; zoom reset #IfWinActive -#IfWinActive ahk_class civ5 ;civilization 5 +#IfWinActive ahk_class civ5 ; civilization 5 F11::borderlessFullscreen() #IfWinActive -;auto-reload on change -ScriptReload: + +changeReload: ; auto-reload on change { FileGetAttrib, FileAttribs, %A_ScriptFullPath% IfInString, FileAttribs, A @@ -411,3 +414,12 @@ ScriptReload: } Return } + +remoteReload: ; reload script when rdp window is detected to allow sending to +IfWinActive, ahk_class TscShellContainerClass +{ + WinWaitNotActive, ahk_class TscShellContainerClass,,3600 +} +WinWaitActive, ahk_class TscShellContainerClass,,3600 +Reload +return diff --git a/functions.ahk b/functions.ahk index 4b46f55..eeb4561 100644 --- a/functions.ahk +++ b/functions.ahk @@ -63,6 +63,15 @@ insertGateway() { Send, %gateway% } +insertCRMFooter() { + Send, {Enter} + insertDateTime() + Send, {Space} + insertSignature() + Send, {F6}javascript:document.getElementById("SAVE_FOOTER").focus(){Sleep 25}{Enter}{Sleep 50}{Space} + Return + } + insertDate() { FormatTime, CurrentDateTime,, yyyy-MM-dd Send %CurrentDateTime% @@ -70,13 +79,13 @@ insertDate() { } insertTime() { - FormatTime, CurrentDateTime,, HHmm + FormatTime, CurrentDateTime,, HH:mm Send %CurrentDateTime% Return } insertDateTime() { - FormatTime, CurrentDateTime,, yyyy-MM-dd HHmm + FormatTime, CurrentDateTime,, yyyy-MM-dd HH:mm Send %CurrentDateTime% Return } @@ -97,6 +106,12 @@ insertSignature() { Send, %A_Space%-%firstinitial%%lastinitial% } +pasteClipboard() { ; manually paste clipboard, minus formatting + StringReplace, clipboard, clipboard, %A_Tab%, `,, All ;remove tabs + SendRaw %clipboard% + Return + } + pasteTelephone() { backupClipboard = %clipboard% Send, ^c @@ -414,29 +429,21 @@ usePlaybackDevice(device) { winSplit() { ;split active and previous window side by side Tile("R") - Sleep, 15 - Send {AltDown}{Tab}{AltUp} - Sleep, 10 + Send {Sleep 15}{AltDown}{Tab}{AltUp}{Sleep 10} Tile("L") - Sleep, 15 - Send {AltDown}{Tab}{AltUp} + Send {Sleep 15}{AltDown}{Tab}{AltUp} } winSplitH() { ;split active and previous window on top of each other Tile("T") - Sleep, 15 - Send {AltDown}{Tab}{AltUp} - Sleep, 10 + Send {Sleep 15}{AltDown}{Tab}{AltUp}{Sleep 10} Tile("B") - Sleep, 15 - Send {AltDown}{Tab}{AltUp} + Send {Sleep 15}{AltDown}{Tab}{AltUp} } tabSplit() { Tile("L") ;tiles left - Sleep 25 ;waits for tile to finish - Send {Esc}{F6}+{Tab 2}{AppsKey}w ;break off current tab - Sleep 250 ;wait for firefox to catch up + Send {Sleep 50}{Esc}{F6}+{Tab 2}{AppsKey}w{Sleep 250} ;break off current tab WinMaximize, A ;fixes black borders on bottom Tile("R") ;tiles right Return ;and you're back in the room -- cgit v1.2.3