diff options
author | breadcat | 2015-04-09 10:17:56 +0100 |
---|---|---|
committer | breadcat | 2015-04-09 10:17:56 +0100 |
commit | 97405f371626282a6db8ebedf9d55c42c7ebc246 (patch) | |
tree | 0aa2050fe774d3cd94b6cd768df6b7824c3a5976 | |
parent | 86198de452918af94aec4bd5e0918b494595f125 (diff) | |
download | ahka-97405f371626282a6db8ebedf9d55c42c7ebc246.tar.gz ahka-97405f371626282a6db8ebedf9d55c42c7ebc246.tar.bz2 ahka-97405f371626282a6db8ebedf9d55c42c7ebc246.zip |
Further refactoring
Makes for a tidier project, added a couple features and made some small
changes.
-rw-r--r-- | ahk-assistant.ahk | 119 | ||||
-rw-r--r-- | appspecific.ahk | 163 | ||||
-rw-r--r-- | functions.ahk | 103 |
3 files changed, 209 insertions, 176 deletions
diff --git a/ahk-assistant.ahk b/ahk-assistant.ahk index 69195fe..79d6367 100644 --- a/ahk-assistant.ahk +++ b/ahk-assistant.ahk @@ -17,7 +17,6 @@ SetScrollLockState, AlwaysOff SetNumLockState, AlwaysOn ;includes -#Include, %A_ScriptDir%\appspecific.ahk ;application specific hotkeys #Include, %A_ScriptDir%\functions.ahk ;all those long winded functions #Include, *i %A_ScriptDir%\secret.ahk ;physical and ip address completions, only included if exists. @@ -34,6 +33,7 @@ SetNumLockState, AlwaysOn #t:: launchTerminal() #+t::Run cmd ^!t::pasteTelephone() +#y::send,{end}{shift down}{home}{shift up}{del}https://www.youtube.com/watch?v={ctrl down}v{ctrl up} ;create youtube link from ID ^!b::Run %programfiles%\TeamViewer\Version9\TeamViewer.exe ^!v::Run %programfiles%\TightVNC\tvnviewer.exe #p::Run "%ProgramFilesX86%\PuTTY\putty.exe" ;putty @@ -88,6 +88,7 @@ Insert::appendClipboard() ::recieved::received ::license::licence ::licenses::licences +::equivelant::equivalent ::equivelants::equivalents ::attendent::attendant ::propogate::propagate @@ -129,12 +130,126 @@ Insert::appendClipboard() :*:btd`t::BT Diverse 7110+ ;auto/tab completions -:*:ytv::createYoutubeLink() :*:gd`t::typeSyncDocs() :*:md`t::typeDocuments() :*:db`t::typeSync() :*:cw`t::typeCygwin() +;application specific hotkeys +#IfWinActive ahk_class CabinetWClass ;explorer + Capslock::explorerUp() + F6::Send !d ;addressbar + Ralt & Enter::Send {AppsKey}{Up}{Enter} ; ralt-enter properties + F1:: ;overflow to rename, help is useless in explorer + F2::explorerRename() ;rename commands + F3::explorerCMD() + ^h::explorerHidden() + ^+n::explorerNewDir() + ^!+n::explorerNewFile() +#IfWinActive + +#IfWinActive ahk_class FontViewWClass ;font previewer + Capslock::Send !{F4} ;quit +#IfWinActive + +#IfWinActive ahk_class SciCalc ; windows xp calc + Capslock::Send !{F4} ;quit +#IfWinActive +#IfWinActive ahk_class CalcFrame ; windows 7 calc + Capslock::Send !{F4} ;quit +#IfWinActive + +#IfWinActive ahk_class ShImgVw:CPreviewWnd ;photoviewer windows xp + Capslock::Send !{F4} ;quit +#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 + +#IfWinActive ahk_class SUMATRA_PDF_FRAME ;sumatra pdf + Capslock::Send !{F4} ;quit + ^b::Send {F12} ; ctrl+b for bookmarks + !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 +#IfWinActive + +#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 +#IfWinActive + +#IfWinActive ahk_class XLMAIN ;excel + ^+v::Send {Esc}{Up}^c{Down}^v{Esc}{Down} ;ctrl+shift+v copies above cell into current + ^F2::Send {AltDown}o{AltUp}hr ;rename sheet + F3::Send {CtrlDown}f{CtrlUp}{Enter}{Escape} ;f3 searches for the same string again + F6::excelFormulaBar() +#IfWinActive + +#IfWinActive ahk_class WindowsForms10.Window.8.app.0.2004eee ;act + ^Enter::Send ^{End}{Space}-PG+{Tab 3}{Enter} ;save note with footer + ^n::Send {F9} ;insert note + ^f::Send !LC ;search for company +#IfWinActive + +#IfWinActive ahk_class ConsoleWindowClass ;command prompt + ^c::Send {Enter} ;copy + +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 + f6::Send ^l ;F6 jumps to address bar + ^+o::Send {AltDown}t<{AltUp}o ;ctrl+shift+o option + #o::Send, ^c^t^v{Enter} ;copy selected uri and open, right click option fails to recognise ~50% of what I try + +PgDn::Send {Space 4}{Down 7} ;scroll down to specific part of a specific page, not really + +PgUp::Send {Home} ;makes sense, kinda +#IfWinActive + +#IfWinActive ahk_class MSPaintApp ;mspaint + ^=::Send {CtrlDown}{PgUp}{CtrlUp} ;zoom in + ^-::Send {CtrlDown}{PgDn}{CtrlUp} ;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 + ^Down::Send {Down} ; disable (alt) shift line down feature + ^+Up:: ;overflow + ^Up::Send {Up} ; disable (alt) shift line up feature +#IfWinActive + +#IfWinActive ahk_class wxWindowClassNR ;audacity + ^=::Send {CtrlDown}1{CtrlUp} ;zoom in + ^-::Send {CtrlDown}3{CtrlUp} ;zoom out + ^0::Send {CtrlDown}2{CtrlUp} ;zoom reset +#IfWinActive + +#IfWinActive ahk_class civ5 ;civilization 5 + F11::borderlessFullscreen() +#IfWinActive + + ScriptReload: ;auto-reload on change { FileGetAttrib, FileAttribs, %A_ScriptFullPath% diff --git a/appspecific.ahk b/appspecific.ahk deleted file mode 100644 index 34f50be..0000000 --- a/appspecific.ahk +++ /dev/null @@ -1,163 +0,0 @@ - -#IfWinActive ahk_class CabinetWClass ;explorer - Capslock:: ;up one folder - if A_OSVersion in WIN_XP - { - Send {Backspace} - } - Else - { - Send !{Up} - } - Return - F6::Send !d ;addressbar - Ralt & Enter::Send {AppsKey}{Up}{Enter} ; ralt-enter properties - F1:: ;overflow to rename, help is useless in explorer - F2:: ;rename commands - if A_OSVersion in WIN_XP - { - Send {F2}{Ctrldown}{Home}{Shiftdown}{End}{Ctrlup}{Left 4}{Shiftup} ; rename (hopefully) deselects file extension - } - Else - { - Send {F2} - } - Return - F3:: ;cmd to path - ClipSaved := ClipboardAll - Send !d - Sleep 10 - Send ^c - Run, cmd /K "cd `"%clipboard%`"" - Clipboard := ClipSaved - ClipSaved = - Return - ^h:: ;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 - If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA" OR A_OSVersion = "WIN_7") - send, {F5} - Else PostMessage, 0x111, 28931,,, A - Return - ^+n::Send {AltDown}f{AltUp}wf ;windows xp only -#IfWinActive - -#IfWinActive ahk_class FontViewWClass ;font previewer - Capslock::Send !{F4} ;quit -#IfWinActive - -#IfWinActive ahk_class SciCalc ; windows xp calc - Capslock::Send !{F4} ;quit -#IfWinActive -#IfWinActive ahk_class CalcFrame ; windows 7 calc - Capslock::Send !{F4} ;quit -#IfWinActive - -#IfWinActive ahk_class Photo_Lightweight_Viewer ;photoviewer windows 7 - Capslock::Send !{F4} ;quit - Up::Return ;removes annoying feature where up/down stops left/right naviagation - Down::Return -#IfWinActive - -#IfWinActive ahk_class ShImgVw:CPreviewWnd ;photoviewer windows xp - Capslock::Send !{F4} ;quit -#IfWinActive - -#IfWinActive ahk_class SUMATRA_PDF_FRAME ;sumatra pdf - Capslock::Send !{F4} ;quit - ^b::Send {F12} ; ctrl+b for bookmarks - !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 -#IfWinActive - -#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 -#IfWinActive - -#IfWinActive ahk_class XLMAIN ;excel - ^+v::Send {Esc}{Up}^c{Down}^v{Esc}{Down} ;ctrl+shift+v copies above cell into current - ^F2::Send {AltDown}o{AltUp}hr ;rename sheet - F3::Send {CtrlDown}f{CtrlUp}{Enter}{Escape} ;f3 searches for the same string again - F6:: ;jumps to formula bar - CoordMode, Mouse, Relative - MouseMove, 180, 60 - Send {LButton} - return -#IfWinActive - -#IfWinActive ahk_class WindowsForms10.Window.8.app.0.2004eee ;act - ^Enter::Send ^{End}{Space}-PG+{Tab 3}{Enter} ;save note with footer - ^n::Send {F9} ;insert note - ^f::Send !LC ;search for company -#IfWinActive - -#IfWinActive ahk_class ConsoleWindowClass ;command prompt - ^c:: ;copy - Send {Enter} - return - +Insert:: - ^v:: ;paste - CoordMode, Mouse, Relative - MouseMove, 100, 100 - Send {RButton}p - return -#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 - f6::Send ^l ;F6 jumps to address bar - ^+o::Send {AltDown}t<{AltUp}o ;ctrl+shift+o option - #o::Send, ^c^t^v{Enter} ;copy selected uri and open, right click option fails to recognise ~50% of what I try - +PgDn::Send {Space 4}{Down 7} ;scroll down to specific part of a specific page, not really - +PgUp::Send {Home} ;makes sense, kinda -#IfWinActive - -#IfWinActive ahk_class MSPaintApp ;mspaint - ^=::Send {CtrlDown}{PgUp}{CtrlUp} ;zoom in - ^-::Send {CtrlDown}{PgDn}{CtrlUp} ;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:: - ^Down::Send {Down} ; disable (alt) shift line down feature - ^+Up:: - ^Up::Send {Up} ; disable (alt) shift line up feature -#IfWinActive - -#IfWinActive ahk_class wxWindowClassNR ;audacity - ^=::Send {CtrlDown}1{CtrlUp} ;zoom in - ^-::Send {CtrlDown}3{CtrlUp} ;zoom out - ^0::Send {CtrlDown}2{CtrlUp} ;zoom reset -#IfWinActive - -#IfWinActive ahk_class civ5 ;civilization 5 - F12:: ;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 -#IfWinActive diff --git a/functions.ahk b/functions.ahk index e82b71c..13df5ba 100644 --- a/functions.ahk +++ b/functions.ahk @@ -80,12 +80,6 @@ pasteTelephone() { return } -createYoutubeLink() { - send,{end}{shift down}{home}{shift up}{del} - send,https://www.youtube.com/watch?v={ctrl down}v{ctrl up} - return - } - typeSyncDocs() { if A_OSVersion in WIN_XP { @@ -131,6 +125,97 @@ if A_OSVersion in WIN_XP Return } +cmdPaste() { ;C-v / S-insert pastes into cmd + CoordMode, Mouse, Relative + MouseMove, 100, 100 + Send {RButton}p + return + } + +explorerUp() { ;up one folder + if A_OSVersion in WIN_XP + { + Send {Backspace} + } + Else + { + Send !{Up} + } + Return + } + +explorerRename() { + if A_OSVersion in WIN_XP + { + Send {F2}{Ctrldown}{Home}{Shiftdown}{End}{Ctrlup}{Left 4}{Shiftup} ; rename (hopefully) deselects file extension + } + Else + { + Send {F2} + } + Return + } + +explorerCMD() { ;open command prompt in current location + ClipSaved := ClipboardAll + Send !d^c + Run, cmd /K "cd `"%clipboard%`"" + Clipboard := ClipSaved + ClipSaved = + 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 + If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA" OR A_OSVersion = "WIN_7") + send, {F5} + Else PostMessage, 0x111, 28931,,, A + Return + } + +explorerNewDir() { ;allows xp to create new folder from keypress + if A_OSVersion in WIN_XP + { + Send !fwf + } + Else + { + Send ^+n + } + Return + } + +explorerNewFile() { ;create a new blank text file + if A_OSVersion in WIN_XP + { + Send !fwt{End}{Left 4}{ShiftDown}{Home}{ShiftUp} ;new text file, and deselect file extension + } + Else + { + Send !fwt ;clever windows 7 already knows to skip file extensions + } + Return + } + +excelFormulaBar() { ;jumps to formula bar + CoordMode, Mouse, Relative + MouseMove, 180, 60 + Send {LButton} + 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 + } + ;toggle between default audio output (http://ml.pe/optimizing/2013/changing-the-default-sound-device-using-autohotkey/) toggleAudioDevice() { switch := !switch @@ -160,13 +245,9 @@ winSplit() { ;split active and previous window side by side, press again to swap Send {AltDown}{Tab}{AltUp} } else { - Tile("L") - Sleep, 15 Send {AltDown}{Tab}{AltUp} Sleep, 10 - Tile("R") - Sleep, 15 - Send {AltDown}{Tab}{AltUp} + winSplit() } return } |