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

Compiler Save settings update

Simple, Free, Open Source UltraVNC Wrapper Supporting Windows and Mac OSX
Post Reply
Stefke
8
8
Posts: 9
Joined: 2011-04-08 11:39

Compiler Save settings update

Post by Stefke »

I'm in de progress of adapting ChunkVNC to my needs, and one of the things I hated after doing some recompiles, was the fact that I had to reenter my repeater settings over and over again.

So I added a save button to the compiler which saves your current settings in an ini file.

I'm not sure if this is the right place to put it, but here it goes :

Code: Select all

#RequireAdmin

#include "Aut2Exe\Include\ButtonConstants.au3"
#include "Aut2Exe\Include\EditConstants.au3"
#include "Aut2Exe\Include\GUIConstantsEx.au3"
#include "Aut2Exe\Include\WindowsConstants.au3"
#include "Aut2Exe\Include\Constants.au3"

; Exit if the script hasn't been compiled
If Not @Compiled Then
	MsgBox(0, "ERROR", 'Script must be compiled before running!', 5)
	Exit
EndIf

; Read settings file.
$RepeaterList = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "List", "" )
$ListMax = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "ListMax", "" )

$RepeaterAddressLAN = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterAddressLAN", "" )
$RepeaterAddressWAN = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterAddressWAN", "" )
$RepeaterPortViewer = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterPortViewer", "" )
$RepeaterPortServer = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterPortServer", "" )
$PlainTextPassword = IniRead( @ScriptDir & "\settings.ini", "ChunkViewer", "PlainTextPassword", "" )

$Form1_1 = GUICreate("ChunkVNC Compiler", 434, 370, 192, 124)
GUISetBkColor(0xFFFFFF)
$Group1 = GUICtrlCreateGroup("Repeater Address", 16, 8, 401, 137)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$InputWAN = GUICtrlCreateInput($RepeaterAddressWAN, 96, 48, 305, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$InputLAN = GUICtrlCreateInput($RepeaterAddressLAN, 96, 96, 305, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("WAN:", 32, 48, 49, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("LAN:", 32, 96, 43, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Repeater Ports", 16, 160, 401, 89)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$Label3 = GUICtrlCreateLabel("Viewer:", 32, 200, 63, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("Server:", 232, 200, 61, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$InputViewerPort = GUICtrlCreateInput($RepeaterPortViewer, 104, 200, 97, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$InputServerPort = GUICtrlCreateInput($RepeaterPortServer, 304, 200, 97, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("InstantSupport Password", 16, 264, 305, 89)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$InputPassword = GUICtrlCreateInput($PlainTextPassword, 32, 304, 273, 28)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetLimit( $InputPassword, 8 )
$ButtonSave = GUICtrlCreateButton("Save", 336, 272, 81, 40)
$ButtonCompile = GUICtrlCreateButton("Compile!", 336, 313, 81, 40)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)



While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

		Case $ButtonSave
			$RepeaterAddressWAN = GUICtrlRead( $InputWAN )
			$RepeaterAddressLAN = GUICtrlRead( $InputLAN )
			$RepeaterPortViewer = GUICtrlRead( $InputViewerPort )
			$RepeaterPortServer = GUICtrlRead( $InputServerPort )
			$PlainTextPassword = GUICtrlRead( $InputPassword )

			IniWrite( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterAddressLAN", $RepeaterAddressLan)
			IniWrite( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterAddressWAN", $RepeaterAddressWan)
			IniWrite( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterPortServer", $RepeaterPortServer)
			IniWrite( @ScriptDir & "\settings.ini", "ChunkViewer", "RepeaterPortViewer", $RepeaterPortViewer)
			IniWrite( @ScriptDir & "\settings.ini", "ChunkViewer", "PlainTextPassword", $PlainTextPassword)


		Case $ButtonCompile

			; Check the password.
			$PlainTextPassword = GUICtrlRead( $InputPassword )
			If $PlainTextPassword = "" or StringInStr( $PlainTextPassword, " " ) Then

				MsgBox( 0, "Information", "The password cannot be blank or contain whitespace." )

			Else

				; Generate password hash and store it in ultravnc.ini
				$HashedPassword = GeneratePWD( $PlainTextPassword )
				IniWrite( @ScriptDir & "\SRC\InstantSupport_Files\ultravnc.ini", "ultravnc", "passwd", $HashedPassword )

				; Setup source files with the repeaters address.
				$RepeaterAddressWAN = GUICtrlRead( $InputWAN )
				$RepeaterAddressLAN = GUICtrlRead( $InputLAN )
				$ViewerPort = GUICtrlRead( $InputViewerPort )
				$ServerPort = GUICtrlRead( $InputServerPort )
				IniWrite( @ScriptDir & "\Viewer\Bin\chunkviewer.ini", "Repeater", "Address", $RepeaterAddressWAN & ":" & $ViewerPort )
				IniWrite( @ScriptDir & "\Viewer\Bin\chunkviewer.ini", "Repeater", "AddressLAN", $RepeaterAddressLAN & ":" & $ViewerPort )
				IniWrite( @ScriptDir & "\SRC\InstantSupport_Files\instantsupport.ini", "Repeater", "Address", $RepeaterAddressWAN & ":" & $ServerPort )
				IniWrite( @ScriptDir & "\SRC\InstantSupport_Files\instantsupport.ini", "Repeater", "AddressLAN", $RepeaterAddressLAN & ":" & $ServerPort )


				; Compile InstantSupport.exe
				ShellExecuteWait( "SRC\Aut2Exe\Aut2Exe.exe", "/in SRC\InstantSupport.au3 /out 3C-Support.exe /icon SRC\InstantSupport_Files\icon1.ico", @ScriptDir )

				; Compile ChunkViewer.exe
				ShellExecuteWait( "SRC\Aut2Exe\Aut2Exe.exe", "/in SRC\ChunkViewer.au3 /out Viewer\3C-Viewer.exe /icon SRC\InstantSupport_Files\icon1.ico", @ScriptDir )

				MsgBox( 0, "Information", "Compile Complete." )

				Exit

			EndIf

	EndSwitch

WEnd

Func GeneratePWD( ByRef $plaintextpwd )

	; Read the console output of vnc_hash.exe after sending it a plaintext password to hash.
	Local $vnchashexe = Run( @ComSpec & " /c SRC\vnc_hash\vnc_hash.exe " & $plaintextpwd, @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
	Local $line

	$line = StdoutRead( $vnchashexe ) ; First line is blank
	Sleep( 1000 )			          ; We have to wait a bit for the console app to write the hash.
	$line = StdoutRead( $vnchashexe ) ; Read the hash.
	$line = StringStripWS( $line, 2 ) & "00" ; Remove trailing whitespace and add 00. HACK: vnc_hash.exe should return with the trailing 00!
	Return $line

EndFunc

User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Compiler Save settings update

Post by supercoe »

Thanks for sharing, great stuff. :)
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Stefke
8
8
Posts: 9
Joined: 2011-04-08 11:39

Re: Compiler Save settings update

Post by Stefke »

I updated the scripts a bit more. It's now possible to change the name and icon for the programs (server & viewer).

The scripts can be found HERE

Don't forget to recompile the compiler script.
Last edited by Stefke on 2011-04-13 21:25, edited 1 time in total.
Stefke
8
8
Posts: 9
Joined: 2011-04-08 11:39

Re: Compiler Save settings update

Post by Stefke »

Updated the scripts again. Now it's also possible to change the server picture from the compile interface.
Just redownload the files from my previous post.
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Compiler Save settings update

Post by supercoe »

Please don't take this the wrong way as I'm just curious if ChunkVNC users would want the option of changing the logo.jpg from the compiler.

Could be my personal preference but do people find it difficult navigating the SRC directory to replace a file?

If this is something people would like I'll definitely add it to the next release crediting you.

I appreciate the work you are doing, keep it up. :)
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Stefke
8
8
Posts: 9
Joined: 2011-04-08 11:39

Re: Compiler Save settings update

Post by Stefke »

I don't find it difficult to go to the directory and change a file, but this way I can make multiple versions without worrying if I have the right version of the picture placed in the directory (it's right in front of me).

Next step will be to be able to load and save different configs.

Anyway, main reason I'm doing this, is to learn AutoIT a bit 8)
Last edited by Stefke on 2011-04-14 14:06, edited 1 time in total.
User avatar
supercoe
400
400
Posts: 1732
Joined: 2009-07-20 21:27
Location: Walker, MN
Contact:

Re: Compiler Save settings update

Post by supercoe »

I never thought of it that way, in the event someone is working with multiple versions of InstantSupport this would be a great way to visualize it.

I really like the idea of being able to load a config! This would be great.

Thanks again for the work, it makes much more sense to me now why these features would be needed.
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Stefke
8
8
Posts: 9
Joined: 2011-04-08 11:39

Re: Compiler Save settings update

Post by Stefke »

new version, with different configs, same location

edit : also removed "exit" after compilation, there's a menuitem for that now
edit2 : active config is now visible in the windowstitle (as always recompile compilerscript)
Last edited by Stefke on 2011-04-14 20:13, edited 2 times in total.
Post Reply