显示时间
#Persistent
显示时间(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秒后 打开脚本目录 ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ 12-373
转载请注明出处