Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- ; ==================== MACRO ====================
- :*:nl::NULL
- return
- ; WINDOWS KEY + Y TOGGLES FILE EXTENSIONS
- #y::
- RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
- If HiddenFiles_Status = 1
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 0
- Else
- RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
- WinGetClass, eh_Class,A
- If (eh_Class = “#32770” OR A_OSVersion = “WIN_VISTA”)
- send, {F5}
- Else PostMessage, 0x111, 28931,,, A
- Return
- ; ==================== ALTERNATE UP-ARROW ================
- ; Source: https://autohotkey.com/board/topic/62678-go-up-one-level-in-explorer-xp-ala-windows-7-alt-up/
- ; ALT-UP hot key for Explorer in XP to go up one folder level, ala Windows 7
- ;#IfWinActive ahk_class CabinetWClass
- ;!Up:: Send, {bs} ;Xp already has a shorkcut for this
- ;#IfWinActive
- ; ======================= TASKBAR ======================
- #1::
- send, #
- send, {esc}
- send, {tab}
- send, {space}
- return
- ; =========================== CHROME =======================
- ;#ifwinactive ahk_class chrome_widgetwin_1 (This does not work on XP)
- ;#ifwinactive
- +bs::
- SetTitleMatchMode, 2
- if Winactive("Chrome")
- send, ^w
- return
- ; ======================= DESKTOP PROGRAM FOLDER ========================
- #IfWinActive, Prgrms ahk_exe explorer.exe
- $LButton::
- WinGet, ID, ID, A
- Click, 2
- WinClose, ahk_id %ID%
- return
- #IfWinActive
- ; ======================= FOLDER ACTION ========================
- ; #IfWinActive ahk_class CabinetWClass (this not work on XP)
- #IfWinActive, ahk_class ExploreWClass
- ]::
- send, !{space}
- send, x
- return
- [::
- send, !{space}
- send r
- return
- !up::
- send,!v
- send, o
- send, u
- return
- #IfWinActive
- ; ================================== HIDE TASKBAR =====================================
- ; https://autohotkey.com/board/topic/83594-how-to-hide-taskbar-with-hotkey/
- #SingleInstance Force
- !t:: ; Alt+T Hotkey
- WinExist("ahk_class Shell_TrayWnd")
- ControlGetPos,,,, hTB, ahk_class Shell_TrayWnd ; Get Taskbar Height
- t := !t ; Toggle Var (0 or 1)
- VarSetCapacity(area, 16)
- WinGetActiveStats, AT, AW, AH, AX, AY ; Get Active Window Stats
- If (t = "1") { ; Hide
- Top := A_ScreenHeight
- WinHide, ahk_class Shell_TrayWnd ; Hide Taskbar
- WinHide, Start ahk_class Button ; Hide Start Button
- WinMove, %AT%,,,0,, %A_ScreenHeight% ; Increase Active Window's Height
- } Else { ; Show
- Top := A_ScreenHeight - hTB ; Screen Height - Taskbar Height
- WinShow, ahk_class Shell_TrayWnd ; Show Taskbar
- WinShow, Start ahk_class Button ; Show Start Button
- WinMove, %AT%,,,0,, (A_ScreenHeight-hTB) ; Decrease Active Window's Height
- }
- DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 0, UInt,4, UInt,0)
- DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 4, UInt,4, UInt,0)
- DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 8, UInt,4, UInt,A_ScreenWidth)
- DllCall("ntoskrnl.exe\RtlFillMemoryUlong", UInt,&area + 12,UInt,4, UInt,Top)
- DllCall("SystemParametersInfo", UInt,0x2F, UInt,0, UInt,&area, UInt,0)
- return
- ; Hide task: http://hackerspace.kinja.com/another-late-ahk-script-that-hides-the-taskbar-1701996722
- ; ============================ HIDE DESKTOP ICON =================================
- #h::
- MouseGetPos,,,win
- WinGetClass, class, ahk_id %win%
- If class in Progman,WorkerW
- {
- ControlGet, HWND, Hwnd,, SysListView321, ahk_class Progman
- If HWND =
- ControlGet, HWND, Hwnd,, SysListView321, ahk_class WorkerW
- If DllCall("IsWindowVisible", UInt, HWND)
- WinHide, ahk_id %HWND%
- Else
- WinShow, ahk_id %HWND%
- Return
- }
- else
- {
- ; WINDOWS KEY + H TOGGLES HIDDEN FILES
- 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")
- send, {F5}
- Else
- PostMessage, 0x111, 28931,,, A
- Return
- }
- Return
- ;https://autohotkey.com/board/topic/40217-how-to-check-if-desktop-is-active/
- ;https://autohotkey.com/board/topic/46689-my-first-script-for-hidding-desktop-icons/
- ; Double click
- ~LButton::
- If ( A_PriorHotKey = A_ThisHotKey && A_TimeSincePriorHotkey < 400 ) {
- WinGetClass, Class, A
- If Class in Progman,WorkerW
- var := (flag=0) ? "Show" : "Hide"
- flag := !flag
- Control,%var%,, SysListView321, ahk_class Progman
- Control,%var%,, SysListView321, ahk_class WorkerW
- }
- Return
- ;https://autohotkey.com/board/topic/38006-double-click-desktop-to-hide-icons/
- ;https://autohotkey.com/board/topic/38071-toggle-visibility-of-desktop-icons-by-doubleclicking-desktop/
- ; =================== CREATE TXT ==========================
- #IfWinActive, ahk_class ExploreWClass
- ^+t::
- send !f
- loop ;wait until on new menu item
- {
- StatusBarGetText, status
- IfInString, status, new
- {
- break
- }
- send {down}
- }
- send {right}
- send t
- return
- ; =================== CREATE FOLDER ==========================
- ; https://lifehacker.com/5072853/create-new-folders-in-explorer-with-a-shortcut
- ; New folder script -- Creates new folder
- ; in Windows Explorer with Ctrl-N
- ; https://superuser.com/questions/403337/autohotkey-script-not-recognizing-windows-explorer
- #IfWinActive ahk_class ExploreWClass
- ^+n::
- #IfWinActive ahk_class CabinetWClass
- ^+n::
- send !f
- loop ;wait until on new menu item
- {
- StatusBarGetText, status
- IfInString, status, new
- {
- break
- }
- send {down}
- }
- send {right}{enter}
- return
- #IfWinActive
- ; ================== CLOSE ALL WINDOWS ====================
- #F4::
- WinGet, id, list, , , Program Manager
- Loop, %id%
- {
- StringTrimRight, this_id, id%a_index%, 0
- WinGetTitle, this_title, ahk_id %this_id%
- winclose,%this_title%
- }
- Return
- ;=========== VIEW MODE =============
- ; #IfWinActive ahk_class CabinetWClass (This not work on XP)
- #IfWinActive, ahk_class ExploreWClass
- ; alt+3 large icons
- ; alt+7 detail
- !2::Send !v{down 2}{enter}
- !3::Send !v{down 3}{enter}
- !4::send !v{down 4}{enter}
- !6::Send !v{down 6}{enter}
- !7::Send !v{down 7}{enter}
- !8::send !v{down 8}{enter}
- #IfWinActive
- ; ============= Ctrl Backspace ==============
- ; how to write scripts: http://www.autohotkey.com/docs/
- #IfWinActive ahk_class CabinetWClass ; File Explorer
- ^Bs::
- #IfWinActive, ahk_class Notepad
- ^Bs::
- Send ^+{Left}{Backspace}
- return
- #IfWinActive
- ; source and context: http://superuser.com/a/636973/124606
- ; relevant documentation links:
- ; writing hotkeys
- ; http://www.autohotkey.com/docs/Hotkeys.htm
- ; list of key codes (including Backspace)
- ; http://www.autohotkey.com/docs/KeyList.htm
- ; the #IfWinActive directive
- ; http://www.autohotkey.com/docs/commands/_IfWinActive.htm
- ; the Send command
- ; http://www.autohotkey.com/docs/commands/Send.htm
- ;__________________________________________________
- ; ============= WINDOWS EXIT =============
- ~esc::
- if (A_PriorHotkey <> "~esc" or A_TimeSincePriorHotkey > 400)
- {
- ; Too much time between presses, so this isn't a double-press.
- KeyWait, esc
- return
- }
- send !{f4} ;winclose, a
- return
- ; #IfWinActive ahk_class CabinetWClass (This does not work on XP)
- #IfWinActive, ahk_class ExploreWClass
- ~end::
- if (A_PriorHotkey <> "~end" or A_TimeSincePriorHotkey > 400)
- {
- KeyWait, end
- return
- }
- send, ^w
- return
- #ifWinActive
- ~end::
- if (A_PriorHotkey <> "~end" or A_TimeSincePriorHotkey > 400)
- {
- KeyWait, end
- return
- }
- send, ^{f4}
- return
- ; ============= SAVE ==============
- ; #IfWinActive ahk_class ChromeWindowsClass (This does not work on XP)
- Appskey::
- SetTitleMatchMode, 2
- if WinActive("Chrome")
- {
- send, ^s
- Sleep, 100
- send, {esc}
- }
- return
- +Appskey::AppsKey
- return
- ; ============= RUN MENU ===============
- ;~lwin::
- if (A_PriorHotkey <> "~lwin" or A_TimeSincePriorHotkey > 400)
- {
- KeyWait, lwin
- return
- }
- run "C:\Documents and Settings\UserS2s.USERS2\Desktop"
- return
- ; ============= NAVIGATION ==============
- Insert::^a
- return
- ;Pause::^p
- $numlock::scrolllock
- return
- ~+numlock::send {numlock}
- return
- #appskey:: run "C:\Documents and Settings\UserS2s.USERS2\Desktop\Prgms"
- return
- #IfWinactive ahk_class CabinetWClass
- #n::
- Send ^e{Tab}
- Send {Down}ln
- return
- #IfWinactive,
- ; ============ SCROLL LOCK ===========
- #If GetKeyState("Scrolllock","T") ; Hotkeys below this can only be activated if ScrollLock is On
- pgup::wheelup
- return
- pgdn::wheeldown
- return
- #if ; this resets the condition so that all hotkeys below this directive can be activated
- ; ============= FUNCTIONS ==================
- ~F4::^v
- return
- ^F4::F4
- return
- ~F7::^+Tab
- return
- ~F8::^Tab
- return
- ~F9:: browser_home
- return
- ~F10:: browser_stop
- return
- ; ---------- F3 Function -------------
- $F3::
- KeyWait, F3 ; wait for F3 released
- KeyWait, F3, D T0.2 ; wait 1 second for F3 pressed again
- If ErrorLevel ; if 1 second passes before F3 is pressed again
- {
- Send ^c ; or whatever your copy code is
- }
- else ; we will now allow F3 to be pressed normally
- {
- Loop
- {
- Send {F3 down}
- KeyWait, F3 ; wait for F3 release
- Send {F3 up}
- KeyWait, F3, D T1 ; wait 1 second for F3 pressed again
- If ErrorLevel ; if 1 second passes before F3 is pressed again
- Break ; exit his Loop
- }
- }
- return
- ; ------------ F2 function -------------
- ~Shift::
- if (A_PriorHotkey <> "~Shift" or A_TimeSincePriorHotkey > 400)
- {
- ; Too much time between presses, so this isn't a double-press.
- KeyWait, Shift
- return
- }
- send {F2}
- return
- ; =========== POWER ===============
- ^!F5:: ;turn off monitor
- Sleep, 200
- SendMessage,0x112,0xF170,2,,Program Manager
- return
- #pause:: ;sleep
- DllCall("PowrProf\SetSuspendState", "int", 0, "int", 1, "int", 0)
- return
- !+F5:: ;hibernate
- DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
- return
- #end:: ;shutdown
- shutdown, 1
- return
- ;============ RUN PROGRAMES ==============
- !+d::run idm514
- return
- !+g:: run chrome
- return
- !+h::run QQPYHandInput
- return
- !+l::run lingoes
- return
- ^!n::run notepad
- return
- !+n:: run networks
- return
- ; ========== Local Hotkeys =============
- ^!s::
- suspend
- if (A_IsSuspended)
- {
- tooltip, Prius disabled
- Sleep, 1500
- tooltip
- }
- else
- {
- tooltip, Prius enabled
- Sleep, 1500
- tooltip
- }
- return
- ^!p::pause
- return
- ^!r::Reload ; Assign Ctrl-Alt-R as a hotkey to restart the script.
- return
- ^!e::edit
- return
- ; ============= WINHOTKEYS ==================
- #c::run calc
- return
- #+d::run shell:desktop
- return
- #i::run iexplore
- return
- #j::run D:\Documents\Downloads
- return
- #o::run D:\Documents\Visual Studio 2008\Projects
- return
- #s:: run devenv
- return
- #w::run winword
- return
- #v::run sndvol
- return
- #x::run excel
- return
- #+n::run notepad++
- return
- #delete::FileRecycleEmpty
- return
- ;============== VOLUME ==================
- !wheelup::
- send {volume_up 10}
- return
- !wheeldown::
- send {volume_down 10}
- return
- !numpaddiv::
- soundset +10
- return
- !numpadmult::
- soundset -10
- return
- ; ============ MOUSE WHELL VOLUME ===================
- ~WheelUp::mouseWheelVolume("+10")
- ~WheelDown::mouseWheelVolume("-10")
- mouseWheelVolume(step)
- { mouseGetPos,mx,my,wnd
- wingetClass,cls,ahk_id %wnd%
- if cls=Shell_TrayWnd
- { SoundSet %step%
- soundSet 0,,mute
- soundGet vol
- ifInString,vol,.
- stringMid,vol,vol,1,% inStr(vol,".")-1
- tooltip, Volume:%vol%`%,% mx+8,% my+8,19
- setTimer removeVolumeTip,2000
- }
- return
- removeVolumeTip:
- tooltip,,,,19
- settimer removeVolumeTip,OFF
- return
- }
- ; ============= MEDIA ==================
- !pgdn::
- send, {media_next}
- return
- !pgup::
- send, {media_prev}
- return
- numpad0::media_play_pause
- return
- numpaddot::
- send {media_stop}
- return
- ~pause::media_play_pause
- return
- +pause::media_stop
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement