Skip to content

Commit

Permalink
Merge pull request #20 from pilgrimlyieu/v1_to_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
pilgrimlyieu authored Aug 24, 2023
2 parents c774850 + 1175182 commit 98ebfbb
Show file tree
Hide file tree
Showing 41 changed files with 1,639 additions and 1,723 deletions.
100 changes: 44 additions & 56 deletions Basic/Remap/Fn.ahk
Original file line number Diff line number Diff line change
@@ -1,68 +1,56 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

Fn_Status := 0

#Space::
Fn_Status := !Fn_Status
ToolTip % Fn_Status ? "Fn is turned on." : "Fn is turned off."
SetTimer RemoveToolTip, -1000
return

!Space::
ToolTip % Fn_Status ? "Fn is on." : "Fn is off."
SetTimer RemoveToolTip, -1000
return

RemoveToolTip:
ToolTip
return

#If Fn_Status and WinActive("ahk_exe msedge.exe")
f4::SendInput {Browser_Home}
f5::SendInput {Browser_Refresh}
f6::SendInput {Browser_Back}
f7::SendInput {Browser_Forward}

#If Fn_Status
f1::SendInput {Volume_Mute}
f2::SendInput {Volume_Up}
f3::SendInput {Volume_Down}
#Space::{
global Fn_Status
Fn_Status := !Fn_Status
ToolTip(Fn_Status ? "Fn is turned on." : "Fn is turned off.")
SetTimer(() => ToolTip(), -1000)
}

f8::
if WinExist("ahk_exe Anki.exe") {
if !WinActive("ahk_exe Anki.exe")
WinActivate ahk_exe Anki.exe
!Space::{
global Fn_Status
ToolTip(Fn_Status ? "Fn is on." : "Fn is off.")
SetTimer(() => ToolTip(), -1000)
}
else
Run "G:\Movable Computer\Movable Software\Program Files\Anki\Anki.exe" -b "G:\Movable Computer\Movable Software\Program Files\Anki\AnkiData"
return

f9::
if WinExist("GeoGebra") {
if !WinActive("GeoGebra")
WinActivate GeoGebra
#HotIf Fn_Status && WinActive("ahk_exe msedge.exe")
F4::SendInput("{Browser_Home}")
F5::SendInput("{Browser_Refresh}")
F6::SendInput("{Browser_Back}")
F7::SendInput("{Browser_Forward}")

#HotIf Fn_Status
F1::SendInput("{Volume_Mute}")
F2::SendInput("{Volume_Up}")
F3::SendInput("{Volume_Down}")

F9::{
if WinExist("GeoGebra") {
if !WinActive("GeoGebra")
WinActivate("GeoGebra")
}
else
Run("GeoGebra.exe", "D:\Program Files\GeoGebra")
}
else
Run GeoGebra.exe, D:\Program Files\GeoGebra
return

f10::
if WinExist("ahk_exe msedge.exe") {
if !WinActive("ahk_exe msedge.exe")
WinActivate ahk_exe msedge.exe
F10::{
if WinExist("ahk_exe msedge.exe") {
if !WinActive("ahk_exe msedge.exe")
WinActivate("ahk_exe msedge.exe")
}
else
Run("msedge.exe")
}
else
Run MSEdge.exe
return

f11::Run Explorer.exe
F11::Run("explorer.exe")

f12::
if WinExist("计算器") {
if !WinActive("计算器")
WinActivate 计算器
}
else
Run Calc.exe
return
F12::{
if WinExist("计算器") {
if !WinActive("计算器")
WinActivate("计算器")
}
else
Run("calc.exe")
}
3 changes: 1 addition & 2 deletions Basic/Remap/NumLock.ahk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

NumpadAdd::Volume_Up
NumpadSub::Volume_Down
NumpadSub::Volume_Down
3 changes: 1 addition & 2 deletions Basic/Remap/Others.ahk
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

Pause::Volume_Mute
Pause::Volume_Mute
34 changes: 34 additions & 0 deletions Basic/Shutdown/Shutdown.ahk1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#Requires AutoHotkey v1.1+
;@Ahk2Exe-SetMainIcon Shutdown.ico

#NoTrayIcon

Warn(WarnMinute) {
Warning := "还有 " WarnMinute " 分钟就要关机!请注意保存重要内容!"
if ExtendLevel
Warning .= "是否要延长 " ExtendMinute " 分钟关机?"
return Warning
}

Hint(WarnMinute) {
DeltaTime := SDTime
DeltaTime -= %A_Now%, Seconds
Sleep % 1000 * (DeltaTime - WarnMinute * 60)
if WarnMinute {
MsgBox % 4416 - ExtendLevel * 28, 即将关机, % Warn(WarnMinute), 10
IfMsgBox Yes
{
SDTime += ExtendMinute, Minutes
ExtendLevel --
}
}
else
Shutdown 1
}

Global SDTime := A_YYYY A_MM A_DD 233000
Global WarnMinutes := [5, 3, 1, 0]
Global ExtendLevel := 1
Global ExtendMinute := 5
for Index, Min in WarnMinutes
Hint(Min)
3 changes: 2 additions & 1 deletion Deprecated/Focus/Focus.ahk → Deprecated/Focus/Focus.ahk1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
;@Ahk2Exe-SetMainIcon Icon\Focus.ico
#Requires AutoHotkey v1.1+
;@Ahk2Exe-SetMainIcon Icon\Focus.ico

Global ConfigFile := A_ScriptDir "\Focus.ini", DataFile := A_ScriptDir "\Focus.db"
Global Online := 0, AdvancedSettingOnOff := 0, RLNOF := 0, RENOF := 0, ROF := 0, EOF := 0, LeaveLevel := 0, Note := 0, NoteOnOff := 0, Note := 0, NoteUsed := 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Run D:\Program Files\Tencent\WeMeet\wemeetapp.exe
#Requires AutoHotkey v1.1+

Run D:\Program Files\Tencent\WeMeet\wemeetapp.exe
WinWait 腾讯会议, , 10
If !ErrorLevel {
Sleep 3000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
;@Ahk2Exe-SetMainIcon StartUp.ico
#Requires AutoHotkey v1.1+
;@Ahk2Exe-SetMainIcon StartUp.ico
#NoTrayIcon

; Sleep 10000
Expand Down
43 changes: 22 additions & 21 deletions General/AHKMapCheatSheet/Mappings.ahk
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

WorkingDir := "G:\Assets\Tool\AutoHotkey\"
Mappings_Helps := {"Fn": "Basic\Remap\Fn"
, "WinDrag": "Basic\Window\WinDrag\WinDrag"
, "Tips": "General\Tips\Run"
, "Anki_ChineseKeyWord": "Specific\Anki\ChineseKeyWord"
, "Anki_Derive": "Specific\Anki\Derive"
, "Anki_Cloze": "Specific\Anki\Cloze"
, "Vark": "Tool\Vark\Vark"
, "Vanki": "Tool\Vark\Vanki"}
global WorkingDir := "G:/Project/Scripts/AutoHotkey/"
global Mappings_Helps := Map(
"Fn" , "Basic/Remap/Fn",
"WinDrag" , "Basic/Window/WinDrag/WinDrag",
"Tips" , "General/Tips/Run",
"Anki_ChineseKeyWord", "Specific/Anki/ChineseKeyWord",
"Anki_Derive" , "Specific/Anki/Derive",
"Anki_Cloze" , "Specific/Anki/Cloze",
"Vark" , "Tool/Vark/Vark",
"Vanki" , "Tool/Vark/Vanki",
)

Alias := []
text := "Helps:"
for index in Mappings_Helps
Alias.Push(index)
for index, value in Alias
text .= "`r" index ": " value
global Alias := []
global text := "Helps:"
for key in Mappings_Helps
Alias.Push(key)
for index, key in Alias
text .= "`r" index ": " key

#F1::
InputBox number, Helps, %text%, , , % 100 + 20 * index , , , , 5
if !ErrorLevel
Run % "D:/Program Files/Snipaste/Snipaste.exe paste --files " WorkingDir Mappings_Helps[Alias[number]] ".png"
return
#F1::{
number := InputBox(text, "Helps", "T5 H" String(100 + 20 * Alias.Length))
if number.Result == "OK"
try Run("D:/Program Files/Snipaste/Snipaste.exe paste --files " WorkingDir Mappings_Helps[Alias[Integer(number.Value)]] ".png")
}
3 changes: 1 addition & 2 deletions General/Abbreviation/Common.ahk
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Requires AutoHotkey v1.1+
#NoTrayIcon

#Hotstring c r t *
::p@::[email protected]
::P@::[email protected]
::P@::[email protected]
23 changes: 14 additions & 9 deletions General/Correction/Pinyin.ahk
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

IsChineseMode() {
DetectHiddenWindows On
WinGet winid, ID, A
wintitle := "ahk_id " DllCall("imm32\ImmGetDefaultIMEWnd", "Uint", winid, "Uint")
SendMessage 0x283, 0x001, 0, , %wintitle%
DetectHiddenWindows Off
return ErrorLevel = 1025
DetectHiddenWindows True
hWnd := winGetID("A")
result := SendMessage(
0x283, ; Message: WM_IME_CONTROL
0x001, ; wParam : IMC_GETCONVERSIONMODE
0 , ; lParam : (NoArgs)
, ; Control : (Window)
; Retrieves the default window handle to the IME class.
"ahk_id " DllCall("imm32\ImmGetDefaultIMEWnd", "Uint", hWnd, "Uint")
)
DetectHiddenWindows False
return result == 1025
}

#If IsChineseMode()
#HotIf IsChineseMode()
#Hotstring c r * ?
; ui <-> iu
::mui::miu
Expand All @@ -31,4 +36,4 @@ IsChineseMode() {

::enng::neng
::emng::meng
::enmg::meng
::enmg::meng
42 changes: 18 additions & 24 deletions General/MouseHand/MouseHand.ahk
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

Global LBNum := 300, CheckMins := 30, BreakTime := 60, ForceTime := 30
global LBKeyNum := 600, CheckMins := 30, BreakSeconds := 60, ForceSeconds := 30

~LButton::
If (LButtonKeyNum > 0) {
LButtonKeyNum ++
Return
}
LButtonKeyNum := 1
SetTimer MouseHand, % - 60000 * CheckMins
Return
KeyLeftButton(ThisHotkey) {
static LButton_key_num := 0
if LButton_key_num > 0
return LButton_key_num++
LButton_key_num := 1
SetTimer(LockMouse, -60000 * CheckMins)

MouseHand:
If (LButtonKeyNum >= LBNum) {
MsgBox 4144, 休息锁定模式, 已经高强度使用鼠标 %CheckMins% 分钟了 ,活动一下手吧!可在休息至少 %ForceTime%s 后按 Esc 键退出锁定模式。, 10
CoordMode Mouse
MouseGetPos XPos, YPos
Loop % ForceTime {
Sleep 1000
MouseMove XPos, YPos
LockMouse() {
if LButton_key_num >= LBKeyNum {
BlockInput("MouseMove")
MsgBox("已经高强度使用鼠标 " CheckMins " 分钟了,活动一下手吧!可在休息至少 " ForceSeconds "s 后按 Esc 键退出锁定模式。", "休息锁定模式", "Icon! 0x1000 T5")
UnlockMouse(ThisHotkey) => BlockInput("MouseMoveOff")
SetTimer(() => Hotkey("~Esc", UnlockMouse, "On"), -1000 * ForceSeconds)
SetTimer(() => Hotkey("~Esc", UnlockMouse, "Off"), -1000 * BreakSeconds)
SetTimer(() => UnlockMouse, -1000 * BreakSeconds)
}
LButton_key_num := 0
}
Loop % BreakTime - ForceTime {
KeyWait Esc, DT1
MouseMove XPos, YPos
} Until !ErrorLevel
}
LButtonKeyNum := 0
Return
}
58 changes: 24 additions & 34 deletions General/Tips/Run.ahk
Original file line number Diff line number Diff line change
@@ -1,39 +1,29 @@
#Requires AutoHotkey v1.1.36.02+
#NoTrayIcon

; 请将 Everything 目录放 PATH
#f::{
ClipSaved := ClipboardAll()
A_Clipboard := ""
SendInput("{Ctrl Down}c{Ctrl Up}")
ClipWait(0.5, 0)
selected := Trim(A_Clipboard)
if InStr(FileExist(selected), "D")
; "Run(everything -path `"" selected "`"") ; 为路径则打开路径(包括子文件夹)
Run("everything -parent `"" selected "`"") ; 为路径则打开路径(不包括子文件夹)
else
Run("everything -search `"" selected "`"") ; 不为路径则搜索指定内容
A_Clipboard := ClipSaved
ClipSaved := ""
}

if not A_IsAdmin
Run *RunAs "%A_ScriptFullPath%" /restart
^Space::{
ProxyStatus := RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable")
RegWrite(ProxyStatus := !ProxyStatus, "REG_DWORD", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable")
ToolTip("Proxy has been switched " (ProxyStatus ? "On." : "Off."))
SetTimer(() => ToolTip(), -1000)
}

#f::
Clip := ClipboardAll
Clipboard := ""
SendInput {Ctrl Down}c{Ctrl Up}
ClipWait 0
selected := Trim(Clipboard)
if InStr(FileExist(selected), "D")
; Run everything -path "%selected%" ; 为路径则打开路径(包括子文件夹)
Run everything -parent "%selected%" ; 为路径则打开路径(不包括子文件夹)
else if selected != ""
Run everything -search "%selected%" ; 不为路径则搜索指定内容
else
Run everything -home ; 未选中内容时打开主界面
Clipboard := Clip
return

^Space::
RegRead ProxyStatus, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Internet Settings, ProxyEnable
RegWrite REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Internet Settings, ProxyEnable, % ProxyStatus := !ProxyStatus
ToolTip % "Proxy has been switched " (ProxyStatus ? "On" : "Off") "."
SetTimer RemoveToolTip, -1000
return

#!Space::
RegRead TouchpadStatus, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\Status, Enabled
Run % "SystemSettingsAdminFlows.exe EnableTouchPad " (TouchpadStatus := !TouchpadStatus)
return

RemoveToolTip:
ToolTip
return
#!Space::{
TouchpadStatus := RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\Status", "Enabled")
Run("SystemSettingsAdminFlows.exe EnableTouchPad " (TouchpadStatus := !TouchpadStatus))
}
Loading

0 comments on commit 98ebfbb

Please sign in to comment.