#include <inet.au3>
#Include <Date.au3>
#include <Process.au3>
#include <Constants.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#NoTrayIcon
Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC",0)
$Version = "公告浏览"
Local $Week[8] = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六','星期日'], $Button1, $ListView1, $Label1
Dim $AddTime = "公告日期", $TaskTime = "生效日期", $NoticeLabel = "公告内容", $Cont = "周期"
Dim $Exegettime = FileGetTime("C:\Support\BOBootHint.au3", 0, 1)
Dim $Config_File = "C:\Support\Noticeconfig.ini"
For $i = 1 To 16
If $Exegettime <> FileGetTime("C:\Support\BOBootHint.au3", 0, 1) Then
Run("C:\Support\BORebootau3.bat", "C:\Support", @SW_HIDE)
Exit
EndIf
_msbox()
_UpdateCKUtil()
_VPDN()
_SetPrinter()
Sleep(900000)
Next
Run("C:\Support\BORebootau3.bat", "C:\Support", @SW_HIDE)
Func _SetPrinter()
If FileExists("C:\Program Files\普通发票管理系统\nsrptfp.exe") =1 And ProcessExists("nsrptfp.exe") = 0 Then
For $i = 1 to 10
$Printername = RegEnumVal("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts", $i)
if @error <> 0 Then ExitLoop
if stringmid($Printername,1,2) = "HP" Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\windows","Device","REG_SZ",$Printername & "," & _
RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts",$Printername))
EndIf
next
EndIf
EndFunc
Func _UpdateCKUtil()
If FileGetTime("C:\Support\CKUtil.exe", 0, 1) <> FileGetTime("C:\Support\CKUtil_new.exe", 0, 1) Then
ProcessClose("CKUtil.exe")
Sleep(5000)
_RunDOS ("xcopy C:\Support\CKUtil_new.exe C:\Support\CKUtil.exe /y /c /r")
_RunDOS ("xcopy C:\Support\CKUtil_new.pdb C:\Support\CKUtil.pdb /y /c /r")
Run("C:\Support\CKUtil.exe", "C:\Support")
EndIf
If ProcessExists ("CKUtil.exe") = 0 Then Run("C:\Support\CKUtil.exe", "C:\Support")
EndFunc
Func _msbox()
If @HOUR&@MIN > 0900 And @HOUR&@MIN < 0930 Then
If WinExists($Version) <> 1 Then
$Form1 = GUICreate($Version, 422, 300, -1, -1,BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$Button1 = GUICtrlCreateButton("关闭", 160, 220, 100, 40)
$LabelToday = GUICtrlCreateLabel("今天是: " & @YEAR & "-" & @MON & "-" & @MDAY, 300, 220, 138, 15)
$LabelWDay = GUICtrlCreateLabel($Week[@WDAY-1], 348, 240, 138, 20)
WinSetOnTop($Version, "", 1)
GUICtrlSetOnEvent($Button1, "OKButton")
Else
GUICtrlSetState($Label1,$GUI_Hide)
GUICtrlSetState($Button1,$GUI_SHOW)
EndIf
Add_List()
EndIf
EndFunc
Func Add_List()
GUICtrlDelete($ListView1)
$var = IniReadSectionNames($Config_File)
$ListView1 = GUICtrlCreateListView("*|"& $NoticeLabel, 8, 8, 400, 200)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 30)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 360)
GUICtrlSetFont($ListView1,16)
If Not @error Then
$now = @YEAR & "-" & @MON & "-" & @MDAY
$S = 0
For $n = 1 To $var[0]
$ReadINITaskTime = IniRead($Config_File, $var[$n], $TaskTime, " ")
$Readnotice = IniRead($Config_File, $var[$n], $NoticeLabel, " ")
If IniRead($Config_File, $var[$n], $Cont, "") = "A" Then
If _DateDiff('d', $now, $ReadINITaskTime) = 0 Then
$S = $S +1
GUICtrlCreateListViewItem($S & ".|" & $Readnotice & "|", $ListView1)
EndIf
EndIf
If IniRead($Config_File, $var[$n], $Cont, "") = "C" Then
$RITWStr = StringSplit($ReadINITaskTime,",")
For $i = 1 To $RITWStr[0]
If $Week[@WDAY-1] = $RITWStr[$i] Then
$S = $S +1
GUICtrlCreateListViewItem($S & ".|" & $Readnotice & "|", $ListView1)
EndIf
Next
EndIf
If IniRead($Config_File, $var[$n], $Cont, "") = "D" Then
$RITMStr = StringSplit(StringTrimRight(StringTrimLeft($ReadINITaskTime,2),1),",")
$Mday = @MDAY
If StringLeft(@MDAY, 1) = 0 Then $Mday = StringTrimLeft(@MDAY, 1)
For $i = 1 To $RITMStr[0]
If $Mday = $RITMStr[$i] Then
$S = $S +1
GUICtrlCreateListViewItem($S & ".|" & $Readnotice & "|", $ListView1)
EndIf
Next
EndIf
If IniRead($Config_File, $var[$n], $Cont, "") = "B" Then
$S = $S +1
GUICtrlCreateListViewItem($S & ".|" & $Readnotice & "|", $ListView1)
EndIf
If @error <> 0 Then ExitLoop
Next
If $S <> 0 Then GUISetState(@SW_SHOW)
EndIf
EndFunc
Func OKButton()
GUICtrlSetState($Button1, $GUI_DISABLE)
WinSetOnTop($Version, "", 0)
$Mvar = MsgBox(262417,"关闭提示","是否已阅读公告内容?")
If $Mvar = 1 Then
GUICtrlSetState($Button1,$GUI_Hide)
WinSetOnTop($Version, "", 1)
$Label1 = GUICtrlCreateLabel("", 152, 230, 120, 40)
GUICtrlSetColor($Label1,0xff0000)
For $ii = 10 To 1 Step -1
GUICtrlSetData($Label1, "窗口将于" & $ii & "秒后关闭")
Sleep(1000)
Next
GUISetState(@SW_HIDE)
EndIf
GUICtrlSetState($Button1, $GUI_ENABLE)
WinSetOnTop($Version, "", 1)
EndFunc
Func _VPDN()
FileDelete(@DesktopDir & "\Storesupport.txt")
_INetGetSource("http://172.25.128.15:4080/ip.asp?PC=" & @ComputerName)
EndFunc