From b37dc10eb4968e29208c7939ac0f7a1edda5fe68 Mon Sep 17 00:00:00 2001 From: breadcat Date: Sat, 17 Aug 2013 14:01:38 +0100 Subject: Include Detect OS Merge both Windows XP and Windows 7 specific hotkey into a single file via OS detection. --- appspecific.ahk | 114 +++++++++++++++++++++++++++++++++----------------------- borders.ahk | 90 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+), 47 deletions(-) create mode 100644 borders.ahk diff --git a/appspecific.ahk b/appspecific.ahk index 776af5b..ace2b0d 100644 --- a/appspecific.ahk +++ b/appspecific.ahk @@ -1,12 +1,70 @@ +;application specific hotkeys -;explorer -win7 -#IfWinActive ahk_class CabinetWClass - Capslock::SendInput {ALTDOWN}{UP}{ALTUP} ;capslock goes up a folder - F6::Send {ALTDOWN}d{ALTUP} ;addressbar - F1::Send {F2} ;disable help, enable rename -#IfWinActive +;detect os +if A_OSVersion in WIN_NT4,WIN_95,WIN_98,WIN_ME,WIN_XP +{ + ;windows xp: + + ;explorer + #IfWinActive ahk_class CabinetWClass + F1::Send {F2}{CTRLDOWN}{HOME}{SHIFTDOWN}{END}{CTRLUP}{LEFT 4}{SHIFTUP} ; rename (hopefully) deselects file extension + F2::Send {F2}{CTRLDOWN}{HOME}{SHIFTDOWN}{END}{CTRLUP}{LEFT 4}{SHIFTUP} ; rename (hopefully) deselects file extension + ^+n::Send {ALTDOWN}f{ALTUP}wf ; ctrl+shift+n creates new folder + #IfWinActive + + ;outlook + #IfWinActive ahk_class rctrl_renwnd32 + ^enter::Return ;disable accidentally send email shortcut + #IfWinActive + + ;excel + #IfWinActive ahk_class XLMAIN + ^+v::Send {ESC}{UP}{CTRLDOWN}c{CTRLUP}{DOWN}{CTRLDOWN}v{CTRLUP}{ESC}{DOWN} ;ctrl+shift+v copies above cell into current + #IfWinActive + + ;mstsc + #IfWinActive ahk_class #32770 + ^enter::Send 10.0.0.5{enter} ;tserver + ^+enter::Send 10.0.0.10{enter} ;dserer + #IfWinActive + + ;act + #IfWinActive ahk_class WindowsForms10.Window.8.app.0.2004eee + ^enter::Send {CONTROLDOWN}{END}{CONTROLUP}{SPACE}-PG{SHIFTDOWN}{TAB 3}{SHIFTUP}{ENTER} ;save note with footer + ^n::Send {F9} ;insert note + ^f::Send {ALTDOWN}L{ALTUP}C ;search for company + #IfWinActive +} +Else +{ + ;windows 7: + + ;explorer + #IfWinActive ahk_class CabinetWClass + Capslock::SendInput {ALTDOWN}{UP}{ALTUP} ;capslock goes up a folder + F6::Send {ALTDOWN}d{ALTUP} ;addressbar + F1::Send {F2} ;disable help, enable rename + #IfWinActive -;command prompt -winxp + ;photoviewer + #IfWinActive ahk_class Photo_Lightweight_Viewer + Capslock::SendInput {ALTDOWN}{F4}{ALTUP} ;quits + Up::Return ;removes annoying feature where up/down stops left/right naviagation + Down::Return + #IfWinActive + + ;mpc-hc + #IfWinActive ahk_class MediaPlayerClassicW + 1::Send 2{ctrldown}1{ctrlup} ;1 keeps borders + Ralt & Enter::Send {altdown}{enter}{altup} ; ralt-enter fullscreens + Capslock::Send {altdown}{f4}{altup} ;quit + p::Send {ctrldown}7{ctrlup} ;p for playlist + #IfWinActive +} + +;applicable for both: + +;command prompt #IfWinActive ahk_class ConsoleWindowClass ^c:: ;copy Send {Enter} @@ -18,22 +76,7 @@ return #IfWinActive -;photoviewer -win7 -#IfWinActive ahk_class Photo_Lightweight_Viewer - Capslock::SendInput {ALTDOWN}{F4}{ALTUP} ;quits - Up::Return ;removes annoying feature where up/down stops left/right naviagation - Down::Return -#IfWinActive - -;mpc-hc -win7 -#IfWinActive ahk_class MediaPlayerClassicW - 1::Send 2{ctrldown}1{ctrlup} ;1 keeps borders - Ralt & Enter::Send {altdown}{enter}{altup} ; ralt-enter fullscreens - Capslock::Send {altdown}{f4}{altup} ;quit - p::Send {ctrldown}7{ctrlup} ;p for playlist -#IfWinActive - -;chrome/chromium -win7 +;chrome/chromium #IfWinActive ahk_class Chrome_WidgetWin_1 ^+w::Send {CTRLDOWN}w{CTRLUP} ^q::Send {CTRLDOWN}w{CTRLUP} ;quit now closes tab, the two keys are too close for this sort of thing @@ -41,30 +84,7 @@ ^+h::Send {CTRLDOWN}t{CTRLUP}chrome://chrome/settings/clearBrowserData{ENTER} ;delete history page #IfWinActive -;remote desktop -winxp -#IfWinActive ahk_class #32770 - ^enter::Send 10.0.0.5{enter} ;tserver - ^+enter::Send 10.0.0.10{enter} ;dserer -#IfWinActive - -;act -winxp -#IfWinActive ahk_class WindowsForms10.Window.8.app.0.2004eee - ^enter::Send {CONTROLDOWN}{END}{CONTROLUP}{SPACE}-PG{SHIFTDOWN}{TAB 3}{SHIFTUP}{ENTER} ;save note with footer - ^n::Send {F9} ;insert note - ^f::Send {ALTDOWN}L{ALTUP}C ;search for company -#IfWinActive - -;outlook -winxp -#IfWinActive ahk_class rctrl_renwnd32 - ^enter::Return ;disable accidentally send email shortcut -#IfWinActive - -;excel -winxp -#IfWinActive ahk_class XLMAIN - ^+v::Send {ESC}{UP}{CTRLDOWN}c{CTRLUP}{DOWN}{CTRLDOWN}v{CTRLUP}{ESC}{DOWN} ;ctrl+shift+v copies above cell into current -#IfWinActive - -;notepad2 -win7 +;notepad2 #IfWinActive ahk_class Notepad2 !z::Return ;disable delete first char of line 'feature; ^Down::Send {Down} ; disable shift line down feature diff --git a/borders.ahk b/borders.ahk new file mode 100644 index 0000000..0261e6e --- /dev/null +++ b/borders.ahk @@ -0,0 +1,90 @@ +;window border removal ahk script +;for use at work, on XP + +;doesn't work via include, must run standalone + +GoSub, HookWindow + +HookWindow: + ; New Window Hook + Gui +LastFound + hWnd := WinExist() + + DllCall( "RegisterShellHookWindow", UInt,hWnd ) + MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" ) + OnMessage( MsgNum, "ShellMessage" ) + + ShellMessage(wParam,lParam) { + If (wParam = 1) ; HSHELL_WINDOWCREATED := 1 + { + Sleep, 10 + AdjustWindow(lParam) + } + } +Return + +AdjustWindow(id) +{ + WinId := id + WinTitle := id = "A" ? "A" : "ahk_id " . id + + ; This is to check if the window is shown in the alt-tab menu, you don't want to do it on every single frame + WinGet, WinExStyle, ExStyle, %WinTitle% + If (WinExStyle & 0x80) + { + Return + } + + WinGetClass, WinClass, %WinTitle% + WinGet, WinProcess, ProcessName, %WinTitle% + + If WinClass In % "CabinetWClass" + If WinProcess In % "explorer.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + + + + If WinClass In % "ShImgVw:CPreviewWnd" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "Photoshop.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "sumatrapdf.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "mintty.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "7zFM.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "msaccess.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "excel.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "Notepad2.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } + If WinProcess In % "outlook.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + Winset, AlwaysOnTop, off, %WinTitle% + } + If WinProcess In % "winword.exe" + { + WinSet, Style, -0xC00000, %WinTitle% + } +} \ No newline at end of file -- cgit v1.2.3