Local $aProcess=ProcessList(@ScriptName);
For $i=1 To $aProcess[0][0]
if $aProcess[$i][1] <> @AutoItPID then ;It's not my own!!
MsgBox(0,'请勿重复运行','程序已经运行中,请勿重复启动')
Exit
EndIf
Next
Local $runState = @ScriptDir & 'tmp.dat'
FileWrite($runState, '')
Sleep(2000)
If Not FileExists($runState) Then Exit MsgBox(0, '', '实例已运行.')
FileDelete($runState)
GUICreate('')
Do
If FileExists($runState) Then
GUISetState()
FileDelete($runState)
EndIf
Until GUIGetMsg()= -3