其实也没什么大更新,混个1.3版本。 更新日志如下:
修正
- 修复了「第一次点的明明是修改位置,却成了选颜色去了」的BUG
新增
- 托盘图标
- 图标的获取方式有很多。你既可以从网络上搜索一个你觉得适合的,也可以从顶楼的链接——Mircosoft OneDrive_微软云盘里下载。
- 图标能够正常显示的前提是图标的名字为
Pop-Up_Time.ico
并与脚本放置于同一目录
- 当然如果不想要图标,觉得图标文件碍事,那么删除脚本第二行即可
- ini配置新增加鼠标手势的灵敏度调整。现在如果觉得某个灵敏度太低,那相对应的数值拉高,反之依然。
!注意!由于这个版本把鼠标手势的灵敏度的设置都纳入了配置文件之中,无论之前用的是什么版本,进行升级后都需要重置一次配置文件。否则鼠标手势会失灵。
源代码(Windows 11版本):
CoordMode, Mouse, Screen
Menu, Tray, Icon, %A_ScriptDir%\Pop-Up_Time.ico ;如果不需要托盘图标,请删除此行
Menu, Tray, Add, 显示\隐藏 时间窗口, hidewindow
Menu, Tray, Add, 更改时间窗口的显示位置, Change_Time_Position
Menu, Tray, Add, 选取时间窗口的显示颜色, Change_Time_Color
Menu, Tray, Add, 修改配置文件, Open_InI_File
Menu, Tray, Add, 重置配置文件, NewUser
Menu, tray, Default, 更改时间窗口的显示位置
; ---初始化参数---
Initialize:
Color_Changing := 0
Middle_Of_Screen := A_ScreenHeight /2
IniRead, xx, %A_ScriptDir%\Pop-Up_Time.ini, Position, xx
if xx is not number
Goto, NewUser
IniRead, yy, %A_ScriptDir%\Pop-Up_Time.ini, Position, yy
IniRead, Time_Fonts_size, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Fonts_size
IniRead, Time_Width_Box, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Width_Box
IniRead, Time_Format_To_Show, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Format_To_Show
IniRead, Time_Color_To_Show, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Color_To_Show
IniRead, Sensitive_Of_Right_Move_Pixel, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Sensitive_Of_Right_Move_Pixel
IniRead, Sensitive_Of_Left_Move_Pixel, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Sensitive_Of_Left_Move_Pixel
IniRead, Sensitive_Of_Down_Move_Pixel, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Sensitive_Of_Down_Move_Pixel
If (yy <= Middle_Of_Screen) {
UorL := A_ScreenHeight*0.08 ;当Pop-up Time 的显示位置处于屏幕上方时,图标托盘的显示高度。
} else {
UorL := A_ScreenHeight*0.70 ;当Pop-up Time 的显示位置处于屏幕下方时,图标托盘的显示高度。
}
Showup:
FormatTime, Timestr, Time, %Time_Format_To_Show%
Gui, Timar: Color, EEAA99
Gui, Timar: Font, s%Time_Fonts_size% w1000 c%Time_Color_To_Show%, Ink Free
Gui, Timar: Add, Text,vTi w%Time_Width_Box% gWinkey, %Timestr%
Gui Timar: -Caption +ToolWindow +AlwaysOnTop +LastFound
WinSet, TransColor, EEAA99
Gui, Timar: Show, x%xx% y%yy%, PopUp_ShowTime
SetTimer, Update, 700
SetTimer, WatchActiveWindow, 1000 ; 如果不想隐藏任务栏,删除下面的功能代码之余,还请删除这条代码
Return
Update:
FormatTime, Timestr, Time, %Time_Format_To_Show%
GuiControl, Timar: Text, Ti,%Timestr%
Gui Timar: +AlwaysOnTop
Return
Winkey: ; 左键点击Pop-up Time时就会运行的功能代码
send, #a
return
; ----以上为Pop-Up Time 核心代码----
WatchActiveWindow:
MouseGetPos, xpos0, ypos0,
WinGetClass, class, ahk_id %win%
If (ypos0 >= 70) {
WinHide, ahk_class Shell_TrayWnd
WinHide, Start ahk_class Button
}
If (ypos0 <= 1 and GetKeyState("LButton","P") = 1) { ;在屏幕最顶端长按不动时,显示任务栏
sleep 300
MouseGetPos, Detect_xpos,,
If (ypos0 <= 1 and Detect_xpos == xpos0 and GetKeyState("LButton","P") = 1) {
WinShow, ahk_class Shell_TrayWnd
WinShow, Start ahk_class Button
}
}
Return
; ----以上为:“鼠标位置不位于屏幕上方时,就自动隐藏任务栏”的功能代码----
; ----快捷键隐藏Pop-up TIme ----
^\::
hidewindow:
show := !show
If (WinExist("PopUp_ShowTime")) {
Gui, Timar: Destroy
}else{
Gosub showup
}
Return
; ----以下为鼠标右键相关的代码-----
~*RButton::
mousegetpos ,xpos1,ypos1
if (ypos1 <= 1) {
if (xpos1 = A_screenWidth-1) { ; 当鼠标在屏幕最右边时按下右键
send, #n
Return
}
if (xpos1 = 0) { ; 当鼠标在屏幕最左边时按下右键
Send #d
Return
}
Winshow, ahk_class Shell_TrayWnd
Winshow, Start ahk_class Button
WinActivate, ahk_class Shell_TrayWnd
}
return
#if ypos1 <= 1
Rbutton up:: ; 鼠标手势
mousegetpos ,xpos2,ypos2
yValue:= ypos1-ypos2
xValue := xpos1-xpos2
if (xValue <= -Sensitive_Of_Right_Move_Pixel) { ; 按住右键向右滑动时
WinMinimizeAll
sleep 150
send {Escape}
KeyWait, LButton, D
sleep 500
WinMinimizeAllUndo
return
} else if (xValue >= Sensitive_Of_Left_Move_Pixel) { ; 按住右键向左滑动时
whichdesk := !whichdesk
if Whichdesk = 1
{
send, #^{Left}
} else {
send, #^{Right}
}
Return
} else if (yValue <= -Sensitive_Of_Down_Move_Pixel) { ; 按住右键向下滑动时
sleep 150
send {Escape}
send #{tab}
Return
}
mousegetpos ,xpos1,ypos1
return
; ----以下为ini配置文件读写相关的代码-----
Change_Time_Color:
Color_Changing := 1
Change_Time_Position:
Msgbox , 0, One more step! Click it!, 接下来,在该窗口消失后,请点击鼠标左键,选择新的时间显示位置或者Pop-up Time的显示颜色。, 1.5
KeyWait, LButton, D
mousegetpos ,xpos3,ypos3
Sleep 500
If (Color_Changing == 0) {
IniWrite,% xpos3 - 30, %A_ScriptDir%\Pop-Up_Time.ini, Position, xx
IniWrite,% ypos3 - 30, %A_ScriptDir%\Pop-Up_Time.ini, Position, yy
} else {
PixelGetColor, Time_Color_To_Show, xpos3, ypos3, RGB
Msgbox , 0, 颜色已确定, RGB 代码为:%Time_Color_To_Show%。, 1
IniWrite,%Time_Color_To_Show%, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Color_To_Show
}
Color_Changing := 0
Goto, Refresh_UI
NewUser:
IniWrite,% A_screenWidth*0.87, %A_ScriptDir%\Pop-Up_Time.ini, Position, xx
IniWrite,6, %A_ScriptDir%\Pop-Up_Time.ini, Position, yy
IniWrite,18, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Fonts_size
IniWrite,200, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Width_Box
IniWrite,h:mm_ss tt, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Format_To_Show
IniWrite,176AD7, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Time_Color_To_Show
IniWrite,80, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Sensitive_Of_Right_Move_Pixel
IniWrite,180, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Sensitive_Of_Left_Move_Pixel
IniWrite,100, %A_ScriptDir%\Pop-Up_Time.ini, Pop-Up_Time_Setting, Sensitive_Of_Down_Move_Pixel
Goto, Refresh_UI
Open_InI_File:
RunWait, %A_ScriptDir%\Pop-Up_Time.ini
sleep, 500
Refresh_UI:
Gui, Timar: Destroy
Goto, Initialize