After more 2 000 000 (two million) views on forum for 1.5.0.x development versions... and 1.6.1.0, 1.6.3.0-dev versions
A new stable version, UltraVNC 1.6.4.0 and UltraVNC SC 1.6.4.0 have been released: https://forum.uvnc.com/viewtopic.php?t=38095
Feedback is always welcome

2025-12-14: 1.7.1.X-dev release builds need tests and feedback: https://forum.uvnc.com/viewtopic.php?t=38134

2025-12-02: We need help: English Wikipedia UltraVNC page has been requested to deletion: https://forum.uvnc.com/viewtopic.php?t=38127
Any help is welcome to improve the UltraVNC page and/or to comment on the Wikipedia Talk page

2025-05-06: Forum password change request: https://forum.uvnc.com/viewtopic.php?t=38078

2023-09-21: Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Development: UltraVNC development is always here... Any help is welcome
Feedback is welcome

Automatic update script, if anyone needs it.

Simple, Free, Open Source UltraVNC Wrapper Supporting Windows and Mac OSX
Post Reply
Znida
Posts: 5
Joined: 2012-01-04 16:02

Automatic update script, if anyone needs it.

Post by Znida »

I wrote/modified a script, it autoupdates the .exe file from internet. If enyone needs it. it is an .au3 file.

Code: Select all


$url = "http://something.com/filename.exe"
$url2 = "http://something.com/filename.exe" ;second location if first fails

If InetGetSize($url) <> FileGetSize(@ScriptFullPath) and InetGetSize($url) > 10000 and $cmdline[0] = 0 Then  
   self_update($url) 
elseIf InetGetSize($url2) <> FileGetSize(@ScriptFullPath) and InetGetSize($url2) > 10000 and $cmdline[0] = 0 Then  
   self_update($url2) 
EndIf

Func self_update($update_url = "")
      		
		$upd_dlsize = InetGetSize($update_url)
		
		ProgressOn("Nadgradnja ", "Nadgradnja programa ", "")
		Sleep(500)
		
		$upd_get = InetGet($update_url, @ScriptFullPath & ".new", 1, 1)
		Do
			ProgressSet(Round(InetGetInfo($upd_get, 0) / ($upd_dlsize / 100), 0), Floor(InetGetInfo($upd_get, 0) / 1024) & "kB od " & Floor($upd_dlsize / 1024) & "kB prenešeno." & @CRLF & "Prosimo počakajte...")
			Sleep(200)
		Until InetGetInfo($upd_get, 2)
			ProgressSet(Round(InetGetInfo($upd_get, 0) / ($upd_dlsize / 100), 0), Floor(InetGetInfo($upd_get, 0) / 1024) & "kB od " & Floor($upd_dlsize / 1024) & "kB prenešeno." & @CRLF & "Končano!")
		Sleep(1000)
				
        Local $batchPath = @ScriptDir & '\update.bat'
        Local $batchFile =  "ping localhost -n 2 > nul" & @CRLF _ ;not sure what you're doing here. Giving the script time to exit?
                          & ":loop" & @CRLF _ ;specify the start of a zone
                          & 'del /Q "' & @ScriptFullPath & '"' & @CRLF _ ;the quotes are needed for long filepaths, and filepaths with spaces. The @SciptfullPath is for flexibility
                          & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ ;if the delete failed, try again
                          & 'move "' & @ScriptFullPath & '.new" "' & @ScriptFullPath & '"' & @CRLF _ ;this is why I changed the new file's name.
                          & '"' & @ScriptFullPath & '"' & @CRLF _
						  & 'del /Q "' & $batchPath & '"' & @CRLF _
                          & "exit"
						  
        FileWrite($batchPath,$batchFile)
        Run($batchPath, "", @SW_HIDE) ;
        Exit
EndFunc

just include a line in Instantsupport.au3 after other #includes

Code: Select all

#include "updateme.au3"
That's it. If you have some improvements, please do share :)
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN

Re: Automatic update script, if anyone needs it.

Post by supercoe »

Good stuff, thanks for sharing! :)
ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Post Reply