找回密码
 加入
搜索
查看: 2972|回复: 3

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

  [复制链接]
发表于 2013-1-23 02:12:48 | 显示全部楼层 |阅读模式
#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 [all effect only return u warning msg]/ 0=commit to fully works [all effect will return u force reboot(case sensitive)]
_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[0]]) 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[0])
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Return $ai_Return[0]
EndFunc
发表于 2013-1-23 07:54:54 | 显示全部楼层
请问:什么叫“不要重启改成运行再运行软件”?谢谢.
发表于 2013-1-23 12:44:06 | 显示全部楼层
是文件自动重启吗?
发表于 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() 应该可以做到不重启,去运行别的东西.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-16 00:44 , Processed in 0.074868 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表