ปัญหาก็คือ มันไม่ยอมปิดโปรแกรมที่กำหนดให้เลย ยังไงก็ลองเอา scrpit ไปดูก่อนนะครับ แล้วก็ช่วยแก้ให้ที นั่งงมมาหลายวันละ ผมเข้ารหัสอะไรไว้ให้หมดแล้วนะครับ ก็ลองรันดูได้เลย
client.au3
data.spatch
client.au3
- Code:
#cs---------------------------------------------------------------------------------------------------------------------------------#
Student manager project - Auto Updates
Author : Nguyễn Huy Trường
Yahoo Address : [You must be registered and logged in to see this link.]
Do not make illegal copy!
-----------------------
---Edit By rolovely ---
#ce---------------------------------------------------------------------------------------------------------------------------------#
;#include <config.nht>
#include <String.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
Opt("GUICloseOnESC", 1) ;1=ESC closes, 0=ESC won't close
Opt("TrayAutoPause",1) ;0=no pause, 1=Pause
Global $filepatch="data.spatch"; Declare the file name to save when check version
Global $percentPerAction=Number(100/5); Declare the percentage that is up every action
Global $currentProgress=0; Declare the progress of doing nothing
Global $download="http://127.0.0.1/data.spatch"; Declare the link to check new version value;
Global $FileUrl="http://127.0.0.1/data.spatch"; Declare the link that used to download new project
Global $speedOfUpdate=1; Declare the speed (ms) of each up progress
Global $percentPerUp=0.1; Declare the percent to progress each time
Func getValue($url)
$fileDownloadable=InetGet($url, @ScriptDir&"\"&$filepatch)
If($fileDownloadable==1) Then
$returnValue=FileRead(@ScriptDir&"\"$filepatch)
Return $returnValue;
ElseIf($fileDownloadable==0) Then
Return -1
EndIf
EndFunc
Func progressBy($IDOfProgressBar, $valueToProgressBy)
$aimValue=Execute($currentProgress+$valueToProgressBy)
If($aimValue>=100) Then
GUICtrlSetData($IDOfProgressBar,100)
Else
While $currentProgress<$aimValue
GUICtrlSetData($IDOfProgressBar,Execute($currentProgress+$percentPerUp))
$currentProgress+=$percentPerUp
Sleep($speedOfUpdate)
WEnd
EndIf
$currentProgress=$aimValue
EndFunc
Func progressTo($IDOfProgressBar,$valueToProgressTo)
If($valueToProgressTo>=100) Then
GUICtrlSetData($IDOfProgressBar,100)
Else
While $currentProgress<$valueToProgressTo
GUICtrlSetData($IDOfProgressBar,Execute($currentProgress+$percentPerUp))
$currentProgress+=$percentPerUp
Sleep($speedOfUpdate)
WEnd
EndIf
$currentProgress=$valueToProgressTo
EndFunc
Global $updateProgress
$progressForm=GUICreate("Check Update ...", 220, 50, 5, 5)
$updateProgress=GUICtrlCreateProgress(10, 10, 200, 20)
GUICtrlSetColor(-1, 32250)
GUISetState(@SW_SHOW)
$newVersion=getValue($download)
progressBy($updateProgress,$percentPerAction)
If Not($newVersion==-1) Then
progressBy($updateProgress,$percentPerAction)
progressBy($updateProgress,$percentPerAction)
$fileLink=getValue($FileUrl)
progressBy($updateProgress,$percentPerAction)
GUIDelete($progressForm)
$currentProgress=0;
Else
EndIf
progressTo($updateProgress,100)
GUIDelete($progressForm)
Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon
$VL = IniRead('data.spatch',"patch","VL",'') ; Saves the editbox for later
$string = IniRead('data.spatch',"patch","list",'') ; Saves the editbox for later
$b = _StringEncrypt(0, $string,$VL)
$Process = $b
While 1
Sleep(1000)
if ProcessExists($Process) Then
ProcessClose($Process, 2)
ProcessExists($Process, 2)
MsgBox(4096, "Check Games: ",'เจอตัวแล้ว')
ExitLoop
Else
EndIf
WEnd
data.spatch
- Code:
[patch]
list=CB2E8C2B887B7E7C833AF7088045C1CA1D188D55D12672B7
VL=10