这个可以在屏幕顶部显示时间,并可以鼠标移上去显示日期,及鼠标左右键同时按下打开脚本目录。
显示时间(k="") {
static oldtime, oldx, oldy, myid, open, init:=显示时间("Start")
if (k="Start")
{
SetTimer, 显示时间, 500
return
}
nowtime:=A_Hour ":" A_Min
if (nowtime!=oldtime)
{
oldtime:=nowtime
Gui, ShowTime: +LastFoundExist
IfWinNotExist
{
Gui, ShowTime: +LastFound +AlwaysOnTop -Caption +ToolWindow +Hwndmyid
Gui, ShowTime: Margin, 0, 0
Gui, ShowTime: Color, White
Gui, ShowTime: Font, s30 bold
Gui, ShowTime: Add, Text, w130 Center
Gui, ShowTime: Show, y0 NA, ShowTime
WinSet, TransColor, White
}
ControlSetText,, %nowtime%
}
MouseGetPos, x, y, id
if (id=myid)
{
if (x!=oldx or y!=oldy)
{
oldx:=x, oldy:=y
s:=A_YYYY "年" A_MM "月" A_DD "日 星期" SubStr("日一二三四五六",A_WDay,1)
ToolTip, `n %s%`n`n 鼠标左右键同按打开目录 `n`t
}
if (!open) and GetKeyState("LButton","P") and GetKeyState("RButton","P")
{
open:=1
Run, % A_IsCompiled ? A_ScriptDir : RegExReplace(A_AhkPath,"\\[^\\]+$")
}
}
else
{
;-- 防止其他窗口争抢最前端显示
WinSet, AlwaysOnTop, On, ahk_id %myid%
ToolTip
open:=0
}
}