evilelf Posted January 17, 2009 Share Posted January 17, 2009 I Fould This Scrip On The Forms, But Cant Seem To Get It To Work Right. I Cant Seem To Have The Program Update If the Version Its running Is Lower Then The One In The .ini expandcollapse popup$auto = 1 If $CmdLine[0] > 0 Then If $CmdLine[1] = "DoNotAutoStart" Then $auto = 0 EndIf Local $ping = Ping("www.Google.com");Website to ping to check if internet access is available Local $Website = "MySite.exe" Local $myini = "MySite" $retry = 0 While 1 If $ping = 0 Then $retry = MsgBox(5, "MyProgram - Update", "Error! Please connect to the Internet and try again!") EndIf If $retry = 4 Then Local $ping = Ping("www.Google.com") EndIf If $retry = 2 Then Exit EndIf If $ping <> 0 Then ExitLoop WEnd If $ping <> 0 Then InetGet($myini,"C:\update.ini", 1) If IniRead("C:\update.ini", "Update", "FileVer", "0.0.0.0") > FileGetVersion("MyProgram.exe") Then $msgA = MsgBox(4, "Update", "MyProgram " & IniRead("C:\update.ini", "Update", "FileVerDescript", "Not Found") & " is available, Update now?") If $msgA = 6 Then ProcessClose("MyProgram.exe") FileMove(@ScriptDir & "\MyProgram.exe", @ScriptDir & "\MyProgram.bak.exe", 1) InetGet($Website, @ScriptDir & "\MyProgram.exe", 1, 1) ProgressOn("Downloading Update", "Downloading", "", -1, -1, 16) While @InetGetActive $downloaded = (@InetGetBytesRead / IniRead("C:\Update.ini", "Size", "Bytes", 0) * 100) $downloaded = Int($downloaded) ProgressSet($downloaded) WEnd ProgressOff() $updatecheck = FileExists(@ScriptDir & "\Ecto_V2.exe") $exesize = FileGetSize(@ScriptDir & "\Ecto_V2.exe") If $updatecheck = 1 And $exesize = IniRead("C:\Update.ini", "Size", "Bytes", 0) Then MsgBox(0, "Complete", "MyProgram has been updated to: " & IniRead("C:\Update.ini", "Update", "FileVerDescript", "Not Found")) FileDelete(@ScriptDir & "\MyProgramOld.bak.exe") If $auto = 1 Then MsgBox(0, "Running Myprogram", "Update will now run MyProgram", 2) Run(@ScriptDir & "\MyProgram.exe") EndIf EndIf If $updatecheck = 0 Or $exesize <> IniRead("C:\Update.ini", "Size", "Bytes", 0) Then FileMove(@ScriptDir & "\MyProgramOld.bak.exe", @ScriptDir & "\MyProgram.exe", 1) MsgBox(48, "Error!", "The download failed, either the file wasn't downladed or file was corrupt - Updater has restored your previous Ecto_V2 file") EndIf EndIf FileDelete("C:\Update.ini") Exit EndIf If IniRead("C:\Update.ini", "Update", "FileVer", "0.0.0.0.") <= FileGetVersion("MyProgram.exe") Then MsgBox(0, "Latest", "You currently have the latest version of MyProgram") FileDelete("C:\Update.ini") EndIf EndIf Link to comment Share on other sites More sharing options...
igotandrew Posted January 17, 2009 Share Posted January 17, 2009 Post what you have stored in your ini Link to comment Share on other sites More sharing options...
evilelf Posted January 17, 2009 Author Share Posted January 17, 2009 Now I Have This... [update] FileVer 0.0.0.1 I Had [update] FileVer=0.0.0.1 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 17, 2009 Moderators Share Posted January 17, 2009 Type regularly. There is absolutely no need to capitalize every word... It actually has made me not even get past the first sentence you wrote other than to see if you did it throughout the entire post. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
evilelf Posted January 17, 2009 Author Share Posted January 17, 2009 Type regularly. There is absolutely no need to capitalize every word... It actually has made me not even get past the first sentence you wrote other than to see if you did it throughout the entire post.Smoke...You have been nice in the past,..But man WoW...If Its that hard to read Then NvM,I'll Fix it on My Own.Dont take this the Wrong Way,..Ruff Week and from 3-7amWas very Bad For Me...Thanks For The...Help,Ill just fix it... Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2009 Developers Share Posted January 17, 2009 ... looks like you didn't read/understand what was said. as to your issue: Debug it by showing what the content is of the functions you use to retrieve the Ini info and the program fileversion. Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BrettF Posted January 17, 2009 Share Posted January 17, 2009 Type regularly. There is absolutely no need to capitalize every word... It actually has made me not even get past the first sentence you wrote other than to see if you did it throughout the entire post.It actually hurts my eyes to read the sentences/words/mubo jumbo... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
evilelf Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) ... looks like you didn't read/understand what was said. as to your issue:Debug it by showing what the content is of the functions you use to retrieve the Ini info and the program fileversion.JosI was trying 2 do that,But ILost a lot of sleep and could not toy around with it much longer.-Thanks, I'll toy around with this when-ever I have time this week.It actually hurts my eyes to read the sentences/words/mubo jumbo...I Forget Monkey see monkey do...- Maybe you should get out side more and stop sitting infontof the computer if your eyes hurt that bad...*Just A Thought* I love how people post random dumb replysfor there post count... Edited January 18, 2009 by evilelf Link to comment Share on other sites More sharing options...
BrettF Posted January 18, 2009 Share Posted January 18, 2009 (edited) I get outside enough- I work part time, I cycle, I like to go out in my mates boat (see avatar...). I spend the rest of my time either playing my instrument, at school, asleep or on here. More than enough to keep me busy. I'm having a look now, to see if I can work it out. Seemed to work okay for what you've given us. expandcollapse popup#Include <Misc.au3> ;Make the INI, IniWrite ("C:\update.ini", "Update", "FileVer", "0.0.0.0") ;Start script $auto = 1 If $CmdLine[0] > 0 Then If $CmdLine[1] = "DoNotAutoStart" Then $auto = 0 EndIf Local $ping = Ping("www.Google.com");Website to ping to check if internet access is available Local $Website = "MySite.exe" Local $myini = "MySite" $retry = 0 While 1 If $ping = 0 Then $retry = MsgBox(5, "MyProgram - Update", "Error! Please connect to the Internet and try again!") EndIf If $retry = 4 Then Local $ping = Ping("www.Google.com") EndIf If $retry = 2 Then Exit EndIf If $ping <> 0 Then ExitLoop WEnd If $ping <> 0 Then InetGet($myini,"C:\update.ini", 1) ;If _VersionCompare (IniRead("C:\update.ini", "Update", "FileVer", "0.0.0.0"), FileGetVersion("MyProgram.exe")) Then If _VersionCompare (IniRead("C:\update.ini", "Update", "FileVer", "0.0.0.0"), "0.0.0.1") = 1 Then $msgA = MsgBox(4, "Update", "MyProgram " & IniRead("C:\update.ini", "Update", "FileVerDescript", "Not Found") & " is available, Update now?") If $msgA = 6 Then ProcessClose("MyProgram.exe") FileMove(@ScriptDir & "\MyProgram.exe", @ScriptDir & "\MyProgram.bak.exe", 1) InetGet($Website, @ScriptDir & "\MyProgram.exe", 1, 1) ProgressOn("Downloading Update", "Downloading", "", -1, -1, 16) While @InetGetActive $downloaded = (@InetGetBytesRead / IniRead("C:\Update.ini", "Size", "Bytes", 0) * 100) $downloaded = Int($downloaded) ProgressSet($downloaded) WEnd ProgressOff() $updatecheck = FileExists(@ScriptDir & "\Ecto_V2.exe") $exesize = FileGetSize(@ScriptDir & "\Ecto_V2.exe") If $updatecheck = 1 And $exesize = IniRead("C:\Update.ini", "Size", "Bytes", 0) Then MsgBox(0, "Complete", "MyProgram has been updated to: " & IniRead("C:\Update.ini", "Update", "FileVerDescript", "Not Found")) FileDelete(@ScriptDir & "\MyProgramOld.bak.exe") If $auto = 1 Then MsgBox(0, "Running Myprogram", "Update will now run MyProgram", 2) Run(@ScriptDir & "\MyProgram.exe") EndIf EndIf If $updatecheck = 0 Or $exesize <> IniRead("C:\Update.ini", "Size", "Bytes", 0) Then FileMove(@ScriptDir & "\MyProgramOld.bak.exe", @ScriptDir & "\MyProgram.exe", 1) MsgBox(48, "Error!", "The download failed, either the file wasn't downladed or file was corrupt - Updater has restored your previous Ecto_V2 file") EndIf EndIf FileDelete("C:\Update.ini") Exit EndIf If IniRead("C:\Update.ini", "Update", "FileVer", "0.0.0.0.") <= FileGetVersion("MyProgram.exe") Then MsgBox(0, "Latest", "You currently have the latest version of MyProgram") FileDelete("C:\Update.ini") EndIf EndIf Cheers, Brett Edited January 18, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
evilelf Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) Thank You BrettF I want 2 cycle! If I run into a problem I'll post in here. Ps: I always liked the work you have did, and... I Might steal your " _LoginBox " cause I Like it... Edited January 18, 2009 by evilelf Link to comment Share on other sites More sharing options...
evilelf Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) -NvM, I got it. It was a miss understanding of a line of code. Edited January 18, 2009 by evilelf Link to comment Share on other sites More sharing options...
BrettF Posted January 18, 2009 Share Posted January 18, 2009 Thank You BrettFI want 2 cycle!If I run into a problemI'll post in here.Ps: I always liked the work you have did,and... I Might steal your " _LoginBox "cause I Like it...Make sure you give credit where it is due, because last time I checked, stealing code was taking someones work and passing it off as your own... Not the best thing to do.Cheers,Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now