Celebrating the 22th anniversary of the UltraVNC: https://forum.uvnc.com/viewtopic.php?t=38031
Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Bluesky/AT Protocol: https://bsky.app/profile/ultravnc.bsky.social
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

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
Contact:

Re: Automatic update script, if anyone needs it.

Post by supercoe »

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