CoordMode, Mouse, Screen

#SingleInstance Force 
Menu, Tray, Icon, D:\ahk1.0\Lib\0\Alien.ico
;#notrayicon
	; 指定 SoundVolumeView 的路径
	global SoundVolumeViewPath, devices, currentIndex, command
	SoundVolumeViewPath := "D:\ahk1.0\Lib\soundvolumeview-x64\SoundVolumeView.exe"
	; 定义设备名称(确保这些设备名称与 SoundVolumeView 中显示的名称完全匹配)
	devices := ["耳机", "音箱", "手机"]
	currentIndex := 0  ; 当前设备的索引
appskey & F1::
	currentIndex := (currentIndex + 1) > devices.MaxIndex() ? 1 : currentIndex + 1  ; 循环切换  
    	; 拼接命令
	command := SoundVolumeViewPath . " /SetDefault """ . devices[currentIndex] . """ ""Render"""
    
    	; 调试:显示生成的命令,检查是否正确
{
    	loop, 1
        	SoundBeep, 400, 10
; 400 声音频率, 可以为表达式. 它是介于 37-32767 之间的数字. 省略则频率为523
; -------------------10 声音的持续时间, 单位为毫秒. 如果省略, 则持续时间为 150     
        	; 显示当前设备名称
        	Text := "⭕    " . devices[currentIndex] . "   ⭕"
        	btt(Text, 600, 10, ,"Style7")
        	sleep, 500
        	btt()
}    
    	Run, %command%                              ; ----------------------执行命令
    	return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ     切换音频设备     ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 1-29

;CoordMode, Mouse, Screen
;WheelUp::
	MouseGetPos, xpos, ypos
	if (xpos >= 0 && xpos <= 15) 
{                                                                            ;--------- 仅屏幕左侧调整音量
    	SendInput {Volume_Up}
} else {
    	Send {WheelUp}                                     ;------ 其他位置允许页面滚动
}
return

;WheelDown::
	MouseGetPos, xpos, ypos
	if (xpos >= 0 && xpos <= 15) 
{                                                                            ;--------- 仅屏幕左侧调整音量
    	SendInput {Volume_Down}
} else {
    	Send {WheelDown}                                ;------- 其他位置允许页面滚动
}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   Wheel 屏幕最左边调整音量   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 30-559

OnClipboardChange:               ;注册一个每当剪贴板内容发生改变时都会自动调用的函数.
{
	SoundBeep, 10000, 1	
	btt(Clipboard,,,,"Style8")
	sleep, 700
	btt()​
FileAppend, %clipboard% `n, d:\6           ;------------   剪贴板历史记录保存
return
}
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ     复制后通知     ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 2-40

 >!1::
RunWait, "D:\ahk1.0\Lib\0 tool\EmEditor\EmEditor.exe" "d:\6"
 return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   >!1复制到d:\6  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 3-45

~LButton & RButton::
	cos_mousedrag_treshold := 2 ; pixels
MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
	win1 := WinActive("A")
	KeyWait RButton
MouseGetPos, cos_mousedrag_x2, cos_mousedrag_y2
	win2 := WinActive("A")
	WinGetClass cos_class, A
if(((abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
  or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)) and win1 = win2
and cos_class != "ConsoleWindowClass")
	KeyWait, RButton , T1.1
	If ErrorLevel = 0
{
	SendInput {Ctrl Down}c{Ctrl Up}
	ClipWait, , 1   
; 等待,一直到剪贴板包含数据。ClipWait, , 1
; 参数 2 将等待不超过2秒的时间. 0 等同于指定 0.5 如果省略, 此命令将无限期等待.
; 参数 1 会等待剪贴板中出现任何类型的数据. 省略此参数, 此命令会等待剪贴板中出现文本或文件.
}
Else
	reload
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ    左键拖选 右键确认 复制  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 4-70

MButton::
	KeyWait, MButton, T0.5

	If ErrorLevel = 1
{
	SendInput {Ctrl Down}x{Ctrl Up}
}
	Else
{
	SendInput {Ctrl Down}v{Ctrl Up}
}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   中键 长按剪切 点击粘贴   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 5-84

Rctrl::  
Send, #{Space}
        SoundBeep, 100, 20
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  切换中英输入法   Rctrl  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 6-90

Ralt::
if (A_PriorHotkey <> "Ralt" or A_TimeSincePriorHotkey > 400)
{
	; 两次按下时间间隔太长, 所以这不是一个两次按下.
	KeyWait, Ralt
	return
}
{
	loop,3
   	 SoundBeep, 4000, 50
}
{
	Text=全半角
	btt(Text,300,400,,"Style5")
	sleep, 600
	btt()​
	send, +{space}
	return
}
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  全半角  双击  Ralt  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 7-111

Appskey::
	t:=-oldt+(oldt:=A_TickCount)
	if (t<100 || t>300)
    	Return
 	else oldt:=0
{
	loop,3
   	 SoundBeep, 3000, 30
	Text=中英标点
	btt(Text,,,,"Style6")
	sleep, 600
	btt()​
	send, ^.
	Return
}
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 中英标点  双击 Appskey    ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 8-128

Volume_Up::TuneVolume("+")
Volume_Down::TuneVolume("-")
TuneVolume(UpDown) 
{
	static VolumeDivide := 20, VolumePercent, VolPercentB1, VolPercentB2, VolPercentB3, VolPercentB4, Prefix := ""
	SoundGet, CurrentVolume
	CurrentVolume += 0.1, StepAmount := Ceil(CurrentVolume / VolumeDivide)
	SoundSet, % UpDown StepAmount
	SetTimer, DestroyBvcGui, -880
	SoundGet, CurrentVolume
	IfWinExist, BetterVolumeControl
{
	GuiControl, bvc:-Redraw, VolPercentB1
	GuiControl, bvc:-Redraw, VolPercentB2
	GuiControl, bvc:-Redraw, VolPercentB3
	GuiControl, bvc:-Redraw, VolPercentB4
	GuiControl, bvc:-Redraw, VolumePercent
	GuiControl, bvc:Text, VolPercentB1, % Prefix Round(CurrentVolume, 0)
	GuiControl, bvc:Text, VolPercentB2, % Prefix Round(CurrentVolume, 0)
	GuiControl, bvc:Text, VolPercentB3, % Prefix Round(CurrentVolume, 0)
	GuiControl, bvc:Text, VolPercentB4, % Prefix Round(CurrentVolume, 0)
	GuiControl, bvc:Text, VolumePercent, % Prefix Round(CurrentVolume, 0)
	GuiControl, bvc:+Redraw, VolPercentB1
	GuiControl, bvc:+Redraw, VolPercentB2
	GuiControl, bvc:+Redraw, VolPercentB3
	GuiControl, bvc:+Redraw, VolPercentB4
	GuiControl, bvc:+Redraw, VolumePercent
}
	Else
{	
	Gui, bvc:New, +LastFound +AlwaysOnTop -Border -Caption +ToolWindow +E0x20	
	Gui, Font, s50
	Gui, Color, c000001
	Gui, Add, Text, x5 y5 c21e6c1 BackgroundTrans vVolumePercent, %Prefix%100	
	GuiControl, Text, VolumePercent, % Prefix Round(CurrentVolume, 0)
	WinSet, TransColor, c000001
	Gui, Show, NA x670 y380, BetterVolumeControl
}
}
DestroyBvcGui() 
{
	Gui, bvc:Destroy
}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ     音 量  指  示     ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 9-174

+#d::
    Clipboard := "" ; 清空剪贴板
    send, ^c ; 复制剪贴板内容
    ClipWait, 1 ; 等待剪贴板内容更新,超时为1秒
    decoded := b64Decode(clipboard) ; 解码剪贴板内容

    file := FileOpen("D:\5.txt", "w", "UTF-8") ; 打开文件并指定为 UTF-8 编码
    file.Write(decoded) ; 写入解码后的内容
    file.Close() ; 关闭文件
sleep, 1000
Run, nircmd.exe clipboard readfile "d:\5.txt"
return 

b64Decode(string)
{
    if !(DllCall("crypt32\CryptStringToBinary", "ptr", &string, "uint", 0, "uint", 0x1, "ptr", 0, "uint*", size, "ptr", 0, "ptr", 0))
        throw Exception("CryptStringToBinary failed", -1)
    VarSetCapacity(buf, size, 0)
    if !(DllCall("crypt32\CryptStringToBinary", "ptr", &string, "uint", 0, "uint", 0x1, "ptr", &buf, "uint*", size, "ptr", 0, "ptr", 0))
        throw Exception("CryptStringToBinary failed", -1)

    return StrGet(&buf, size, "UTF-8") ; 确保返回 UTF-8 编码的字符串
}
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   base64解码到剪贴板 +#d   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 10-199
 
+#f::
    Clipboard := "" ; 清空剪贴板
    send, ^c ; 复制当前选中的内容
    sleep, 400 ; 等待复制完成

    ClipWait, 1 ; 等待剪贴板内容更新,超时为1秒
    encoded := b64Encode(Clipboard) ; 对剪贴板内容进行 Base64 编码

    file := FileOpen("D:\5.txt", "w", "UTF-8") ; 打开文件并指定为 UTF-8 编码
    file.Write(encoded) ; 写入编码后的内容
    file.Close() ; 关闭文件

    sleep, 1000 ; 等待1秒
    Run, nircmd.exe clipboard readfile "D:\5.txt" ; 将文件内容读取到剪贴板
return 

b64Encode(string)
{
    VarSetCapacity(bin, StrPut(string, "UTF-8")) && len := StrPut(string, &bin, "UTF-8") - 1
    if !(DllCall("crypt32\CryptBinaryToString", "ptr", &bin, "uint", len, "uint", 0x1, "ptr", 0, "uint*", size))
        throw Exception("CryptBinaryToString failed", -1)
    
    VarSetCapacity(buf, size << 1, 0) ; 为输出缓冲区分配足够的空间
    if !(DllCall("crypt32\CryptBinaryToString", "ptr", &bin, "uint", len, "uint", 0x1, "ptr", &buf, "uint*", size))
        throw Exception("CryptBinaryToString failed", -1)

    return StrGet(&buf) ; 返回编码后的字符串
}
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   base64编码到剪贴板 +#f    ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 11-229

;#Persistent
#SingleInstance force
KillTip()                                              ;清除toolTip
{
        toolTip
}
volUp()            ;增加""
{
        sendInput {Volume_Up}
    SoundGet, master_volume
    master_volume := ceil(master_volume)
    ;ToolTip %master_volume% `%
    ;SetTimer, killTip, -500
}

volDown()       ;降低音量
{
        sendInput {Volume_Down}
    SoundGet, master_volume
    master_volume := ceil(master_volume)
    ;ToolTip %master_volume% `%
    ;SetTimer, killTip, -500
}

volMute()       ;静音切换
{
    sendInput {Volume_Mute}
 SoundGet, master_volume
    master_volume := ceil(master_volume)
       ; toolTip %master_volume% `%
        ;SetTimer,killTip, -500
}
F5 & F6::  volMute()
F5 & F8:: volDown()
F5 & F7:: volUp()
#If GetKeyState("LButton", "P")                                    ;  按住右键 再左键静音 再滚轮调
        ;RButton::volMute()
        ;WheelDown::volDown()
        ;WheelUp::volUp()
#If
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  F5 & F7 增大 F8 减小 F6 静音  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 12-272

;F1 & F2::
clipboard :=""
移动到 = D:\B
    send ^c
    clipwait,2
    选中文件 :=clipboard
   if (选中文件)

Loop, parse, clipboard, `n, `r

{
	RegExMatch(A_LoopField,".*\\(.+?\..*)$",文件名)
	RegExMatch(A_LoopField,"(.*\\).+?\..*$",原始路径)
;文件存在检测 :=% 原始路径1 "B\" 文件名1
if (FileExist(文件存在检测2), "D")
                {

                }
else
{
 FileMove, %A_LoopField%, % 移动到
}
}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & F2    选中文件移动至D:\B ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 13-298

#esc::					         ;--------------------------Ocr
send, !j#+{esc}
sleep, 9000
send, !u
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ #esc  关闭Vpn Ocr 再打开Vpn ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 14-305

^F9::
    clipboard := ""  ; 清空剪贴板
    Send, ^c  ; 复制选中的文本到剪贴板
    ClipWait  ; 等待剪贴板中有数据
    urls := clipboard  ; 将剪贴板内容存储到变量中

    ; 创建一个临时批处理文件
    FileDelete, ping_commands.bat  ; 删除旧的文件(如果存在)
    FileAppend, @echo off`n, ping_commands.bat  ; 创建新的批处理文件并添加开头

    Loop, parse, urls, `n  ; 遍历每一行(网址)
    {
        FileAppend, ping  %A_LoopField%`n, ping_commands.bat  ; 将每个 ping 命令写入批处理文件
    }

    Run, cmd.exe /k ping_commands.bat  ; 在一个窗口中运行批处理文件
return
/*
^F9::
Clipboard := "" ; 清空剪贴板
Sleep, 100
Send, ^c ; 复制选中的内容到剪贴板
ClipWait, 2 ; 等待剪贴板有内容(2秒超时)
if (Clipboard = "") {
    MsgBox, 剪贴板为空,请先复制 IP 地址!
    return
}

IPs := StrSplit(Clipboard, "`n") ; 按换行符分割多个 IP 地址
Command := "" ; 初始化命令字符串

for each, IP in IPs
{
    IP := Trim(IP) ; 去除空格
    if (IP != "") ; 确保 IP 不为空
    {
        Command .= "ping " . IP . " && echo. && " ; 拼接命令,结果间用空行分隔
    }
}

if (Command != "") {
    Command := RTrim(Command, " && echo. && ") ; 去掉最后多余的拼接
    Run, %A_ComSpec% /k %Command%,, Max ; 在单个 CMD 窗口中运行所有命令
}
return
*/
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  ^F9  ping选定多个网址  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 15-324

^F10::
    clipboard = 
    send, ^c
    clipboard = %clipboard%
    Sleep, 100  ; 等待剪切操作完成
    ClipWait  ; 等待剪贴板中有数据
Run, %A_ComSpec% /k "%clipboard%"
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  ^F10  cmd/k 选定文字   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 16-334

^F11::
    clipboard = 
    send, ^c
    clipboard = %clipboard%
    Sleep, 100  ; 等待剪切操作完成
    ClipWait  ; 等待剪贴板中有数据
Run, %A_ComSpec% /k %clipboard%, , RunAs
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ ^F11  cmd/k 选定文字 以管理员运行   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 17-344

^F12::
    Send, >^x      ; 获取批处理文件的路径  的快捷键
    Sleep, 100
    ; 获取剪贴板中存储的批处理文件的路径
    ClipWait  ; 等待剪贴板内容
    batchFilePath := Clipboard  ; 将剪贴板内容赋值给变量

    ; 确保路径是有效的
    if FileExist(batchFilePath) {
        ; 使用 RunAs 命令以管理员身份运行批处理文件
        Run, % "cmd.exe /c """ batchFilePath """", , RunAs
    } else {
        MsgBox, 批处理文件不存在: %batchFilePath%
    }
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  ^F12  cmd/c 选定文件 管理员运行    ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 18-361

^+F12::
    Send, >^x      ; 获取批处理文件的路径  的快捷键
    Sleep, 100
    ; 获取剪贴板中存储的批处理文件的路径
    ClipWait  ; 等待剪贴板内容
    batchFilePath := Clipboard  ; 将剪贴板内容赋值给变量

    ; 确保路径是有效的
    if FileExist(batchFilePath) {
        ; 非管理员身份 运行批处理文件
        Run, % "cmd.exe /c """ batchFilePath """"
    } else {
        MsgBox, 批处理文件不存在: %batchFilePath%
    }
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  ^+F12  cmd/c 选定文件 非管理员运行 ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 19-378

/*
Appskey & Esc::                                                  
SetWorkingDir, D:\ahk1.0\Lib\                             ; 必须这样设置,要不运行会报错
Run, "choice1.vbs"                                               ; 完整路径 D:\ahk1.0\Lib\choice1.vbs
return
;----------------------------------------------------------------------------------
Appskey & Esc::                                                    ;----------------直接运行 .bat
SetWorkingDir, D:\ahk1.0\Lib\                            
Run, %ComSpec% /c choice1.bat,, Hide              ; 使用 ComSpec 运行并隐藏窗口
return
;----------------------------------------------------------------------------------
F1 & Esc:: 
run, "D:\ahk1.0\Lib\choice1.ahk"
return
*/
;----------------------------------------------------------------------------------

; 初始化全局变量
global lastPressTime := 0                                     ; lastPressTime 用于记录上一次按键的时间
global clickCount := 0                                          ; clickCount 用于计数按键的点击次数

; 定义热键 Appskey & Esc
Appskey & Esc::
    currentTime := A_TickCount		         ; currentTime  获取当前的系统时间(以毫秒为单位)
    elapsedTime := currentTime - lastPressTime   ; elapsedTime 计算自上次按键以来经过的时间
    lastPressTime := currentTime		         ; 更新 lastPressTime 为当前时间

    if (elapsedTime < 400)
    {			
        clickCount++                                               ; 如果两次按键之间的时间间隔小于 400 毫秒,则将 clickCount 增加 1。
    }
    else
    {
        clickCount := 1		                      ; 否则,重置 clickCount 为 1,表示这是一个新的点击。
    }

    if (clickCount = 1)			         ; 单击和双击处理
    {

;这行代码设置了一个定时器,它将在 400 毫秒后调用 SingleClick 标签,并且只执行一次。这种方式常用于需要延迟执行某个操作但又不希望它重复的场景。
        SetTimer, SingleClick, -400		        ; -400 表示该计时器将在 400 毫秒后执行一次,然后自动禁用(即只运行一次)
    }					        ; 400  表示计时器会以该间隔重复执行指定的标签
    else if (clickCount = 2)
    {
        ; 双击
        SetTimer, SingleClick, Off  ; 取消单击计时器
        clickCount := 0
        Run, "D:\ahk1.0\Lib\choice2.ahk"
    }
    return

SingleClick:				         ; 单击处理
    if (clickCount = 1)
    {
        Run, "D:\ahk1.0\Lib\choice1.ahk"
    }
    clickCount := 0  ; 重置点击计数
    return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ Appskey & Esc  小菜单   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 20-403

F5 & F12::
  time = %A_Hour%点 %A_Min%分
  Speak("     " . time)
s:=A_MM "月" A_DD "日 星期" SubStr("日一二三四五六",A_WDay,1)
  Speak("     " . s)
  return
Speak(say) {
  spovice:=ComObjCreate("sapi.spvoice")
  spovice.Speak(say)
}
  return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  F5 & F12 报时   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 22-421

#If ( WinActive("ahk_exe explorer.exe"))
#SingleInstance Force

#n::
	send, <!{right}
  	return
#b::
	send, <!{left}
	return
#IfWinActive

#If ( WinActive("ahk_exe chrome.exe") or  WinActive("ahk_exe PDFXEdit.exe") or  WinActive("ahk_exe EmEditor.exe"))
#SingleInstance Force          ;Emeditor需在工具/所有配置属性/窗口/左,右边的文档/分别设为^tab^+tab

#n::
    	Send, {LControl down}{Tab}{LControl up} 
	return
#b::
    	Send, {LControl down}{Shift down}{Tab}{Shift up}{LControl up} 
	return
#IfWinActive
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  #n前 #b后 explorer  chrome PDFXEdit  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 23-444

; 定义全局标志变量
Global ClipboardLock := false

F1 & q::
    ClipboardLock := true  ; 设置标志为 true,锁定剪贴板监控
    Clipboard := "[email protected]"  
    SendInput, ^v

    ;Clip := "[email protected]"
     ; 直接使用 ControlSend 发送英文字符
    ;ControlSend,, %Clip%, A  ; 向活动窗口发送电子邮件地址
    ;SendEvent, %Clip%  ; 向活动窗口发送电子邮件地址
    Sleep, 100  ; 等待 100 毫秒
    SendInput, {Tab}  ; 使用 SendInput 发送 Tab 键
    Sleep, 100
    KeyWait, q, D  ; 等待释放按键
    EnvGet, password, zcroodb  ; 获取密码(从环境变量中获取)
    SendInput, %password%{Enter}  ; 直接发送密码而不使用剪贴板
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & q 获取系统变量中密码  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 24-467

; 定义全局标志变量
Global ClipboardLock := false
F1 & w::
    ClipboardLock := true  ; 设置标志为 true,锁定剪贴板监控
    Clipboard := "[email protected]"  
    SendInput, ^v

    Sleep, 100  ; 等待 100 毫秒
    SendInput, {Tab}  ; 使用 SendInput 发送 Tab 键
    Sleep, 100
    KeyWait, w, D  ; 等待释放按键
    EnvGet, password, zb9rgew3                             ; 获取密码(从环境变量中获取)
    SendInput, %password%{Enter}                      ; 直接发送密码而不使用剪贴板
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & w 获取系统变量中密码  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 25-485

    Global ClipboardLock := false                         ; 定义全局标志变量

F1 & r::
    ClipboardLock := true                                      ; 设置标志为 true,锁定剪贴板监控
    clipboard := "o0o0o0"                                     ; 修改剪贴板内容以迷惑监控程序

    Run, "D:\ahk1.0\Lib\0 tool\9KeePass-2.52\KeePass.exe"
    Sleep, 100
    KeyWait, r , D       			        ; 等待释放按键
    EnvGet, password, KeePassPassword              ; 获取密码(从环境变量中获取)
    SendInput, %password%{Enter}                      ; 直接发送密码而不使用剪贴板
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  F1 & r  Keebass.exe   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 26-499

;#Persistent
#SingleInstance Force

	NumpadMult::
	SetTimer, passwd, 500

passwd:
	if WinExist("打开数据库 - 9_34_31.kdbx")       ;--------------只有当前窗口为KeePass.exe,才会粘贴密码
{
    	WinActivate ; 激活窗口即不是当前窗口也激活成当前窗口
    	Sleep, 100
	EnvGet, password, KeePassPassword
	SendInput, %password%{Enter}
}
	return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ  NumpadMult  KeePass.exe  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 27-516

F1 & F8::
	EnvGet, password, zb9rgew3                 ; 环境变量设置后需重启电脑

   	; 切换到英文输入法
    	;Send, #{Shift} ; 根据你的设置可能需要调整

    	; 使用 SendInput 发送密码
    	SendInput, %password%{Enter}{Shift}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & F8 获取系统变量中密码   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 28-527

F1 & F7::
    	EnvGet, password, zcroodb                    ; 环境变量设置后需重启电脑  

    	; 切换到英文输入法
    	Send, {Shift} ; 根据你的设置可能需要调整

    	; 使用 SendInput 发送密码
    	SendInput, %password%{Enter}{Shift}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & F7 获取系统变量中密码   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 29--538

F1 & F9::
    	EnvGet, password, z967hd58                 ; 环境变量设置后需重启电脑

    	; 切换到英文输入法
    	Send, {Shift} ; 根据你的设置可能需要调整

    	; 使用 SendInput 发送密码
    	SendInput, %password%{Enter}{Shift}
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & F9 获取系统变量中密码   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 29--538

F5 & w::
	Clipboard := ""                  ; 清空剪贴板
	Send, ^c                         ; 复制选中文本
	ClipWait, 2                      ; 等待剪贴板更新
	if ErrorLevel
{
    	MsgBox, 未能检测到剪贴板内容,请检查是否已选中内容!
    	Return
}
	filePath := "C:\Users\z\Desktop\q.htm"
	file := FileOpen(filePath, "w", "UTF-8")
	file.Write(Clipboard)
	file.Close()

	Run, "D:\ahk1.0\Lib\0 tool\MOO0.exe", , "min"
	WinWait, ahk_exe MOO0.exe, , 5
	if !ErrorLevel
{
    	WinHide, ahk_exe MOO0.exe  ; 隐藏窗口
}
	;MouseClick, left, 255, 17
	sleep, 4000 
	;MOO0.exe的快捷键即使在后台也可以激发, 而msedge.exe不行,
	;所以要等它彻底启动后再启动msedge.exe, 以使得msedge.exe为当前窗口
	Run, msedge.exe "C:\Users\z\Desktop\q.htm"

sleep, 2000
	Send,  ^+u
sleep, 20
	Send,  ^+{space}
	send, <!ju                           ; 开VPN会影响录音启动的时间,所以要关掉。
sleep, 30000
	send, !u
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F5 & w  文字转语音    ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 31-654

F1 & e::
	send, ^d^c
  sleep, 200
	send, {F3}^+d
  sleep, 100
	send, ^v
  sleep, 1000
	send, {F3}^]
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & e  筛选查找项    ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 32-665

 >^N::
send, ^c
sleep, 100
Run, properties %clipboard%
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   >^N  右键属性   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 32-672

F5 & h::
    Run, "C:\3\SwitchHosts_windows_portable_x64_4.2.0.6119\SwitchHosts.exe"
   Sleep, 90000
        Process, Close, SwitchHosts.exe
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 更新github host文件 ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 1-19
















;🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫🎫

AppsKey & F2::

WinGet, hWnd, ID, A
WinGetClass, vWinClass, % "ahk_id " hWnd
vPath := "", vIsDir := 0

	if (vWinClass = "TTOTAL_CMD")
{
	MsgBox "Tc"
}
	if (vWinClass = "CabinetWClass") || (vWinClass = "ExploreWClass")
{
	for oWin in ComObjCreate("Shell.Application").Windows
{
	if (oWin.HWND = hWnd)
{
	vIsDir := oWin.Document.FocusedItem.IsFolder
	vPath := oWin.Document.FocusedItem.Path
	break
}
}
	oWin := ""
}
else if (vWinClass = "Progman") || (vWinClass = "WorkerW")
{
	VarSetCapacity(hWnd, 4, 0)
	;SWC_DESKTOP := 0x8 ;VT_BYREF := 0x4000 ;VT_I4 := 0x3 ;SWFO_NEEDDISPATCH := 0x1
	oWin := ComObjCreate("Shell.Application").Windows.FindWindowSW(0, "", 8, ComObject(0x4003, &hWnd), 1)
	vIsDir := oWin.Document.FocusedItem.IsFolder
	vPath := oWin.Document.FocusedItem.Path
	oWin := ""
}

if (vPath = "")
{
	MsgBox, % "error: file not found"
	return
}
else if !FileExist(vPath)
{
	MsgBox, % "error: file not found:`r`n" vPath
	return
}
else if vIsDir
{
	Run, % Chr(34) vPath Chr(34)
	return
}
	FileGetSize, vSizeMB, % vPath, M
	if (vSizeMB > 6)
{
	MsgBox, % "error: file too big: " vSizeMB " MB"
	return
}
	SplitPath, vPath, vName, vDir, vExt, vNameNoExt, vDrive
	FileGetSize, vSizeMB, % vPath, M
	if (vExt = "lnk")
	FileGetShortcut, % vPath, vPath

if vExt in bat,ahk,reg,txt,htm,html,mht,cpp,h,mpcpl,url,clp,ini,cfg,csv,srt,log,js,xml,toml,json,css,vbs,md,dat,conf,yml,toml,pub,csv,cmd
	Run, "D:\ahk1.0\Lib\0 tool\EmEditor\EmEditor.exe" "%vPath%"

else if vExt in bmp,gif,jpe,jpeg,jpg,png,ico
	Run, "C:\3\XnView 2.52.0\xnview.exe" "%vPath%"
	Return
;ΞΞΞΞΞΞΞΞΞΞΞΞ   AppsKey & F2  选中图标 用 EmEditor 打开   ΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 13-448

;#Persistent                                                          ; 让脚本持续运行 即直到用户关闭或遇到 ExitApp

	显示时间(k="")
{
  	static oldtime, oldx, oldy, myid, open, init:=显示时间("Start")
  	if (k="Start")
{
    	SetTimer, 显示时间, 500
    	return
}
  	;nowtime:= "" A_MM "⋆"A_DD  " " A_DDD " " A_Hour ":" A_Min ":" A_Sec " "    ;--------   加上秒
  	nowtime:= "" A_Hour ":" A_Min ":" A_Sec ""                             ;--------   加上秒
  	if (nowtime!=oldtime)
{
    	oldtime:=nowtime
    	Gui, ShowTime: +LastFoundExist
    	IfWinNotExist
{
      	Gui, ShowTime: +LastFound -Caption +ToolWindow +Hwndmyid 
      	Gui, ShowTime: Margin, 0, 0                                                      ; 边距
	Gui, ShowTime: Color, 0x1C1C1C                                              ; 设置 GUI 的背景颜色为白色,可以尝试其他颜色
	WinSet, TransColor, 1C1C1C                                                      ; 设置白色为透明颜色

     	;Gui, ShowTime: Font, s12 w1000 cd7003a                                ;字体 大小16 加粗  颜色FF2292
      	;Gui, ShowTime: Add, Text, w170 Left                                        ;背景宽度
      	;Gui, ShowTime: Show, x6 y862 NA, ShowTime                         ;位置
      	Gui, ShowTime: Font, s12 w1000 cd7003a                                 ;字体 大小16 加粗  颜色FF2292
      	Gui, ShowTime: Add, Text, w72 Left                                           ;背景宽度
      	Gui, ShowTime: Show, x0 y0 NA, ShowTime                              ;位置
      	WinSet, TransColor, red
}
    	ControlSetText,, %nowtime%
}
  	MouseGetPos, x, y, id
  	if (id=myid)
{
    	if (x!=oldx or y!=oldy)
{
      	oldx:=x, oldy:=y

#NoEnv
	OnMessage(0x201, "WM_LBUTTONDOWN")

	Global tClass:="SysShadow,Alternate Owner,tooltips_class32,DummyDWMListenerWindow,EdgeUiInputTopWndClass,ApplicationFrameWindow,TaskManagerWindow,Qt5QWindowIcon,Windows.UI.Core.CoreWindow,WorkerW,Progman,Internet Explorer_Hidden,Shell_TrayWnd" ; HH Parent

	WinGetActiveTitle, aWin
      	s:=A_YYYY "年" A_MM "月" A_DD "日 星期" SubStr("日一二三四五六",A_WDay,1)
      	ToolTip, `n  %s%`n`n  鼠标右键按住打开目录  `n`t
	tooltip,
}
    	if (!open) and GetKeyState("RButton","P")
{
      	open:=0.01                                                                              ;---------------------右键按0.01秒
     	;Run, % A_IsCompiled ? A_ScriptDir : RegExReplace(A_AhkPath,"\\[^\\]+$")
     	Run D:\ahk1.0                                                                          ;----------运行?
}
}
 	else
{
                                                                                                               ;-- 防止其他窗口争抢最前端显示
    	WinSet, AlwaysOnTop, On, ahk_id %myid%
    	ToolTip
    	open:=0
}
}
return

	WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) 
{
	PostMessage, 0xA1, 2 ; WM_NCLBUTTONDOWN
	KeyWait, LButton, U
Loop 
{
	hwnd := Format("0x{:x}", DllCall("GetWindow", UPtr,hwnd, UInt,2) ) ; 2 = GW_HWNDNEXT
	if DllCall("IsWindowVisible", UPtr,hwnd) 
{
	WinGet, Ex, ExStyle, ahk_id %hwnd%
	;if ( IsWindowCloaked(hwnd) || Ex & (0x8 | 0x80 | 0x8000000) ) ;WS_EX_TOPMOST, WS_EX_TOOLWINDOW, WS_EX_NOACTIVATE
	if (IsWindowCloaked(hwnd) || Ex & 0x8000088) ;WS_EX_TOPMOST, WS_EX_TOOLWINDOW, WS_EX_NOACTIVATE
	Continue
	WinGetClass, cClass, ahk_id %hwnd%
	if InStr(tClass, cClass, 1) ; if cClass in %tClass%
	Continue
	else break
}
}   WinActivate, ahk_id %hwnd%
}

	IsWindowCloaked(hwnd) 
{
    	return DllCall("dwmapi\DwmGetWindowAttribute", "ptr",hwnd, "int",14, "int*",cloaked, "int",4) >= 0
	&& cloaked
}
	return
;Esc::exitapp
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 右键在时间上按0.1秒后 打开脚本目录  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 33-712

;F1 & u::
    Process, Exist, uTools.exe       ; 检查程序是否已经在运行
    if (ErrorLevel)      ;根据 ErrorLevel 的值来决定是关闭程序还是启动程序,而不再依赖于 isRunning 状态变量。这可以避免因状态更新不及时而导致的需要按两次热键的问题。
    {
                                                                          ; 如果程序正在运行,则关闭它
        Process, Close, uTools.exe
        isRunning := false     ; 更新状态为未运行
    } 
    else 
    {
                                                                      ; 如果程序没有在运行,则启动它
        Run, C:\Users\z\AppData\Local\Programs\utools\uTools.exe
sleep, 1000
send, ^2
        isRunning := true      ; 更新状态为正在运行
    }
return
;ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ   F1 & u 启动 / 关闭uTools.exe  ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 00010-2909











转载请注明出处