自动保存的置顶文本框

自动保存的置顶文本框

有时候需要记录一些临时文本,或者需要放在一边作为参考,这个工具可以实现:

  1. 置顶显示,自由拉伸
  2. 设定时间间隔自动保存;退出和关机前自动保存;Ctrl + s 手动保存
  3. 以日期作为保存命名分组

AlwaysText.ahk

if (!A_IsAdmin)
    Run *RunAs %A_ScriptFullPath%
FileEncoding UTF-8-RAW
OnExit("ExitFunc")

Menu Tray,NoStandard
Menu Tray,Add,Record
Menu Tray,Add,Exit

Gui New,HwndRecordUI +AlwaysOnTop +Resize
Gui Font,s12,Microsoft YaHei UI
Gui Add,Edit,w350 R10 vRecord


SetTimer FileUpdate,3600000 ;Edit your aoto save interval

RecordFileName:=A_Year "-" A_Mon "-" A_MDay ".txt" ;Record group by date
if !FileExist(RecordFileName)
{
    LastRecordFileName:=Format("{}{2:02}{}",A_Year "-" A_Mon "-",A_MDay-1,".txt")
    FileRead LastRecordFile,%LastRecordFileName%
    if (!LastRecordFile)
        FileDelete %LastRecordFileName%
    FileAppend,,%RecordFileName%
}
else
{
    FileRead RecordFile,%RecordFileName% ;Read today's record
    GuiControl,%RecordUI%:,Record,%RecordFile%
}
return

FileUpdate:
Gui %RecordUI%:Submit,NoHide
RecordFileName:=A_Year "-" A_Mon "-" A_MDay ".txt"
if !FileExist(RecordFileName)
{
    LastRecordFileName:=Format("{}{2:02}{}",A_Year "-" A_Mon "-",A_MDay-1,".txt")
    FileRead LastRecordFile,%LastRecordFileName%
    if (!LastRecordFile)
        FileDelete %LastRecordFileName%
    FileAppend,,%RecordFileName%
}
else
{
    FileRead RecordFile,%RecordFileName%
    if (RecordFile!=Record)
    {
        FileDelete %RecordFileName%
        FileAppend %Record%,%RecordFileName%
    }
}
return


#NoEnv
#SingleInstance Force

GuiClose:
    Gui Hide
return

GuiSize:
    if (A_EventInfo==1)
        return
    GuiControl Move,Record,% "w" A_GuiWidth-30 "h" A_GuiHeight-18
return

Record:
    Gui %RecordUI%:Show,,Record
return


RecordSave:
Gui %RecordUI%:Submit,NoHide
RecordFileName:=A_Year "-" A_Mon "-" A_MDay ".txt"
FileRead RecordFile,%RecordFileName%
if (Record && Record!=RecordFile)
    FileAppend %Record%,%A_Now%.txt
return


Exit:
    ExitApp
    
ExitFunc()
{
    gosub RecordSave
}

#IfWinActive Record ahk_exe AutoHotkey.exe
^s::goto RecordSave ;Manual save

给TA捐赠
共{{data.count}}人
人已捐赠
其他

ahk操控软件命令行之打印机篇

2022-8-26 7:35:25

其他

一键开关网络适配器

2022-8-26 20:07:57

2 条回复 A文章作者 M管理员
  1. hexuren

    如果能配图可能好很多

    • Ananovo

      配图在封面哈哈哈

个人中心
购物车
优惠劵
有新私信 私信列表
搜索