#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=图标.exe
#AutoIt3Wrapper_Res_Comment=QQ:196019441
#AutoIt3Wrapper_Res_Description=定时提醒
#AutoIt3Wrapper_Res_Fileversion=1.0.0.27
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=冬丶
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GuiStatusBar.au3>
#include <GuiListView.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <排列.au3>
#include <Date.au3> ;时间
#include <FTPEx.au3> ;从FTP读取数据
Opt("TrayMenuMode", 1) ;屏蔽托盘,暂停
Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1)
TraySetClick(16) ;屏蔽托盘单击
Opt("GUICloseOnESC", 0) ;关闭ESC
Dim $NoRe = "", $ini = @ScriptDir & "\Set.ini", $Tempini = @TempDir & "\Set.ini"
$Runreg = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$Regname = "提醒工具"
FileInstall("皮肤\SkinCrafterDll.dll", @TempDir & "\SkinCrafterDll.dll", 1) ;皮肤DLL
FileInstall("皮肤\Letter.skf", @TempDir & "\Letter.skf", 1) ;皮肤样式
$Form1 = GUICreate("提醒工具", 430, 418, 192, 124)
_SkinGUI(@TempDir & "\SkinCrafterDll.dll", @TempDir & "\Letter.skf", $Form1)
$date_2 = GUICtrlCreateDate("", 15, 34, 80, 20, BitOR($DTS_TIMEFORMAT, $DTS_UPDOWN))
$Button1 = GUICtrlCreateButton("加入", 367, 30, 49, 25)
GUICtrlSetOnEvent(-1, "Onvent_Click_button1")
$Label2 = GUICtrlCreateLabel("说明: 5分钟自动同步配置(最小化隐藏) ", 15, 10, 220, 17)
$Label3 = GUICtrlCreateLabel("", 250, 10, 180, 17) ;当前时间控件
$Group1 = GUICtrlCreateGroup(" 任 务 提 醒 ", 15, 65, 401, 321)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input1 = GUICtrlCreateInput("", 103, 33, 211, 21)
$Checkbox1 = GUICtrlCreateCheckbox("强制", 323, 23, 41, 41)
$lv = GUICtrlCreateListView("", 28, 84, 375, 290, $LVS_REPORT)
GUICtrlSetOnEvent(-1, "_Lvpx")
_GUICtrlListView_AddColumn($lv, "时间", 50, 0)
_GUICtrlListView_AddColumn($lv, "提醒内容", 300, 0)
_GUICtrlListView_AddColumn($lv, "强制", 300, 0)
_GUICtrlListView_SetColumnWidth($lv, 0, 60)
_GUICtrlListView_SetColumnWidth($lv, 1, 265)
_GUICtrlListView_SetColumnWidth($lv, 2, 40)
_GUICtrlListView_SetExtendedListViewStyle($lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
GUICtrlRegisterListViewSort(-1, "LVSort")
;--------------------------------->>主界面菜单
$menu = GUICtrlCreateMenu("菜单(&M)")
$menu_1 = GUICtrlCreateMenu("开机启动(&R)", $menu)
$menu_1_1 = GUICtrlCreateMenuItem("启动(&Y)", $menu_1)
GUICtrlSetOnEvent(-1, "Autoruns")
$menu_1_2 = GUICtrlCreateMenuItem("不启动(&N)", $menu_1)
GUICtrlSetOnEvent(-1, "Notrun")
$menu_2 = GUICtrlCreateMenuItem("退出程序(&X)", $menu)
GUICtrlSetOnEvent(-1, "_Exit")
$menu2 = GUICtrlCreateMenu("关于(&A)")
$menu2_1 = GUICtrlCreateMenuItem("关于程序(&X)", $menu2)
GUICtrlSetOnEvent(-1, "Aboutcx")
;<<--------------------------------主界面菜单
;------------------------->>程序GUI右键菜单
$ctextmenu = GUICtrlCreateContextMenu($lv)
$ctextmenu_1 = GUICtrlCreateMenuItem("删除提醒(&D)", $ctextmenu)
GUICtrlSetOnEvent(-1, "_Deleteitem")
$ctextmenu_4 = GUICtrlCreateMenuItem("同步提醒(&R)", $ctextmenu)
GUICtrlSetOnEvent(-1, "_Getini")
GUICtrlCreateMenuItem("", $ctextmenu) ; 右键菜单分隔
$ctextmenu_2 = GUICtrlCreateMenuItem("配置文件(&F)", $ctextmenu)
GUICtrlSetOnEvent(-1, "Peizhi")
$ctextmenu_3 = GUICtrlCreateMenuItem("退出程序(&X)", $ctextmenu)
GUICtrlSetOnEvent(-1, "_Exit")
;<<-------------------------程序GUI右键菜单
;------------------------->>托盘菜单
$traysmenu_1 = TrayCreateMenu("开机启动(&R)")
$traysmenu_1_1 = TrayCreateItem("启动(&Y)", $traysmenu_1, -1, 1)
TrayItemSetOnEvent(-1, "Autoruns")
$traysmenu_1_2 = TrayCreateItem("不启动(&N)", $traysmenu_1, -1, 1)
TrayItemSetOnEvent(-1, "Notrun")
TrayCreateItem("")
$traysmenu_2 = TrayCreateItem("配置文件(&F)")
TrayItemSetOnEvent(-1, "Peizhi")
TrayCreateItem("")
$traysmenu_3 = TrayCreateItem("关于程序(&A)")
TrayItemSetOnEvent(-1, "Aboutcx")
$traysmenu_4 = TrayCreateItem("退出程序(&X)")
TrayItemSetOnEvent(-1, "_Exit")
;<<-------------------------托盘菜单
;~ _Getini()
If $CmdLine[0] > 0 Then
For $I = 1 To $CmdLine[0]
If $CmdLine[$I] = "-Min" Then
GUISetState(@SW_HIDE)
EndIf
Next
Else
GUISetState(@SW_SHOW)
EndIf
;检测启动项
$TsReg = RegRead($Runreg, $Regname)
If $TsReg = @ScriptFullPath & " -Min" Then
GUICtrlSetState($menu_1_1, $GUI_CHECKED)
TrayItemSetState($traysmenu_1_1, $TRAY_CHECKED)
Else
GUICtrlSetState($menu_1_2, $GUI_CHECKED)
TrayItemSetState($traysmenu_1_2, $TRAY_CHECKED)
EndIf
AdlibRegister("nowgo", 100)
AdlibRegister("_Getini", 300000)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Gui_Minimize")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "_TryEvents")
Show()
$Dll = DllOpen("user32.dll") ;
While 1
_ReduceMemory(@AutoItPID) ;内存整理
Sleep(10)
WEnd
DllClose($Dll)
Func nowgo()
GUICtrlSetData($Label3, "当前时间: " & _Now())
$NowTime = @HOUR & ":" & @MIN & ":" & @SEC
$info = StringSplit(IniRead($ini, "提醒", $NowTime, ""), "|")
If $info[0] = 2 And $NoRe <> @HOUR & ":" & @MIN & ":" & @SEC Then
If $info[2] = "是" Then
MsgBox(64, "强制提醒: ", $info[1])
Else
TrayTip("提醒", $info[1], 30, 1)
EndIf
$NoRe = $NowTime
EndIf
EndFunc ;==>nowgo
Func Show()
_GUICtrlListView_DeleteAllItems($lv)
If FileExists($ini) Then
$wl = IniReadSection($ini, "提醒")
If @error = 0 Then
$n = 0
For $I = 1 To $wl[0][0]
GUICtrlCreateListViewItem($wl[$I][0] & "|" & $wl[$I][1], $lv) ;显示列表
Next
EndIf
Else
;创建配置文件
If @SEC + 15 >= 60 Then
If StringLen(@SEC - 45) = 1 Then
$Sec_1 = "0" & @SEC - 45
Else
$Sec_1 = @SEC - 45
EndIf
If StringLen(@MIN + 1) = 1 Then
$Min_1 = "0" & @MIN + 1
Else
$Min_1 = @MIN + 1
EndIf
IniWrite($ini, "提醒", @HOUR & ":" & $Min_1 & ":" & $Sec_1, "示例:15秒后提醒|否")
Else
IniWrite($ini, "提醒", @HOUR & ":" & @MIN & ":" & @SEC + 15, "示例:15秒后提醒|否")
EndIf
Show()
EndIf
EndFunc ;==>Show
Func _Deleteitem()
$totalnum = _GUICtrlListView_GetItemCount($lv)
$selectcount = _GUICtrlListView_GetSelectedCount($lv)
$out = ""
For $I = 0 To $totalnum - 1
If $selectcount Then
If _GUICtrlListView_GetItemSelected($lv, $I) == True Then
$val = StringSplit(_GUICtrlListView_GetItemTextString($lv, $I), "|")
IniDelete($ini, "提醒", $val[1])
EndIf
EndIf
Next
Show()
EndFunc ;==>_Deleteitem
Func Onvent_Click_button1()
If GUICtrlRead($Input1) = "" Then
MsgBox(64, "提示", "您该写点什么!")
Else
If StringLen(GUICtrlRead($date_2)) = 7 Then
$WTime = "0" & GUICtrlRead($date_2)
Else
$WTime = GUICtrlRead($date_2)
EndIf
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
IniWrite($ini, "提醒", $WTime, GUICtrlRead($Input1) & "|是")
Else
IniWrite($ini, "提醒", $WTime, GUICtrlRead($Input1) & "|否")
EndIf
TrayTip("^_^", "设置提醒成功!", 3, 1)
GUICtrlSetData($Input1, "")
Show()
Sleep(2000)
TrayTip("清除托盘提示", "", 0)
EndIf
EndFunc ;==>Onvent_Click_button1
Func _ReduceMemory($i_PID = -1);整理内存
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
Func Peizhi()
If FileExists($ini) Then
ShellExecute($ini, @ScriptDir) ;直接运行系统程序关联的文件
Else
MsgBox(4096, "错误", "配置文件不存在!")
EndIf
EndFunc ;==>Peizhi
Func Autoruns()
RegWrite($Runreg, $Regname, "REG_SZ", @ScriptFullPath & " -Min")
GUICtrlSetState($menu_1_1, $GUI_CHECKED)
GUICtrlSetState($menu_1_2, $GUI_UNCHECKED)
TrayItemSetState($traysmenu_1_1, $TRAY_CHECKED)
TrayItemSetState($traysmenu_1_2, $TRAY_UNCHECKED)
EndFunc ;==>Autoruns
Func Notrun()
RegDelete($Runreg, $Regname)
GUICtrlSetState($menu_1_2, $GUI_CHECKED)
GUICtrlSetState($menu_1_1, $GUI_UNCHECKED)
TrayItemSetState($traysmenu_1_2, $TRAY_CHECKED)
TrayItemSetState($traysmenu_1_1, $TRAY_UNCHECKED)
EndFunc ;==>Notrun
Func _Getini()
;~ $dll = DllOpen('wininet.dll')
;~ $server = '58.52.146.46'
;~ $username = 'test'
;~ $pass = 'test'
;~ $Open = _FTP_Open('MyFTP')
;~ $Conn = _FTP_Connect($Open, $server, $username, $pass, 0, "1921")
;~ MsgBox(0, 0, _FTP_FileGetSize($Conn, "Set.ini"))
;~ $Ftpp = _FTP_ProgressDownload($Conn, @ScriptDir & "\Set.ini", 'Set.ini', False)
;~ $Ftpc = _FTP_Close($Open)
;~ DllClose($dll)
Local $hDownload = InetGet("ftp://test:test@58.52.146.46:1921/Set.ini", $Tempini, 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; 检查下载是否完成.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; 关闭句柄,释放资源.
If IniRead($Tempini, "版本", "Version", "") <> IniRead($ini, "版本", "Version", "") Then
$wl = IniReadSection($Tempini, "提醒")
If @error Then
MsgBox(4096, "", "错误, 读取INI文件失败.")
Else
For $I = 1 To $wl[0][0]
IniWrite($ini, "提醒", $wl[$I][0], $wl[$I][1])
Next
EndIf
IniWrite($ini, "版本", "Version", IniRead($Tempini, "版本", "Version", ""))
EndIf
Show()
EndFunc ;==>_Getini
Func _Gui_Minimize()
GUISetState(@SW_HIDE, $Form1)
EndFunc ;==>_Gui_Minimize
Func _TryEvents()
GUISetState(@SW_SHOW, $Form1)
Show()
EndFunc ;==>_TryEvents
Func Aboutcx()
MsgBox(64, " 关于 ", "本程序由 冬丶 制作! " & @CRLF & @CRLF & "QQ:196019441")
TrayItemSetState($traysmenu_3, $TRAY_UNCHECKED)
EndFunc ;==>Aboutcx
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle) ;定义皮肤函数
$Dll = DllOpen($SkincrafterDll)
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc ;==>_SkinGUI
Func _Exit() ;皮肤退出事件
;~ If $soft_ini = -1 Then
;~ Else
FileDelete(@TempDir & "\Dev.txt")
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 500, "long", 0x00090000)
;~ EndIf
_Quit()
Exit
EndFunc ;==>_Exit
Func _Quit()
GUISetState(@SW_HIDE)
DllCall($Dll, "int:cdecl", "DeInitDecoration")
DllCall($Dll, "int:cdecl", "RemoveSkin")
DllClose($Dll)
FileDelete(@TempDir & "\Letter.skf")
FileDelete(@TempDir & "\SkinCrafterDll.dll")
EndFunc ;==>_Quit
;--------------- 皮肤 -----------------