autohotkey AutoHotkey脚本将Caps Lock单独映射到Escape,将Ctrl与另一个键组合使用时映射,例如Steve Losh。改编自与Vim Tips Wiki上的Ctrl键类似的东西(http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281)。 (另外来自@ randy909和@mmikeww的贡献。)

保存自https://gist.github.com/sedm0784/4443120

CapsLockCtrlEscape.ahk
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false

*CapsLock::
    if (g_ControlRepeatDetected)
    {
        return
    }

    send,{Ctrl down}
    g_LastCtrlKeyDownTime := A_TickCount
    g_AbortSendEsc := false
    g_ControlRepeatDetected := true

    return

*CapsLock Up::
    send,{Ctrl up}
    g_ControlRepeatDetected := false
    if (g_AbortSendEsc)
    {
        return
    }
    current_time := A_TickCount
    time_elapsed := current_time - g_LastCtrlKeyDownTime
    if (time_elapsed <= 250)
    {
        SendInput {Esc}
    }
    return

~*^a::
~*^b::
~*^c::
~*^d::
~*^e::
~*^f::
~*^g::
~*^h::
~*^i::
~*^j::
~*^k::
~*^l::
~*^m::
~*^n::
~*^o::
~*^p::
~*^q::
~*^r::
~*^s::
~*^t::
~*^u::
~*^v::
~*^w::
~*^x::
~*^y::
~*^z::
~*^1::
~*^2::
~*^3::
~*^4::
~*^5::
~*^6::
~*^7::
~*^8::
~*^9::
~*^0::
~*^Space::
~*^Backspace::
~*^Delete::
~*^Insert::
~*^Home::
~*^End::
~*^PgUp::
~*^PgDn::
~*^Tab::
~*^Return::
~*^,::
~*^.::
~*^/::
~*^;::
~*^'::
~*^[::
~*^]::
~*^\::
~*^-::
~*^=::
~*^`::
~*^F1::
~*^F2::
~*^F3::
~*^F4::
~*^F5::
~*^F6::
~*^F7::
~*^F8::
~*^F9::
~*^F10::
~*^F11::
~*^F12::
    g_AbortSendEsc := true
    return

autohotkey CAPS2ESC for Windows Auto-hotkey

保存自https://www.dannyguo.com/blog/remap-caps-lock-to-escape-and-control/

caps-2-esc
*CapsLock::
    Send {Blind}{Ctrl Down}
    cDown := A_TickCount
Return

*CapsLock up::
    ; Modify the threshold time (in milliseconds) as necessary
    If ((A_TickCount-cDown) < 150)
        Send {Blind}{Ctrl Up}{Esc}
    Else
        Send {Blind}{Ctrl Up}
Return

autohotkey 更好的热点角落

hotcorners2

#NoEnv
#SingleInstance, Force
#MaxThreadsPerHotkey, 1
#KeyHistory, 0
#Persistent
ListLines, Off
SetBatchLines -1
SetWinDelay, -1
SetMouseDelay, -1
SetKeyDelay, -1, -1
SetTitleMatchMode, 3
DetectHiddenWindows, On
SetWorkingDir, %A_ScriptDir%
SendMode, Input
CoordMode, Mouse, Screen

CornerList :=
(LTrim Join
	{
		"TopLeft":		"TopLeft",
		"TopRight":		"TopRight",
		"BottomRight":	"BottomRight",
		"BottomLeft":	"BottomLeft"
	}
)
SetTimer, HotCorners, 10
Return

HotCorners:
	For Each, Item in CornerList
		CheckCorner(Each, Item)
	Return

TopLeft:
TopRight:
BottomLeft:
BottomRight:
	MsgBox, % A_ThisLabel
	Return

IsCorner(CornerID) {
	Static T := 10, IsMouse := {}
	Mouse := MouseGetPos()
	IsMouse.TopLeft			:= (Mouse.Y < T) && (Mouse.X < T)
	IsMouse.TopRight		:= (Mouse.Y < T) && (Mouse.X > (A_ScreenWidth - T))
	IsMouse.BottomLeft		:= (Mouse.Y > (A_ScreenHeight - T)) && (Mouse.X < T)
	IsMouse.BottomRight		:= (Mouse.Y > (A_ScreenHeight - T)) && (Mouse.X > (A_ScreenWidth - T))

	Return, IsMouse[CornerID]
}

CheckCorner(Name, LabelOrFunc) {
	If (IsCorner(Name)) {
		If (IsLabel(LabelOrFunc))
			GoSub, % LabelOrFunc
		Else If (IsFunc(LabelOrFunc))
			%LabelOrList%(Name)
		Else
			Throw Exception("This is not a function!")
		Loop {
			If (!IsCorner(Name))
				Break
		}
	}
	Return
}

MouseGetPos(Options := 3) {
	MouseGetPos, X, Y, Win, Ctrl, % Options
	Return, {X: X, Y: Y, Win: Win, Ctrl: Ctrl}
}

autohotkey 角落的行动

hotcorners
#Persistent
#NoEnv
SetBatchLines, -1
CoordMode, Mouse, Screen

Threshold = 5 ; adjust tolerance value if desired

SetTimer, HotCorners, 50 ; 0 is overkill, 50 is roughly 20 times a second.
return

HotCorners:
; If LButton is held
if GetKeyState("LButton", "P")
{
	; Wait for it to be released
	KeyWait, LButton
	; Wait some more for good measure
	Sleep, 1000
}

; Check the corners
Corner := GetCorner(Threshold)

; Only check if we're in full screen mode when it's in the corner
; It's more efficient to do that than to check the active window size
; 20 times a second
if (Corner) {
    ; Get size of window under mouse
    MouseGetPos,,, hwnd
    WinGetTitle title, ahk_id %hwnd%
    WinGetPos,,, WinW, WinH, ahk_id %hwnd%

    ; exit if window >= screen and not the desktop
    if (WinW >= A_ScreenWidth && WinH >= A_ScreenHeight) && (title != "Program Manager")
        return
}
; Perform action based on which corner the mouse is in (if any)
if (Corner == "Top Left")
	Send, #{Tab} ; See if this works
else if (Corner == "Top Right")
	Send, #{a} ; See if this works
else if (Corner == "Bottom Left")
	Send, #{LWin} ; See if this works

else
	return ; Wasn't in a corner, so we can skip the wait below

WaitLeaveCorner(Threshold)
; Sleep, 1000 ; Wait a bit more for good measure
return

WaitLeaveCorner(T)
{
	while GetCorner(T)
		Sleep, 50
}

GetCorner(T)
{
	MouseGetPos, MouseX, MouseY
	BoundX := A_ScreenWidth - T
	BoundY := A_ScreenHeight - T	
	
	if (MouseY < T && MouseX < T)
		return "Top Left"
	else if (MouseY < T && MouseX > BoundX)
		return "Top Right"
	else if (MouseY > BoundY && MouseX < T)
		return "Bottom Left"
	else if (MouseY > BoundY && MouseX > BoundX)
		return "Bottom Right"
}


f3::
Send, #{Tab}

return

f4::
Send, #{Tab}

return


f7::
Send, ^f7

return

autohotkey 在翻译中搜索

searchdict
SaveClip := ClipboardAll
Clipboard := ""
Send ^c
ClipWait 1
Word=%Clipboard%
Clipboard := SaveClip
SaveClip := ""
Sleep 500
Run, https://translate.google.com/#auto/en/%word%

autohotkey cli:cmd.exe命令行代码

cli
cmd := % comspec " /k ipconfig /all"

Run, % cmd

autohotkey Func Bind

func
fn := Func("cb_hcContextMenu").Bind(this.doc, item.name, dbContentMenu)
			Menu, %menuName%, Add, % item.name, % fn

autohotkey 啊改IE版

ieVersion

; ========================================================================================
; ========================================================================================
FixIE(Version=0, ExeName="")
{
	static Key := "Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
	static Versions := {7:7000, 8:8888, 9:9999, 10:10001, 11:11001}
	if Versions.HasKey(Version)
		Version := Versions[Version]
		
	if !ExeName {
		if A_IsCompiled
			ExeName := A_ScriptName
		else
			SplitPath, A_AhkPath, ExeName
	}
	RegRead, PreviousValue, HKCU, %Key%, %ExeName%
	MsgBox, 0, FixIE, % "ExeName[" ExeName "]`nPreviousValue[" PreviousValue "]"
	
	if (Version = "")
		RegDelete, HKCU, %Key%, %ExeName%
	else
		RegWrite, REG_DWORD, HKCU, %Key%, %ExeName%, %Version%
	
	return PreviousValue
}

autohotkey 啊边缘

edge
+F8::
{
	IApplicationActivationManager := ComObjCreate("{45BA127D-10A8-46EA-8AB7-56EA9078943C}", "{2e941141-7f97-4756-ba1d-9decde894a3d}")
	DllCall(NumGet(NumGet(IApplicationActivationManager+0)+3*A_PtrSize), "Ptr", IApplicationActivationManager, "Str", "Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge", "Str", 0, "UInt", 0, "IntP", processId)
	ObjRelease(IApplicationActivationManager)
}
return

autohotkey 用于隐藏/显示Windows 10工具栏的AutoHotkey脚本https://autohotkey.com/board/topic/83594-how-to-hide-taskbar-with-hotkey/

用于隐藏/显示Windows 10工具栏的AutoHotkey脚本https://autohotkey.com/board/topic/83594-how-to-hide-taskbar-with-hotkey/

hide_toolbar.ahk
!t::
	WinExist("ahk_class Shell_TrayWnd")

	t := !t

	If (t = "1") {
		WinHide, ahk_class Shell_TrayWnd
		WinHide, Start ahk_class Button
	} Else {
		WinShow, ahk_class Shell_TrayWnd
		WinShow, Start ahk_class Button
	}
return