你试试这个
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <ListViewConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>
#include <GuiListView.au3>
;~ ;路径------------------------------------------------------------------------------
$inifile = @ScriptDir & "\id.ini"
$id72hLJ = @ScriptDir & "\id72H.ini"
$jhLJ = @ScriptDir & "\jh.ini"
$mimainiLJ = @ScriptDir & "\mima.ini"
;~ ;路径------------------------------------------------------------------------------
#Region ### START Koda GUI section ### Form=H:\存储软件\au3\进行中\北京武警医学院数据导出\第四次导出\实验室\ID写入相关设置\用户界面1.0.kxf
$Form1_1 = GUICreate("Form1", 640, 511, 192, 125)
$Input1 = GUICtrlCreateInput("", 120, 40, 137, 21)
$Input2 = GUICtrlCreateInput("", 120, 72, 137, 21)
$Button = GUICtrlCreateButton("确认", 272, 48, 75, 41, $WS_GROUP)
$ListView = GUICtrlCreateListView("", 56, 152, 258, 254)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
$ListView_0 = GUICtrlCreateListViewItem("_NowCalc()|sText1", $ListView)
$ListView_1 = GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
$ListView_2 = GUICtrlCreateListViewItem("array[0]|array[1]", $ListView)
$Label1 = GUICtrlCreateLabel("请在此处输入ID", 16, 40, 87, 17)
$Label2 = GUICtrlCreateLabel("请重新输入", 16, 72, 64, 17)
$Label3 = GUICtrlCreateLabel("正在等待的ID", 56, 128, 75, 17)
$Group1 = GUICtrlCreateGroup("功能", 384, 32, 129, 153)
$Button1 = GUICtrlCreateButton("停止导出", 416, 64, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Button2 = GUICtrlCreateButton("关闭计算机", 416, 104, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("从启计算机", 416, 144, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("刷新", 416, 416, 75, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("从新更换IP", 416, 200, 75, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("详情", 520, 416, 75, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("修改", 56, 416, 75, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
Dim $StatusBar1_PartsWidth[3] = [50, 100, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "", 2)
_GUICtrlStatusBar_SetBkColor($StatusBar1, 0xC8D0D4)
$Label4 = GUICtrlCreateLabel("4h", 384, 320, 16, 17)
$Label5 = GUICtrlCreateLabel("24h", 384, 352, 22, 17)
$Label6 = GUICtrlCreateLabel("72h", 384, 384, 22, 17)
$Progress4 = GUICtrlCreateProgress(424, 280, 150, 17)
$Progress1 = GUICtrlCreateProgress(424, 320, 150, 17)
$Progress2 = GUICtrlCreateProgress(424, 352, 150, 17)
$Progress3 = GUICtrlCreateProgress(424, 384, 150, 17)
$Label7 = GUICtrlCreateLabel("", 584, 320, 10, 17);4
$Label8 = GUICtrlCreateLabel("", 584, 352, 16, 17);24
$Label9 = GUICtrlCreateLabel("", 584, 384, 16, 17);72
$Label10 = GUICtrlCreateLabel("所有", 384, 280, 28, 17)
$Button8 = GUICtrlCreateButton("修改后刷新", 136, 416, 75, 25, $WS_GROUP)
$Label11 = GUICtrlCreateLabel("", 584, 280, 28, 17)
$ToolBar1 = _GUICtrlToolbar_Create($Form1_1, 0)
$ToolBar1 = _GUICtrlToolbar_Create($Form1_1, 0)
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($ListView, "时间", 170)
_GUICtrlListView_AddColumn($ListView, "ID号", 150)
ini()
GUISetState()
#EndRegion ### END Koda GUI section ###
While 1
$mimapd = 0
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button;确认
$sText1 = GUICtrlRead($Input1)
$sText2 = GUICtrlRead($Input2)
If $sText1 <> '' Or $sText2 <> '' Then
If $sText1 = $sText2 Then
If StringIsDigit($sText1) = 1 Then
GUICtrlCreateListViewItem(_NowCalc() & '|' & $sText1, $ListView)
IniWrite($inifile, "全部", _NowCalc(), $sText1)
GUICtrlSetData($Input1, "")
GUICtrlSetData($Input2, "")
MsgBox(0, "添加成功", "ID号“" & $sText1 & "”已经成功添加。")
Else
MsgBox(0, "错误", "输入的内容中含有非数字字符,请核对后从新输入。")
EndIf
Else
MsgBox(0, "错误", "两次输入的信息不同,请核对后从新输入。")
EndIf
EndIf
Case $Button1;停止
;~ $mimapdt = mimaK($mimainiLJ)
If mimaK($mimainiLJ) = 1 Then IniWrite($jhLJ, "开关信息", "停止导出", 1)
Case $Button2;关闭计算机
$mimapd = mimaK($mimainiLJ)
If $mimapd = 1 Then IniWrite($jhLJ, "开关信息", "关闭计算机", 1)
Case $Button3;从启计算机
$mimapd = mimaK($mimainiLJ)
If $mimapd = 1 Then IniWrite($jhLJ, "开关信息", "从启计算机", 1)
Case $Button4;刷新
$4hjd = jd4()
GUICtrlSetData($Progress1, $4hjd)
GUICtrlSetData($Label7, $4hjd)
$24hjd = jd24()
GUICtrlSetData($Progress2, $24hjd)
GUICtrlSetData($Label8, $24hjd)
$72hjd = jd72()
GUICtrlSetData($Progress3, $72hjd)
GUICtrlSetData($Label9, $72hjd)
$suoyou = $4hjd + $24hjd + $72hjd
GUICtrlSetData($Progress4, $suoyou)
GUICtrlSetData($Label11, $suoyou)
Case $Button5;从新更换IP
Case $Button6;详情
Case $Button7;修改
ShellExecute($inifile)
Case $Button8;修改后刷新
_GUICtrlListView_DeleteAllItems($ListView)
ini()
EndSwitch
WEnd
Func ini()
;_GUICtrlListView_DeleteAllItems($ListView)
$array = IniReadSection($inifile, "全部")
If @error Then
GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
Else
For $i = 1 To $array[0][0]
GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $ListView)
Next
EndIf
EndFunc ;==>ini
Func jd4()
$4hls = 0
$4h = IniReadSection($id72hLJ, "4h")
If @error Then
MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
Else
For $i = 1 To $4h[0][0]
;~ MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
$4hls = $4hls + 1
Next
Return $4hls
EndIf
EndFunc ;==>jd4
Func jd24()
$24hls = 0
$4h = IniReadSection($id72hLJ, "24h")
If @error Then
MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
Else
For $i = 1 To $4h[0][0]
;~ MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
$24hls = $24hls + 1
Next
Return $24hls
EndIf
EndFunc ;==>jd24
Func jd72()
$72hls = 0
$4h = IniReadSection($id72hLJ, "72h")
If @error Then
MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
Else
For $i = 1 To $4h[0][0]
;~ MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
$72hls = $72hls + 1
Next
Return $72hls
EndIf
EndFunc ;==>jd72
Func mimaK($mimaLJ)
;操作说明 mimaK(Ini文件路径)
;~ ;返回说明:错误无返回,正确返回1
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("密码对话框", 337, 118, -1, -1)
GUISetIcon("D:\008.ico")
$zhanghaoSR = GUICtrlCreateInput("", 88, 16, 233, 21, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
$mimaSR = GUICtrlCreateInput("", 88, 48, 233, 21, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
$ButtonOk = GUICtrlCreateButton("确定(&O)", 86, 80, 75, 25, 0)
$ButtonCancel = GUICtrlCreateButton("取消(&C)", 167, 80, 75, 25, 0)
$EnterPassLabel = GUICtrlCreateLabel("请输入账号:", 8, 20, 76, 17)
$Label1 = GUICtrlCreateLabel("请输入密码:", 8, 52, 76, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonOk
$zhanghaoZ = GUICtrlRead($zhanghaoSR)
$mimaZ = GUICtrlRead($mimaSR)
If $zhanghaoZ = "" Then
MsgBox(0,"","请输入您的账号")
Else
$m = mima($zhanghaoZ, $mimaZ, $mimaLJ)
If $m = 1 Then
Return ('1')
ExitLoop
EndIf
If $m = 2 Then MsgBox(0, "", "你的账号错误")
If $m = 3 Then MsgBox(0, "", "你的密码错误")
If $m = 0 Then MsgBox(0, "", "意外错误")
EndIf
Case $ButtonCancel
GUIDelete($Form2)
ExitLoop
EndSwitch
WEnd
EndFunc ;==>mimaK
Func mima($ZH, $MM, $mimaLJ)
;操作说明 mima(账号, 密码,Ini文件路径)
;~ ;返回说明:0=意外错误,1=正确,2=账号错误,3=密码错误
$mima = 0
$zhbs = 0
$mmbs = 0
$varmima = IniReadSection($mimaLJ, "密码=账号")
If @error Then
MsgBox(4096, "", "发生错误,密码配置文件不能被找到,请联系管理员。")
Else
For $i = 1 To $varmima[0][0]
;~ MsgBox(4096, "", "关键字:" & $varmima[$i][0] & @CRLF & "数值:" & $varmima[$i][1])
If $ZH = $varmima[$i][0] Then
If $MM = $varmima[$i][1] Then
$mima = 1
Else
$mmbs = 1
EndIf
Else
$zhbs = 1
EndIf
Next
If $mima = 1 Then
Return ('1')
ElseIf $mmbs = 1 Then
Return ('3')
Else
If $zhbs <> 0 Then
Return ('2')
Else
Return ('0')
EndIf
EndIf
EndIf
EndFunc ;==>mima
|