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

Viewer custom-compiled for repeater in mode II

Any features you would like to see in UltraVNC? Propose it here
Post Reply
mortenchristensen
8
8
Posts: 25
Joined: 2004-12-05 22:17
Location: Denmark

Viewer custom-compiled for repeater in mode II

Post by mortenchristensen »

The SingleClick server can be customized to connect to a repeater in mode II and with the [Enter Code] keyword a not-computer-oriented user only needs to enter the session-unique ID number when prompted for it.

In some cases the viewer-users too wants a viewer that is very easy to use and cusotmized like the SingleClick server. Just doubleclick on the viewer-program, let it prompt for the session-unique ID number and automatically connect to the preconfigured repeater.

In case of the viewer, size does not matter. It is never supposed to leave the LAN.

--
Morten Christensen
William Knak
8
8
Posts: 25
Joined: 2005-09-19 17:35
Location: Brasil

Create a file with .VNC extension

Post by William Knak »

To make an easy Viewer connection you can follow this steps:

1. stabilish a normal connection with your remote server, even if you are using a repeater...

2. when viewer has been open, you can click on left-top viewer window icon and choose "Save connection", or something like that...

3. than you choose a name for that quick connection and save it on user desktop or another place...

4. when user double clicks the .VNC file, VNC Viewer will run with saved parameters, including the ID and Proxy + Port if you used...

5. the VNC file can be easily modified using notepad (it is a .INI file), and you can add a special TAG on ID place...

6. Lets make a VB Script interface to replace that special tag on every connection... (you can make another interface, using VB, Delphi, C, etc)... also, you can make that interface not to ask user for an ID, but make a random ID generation, wich you will tell remote server (or SC Server) to use...

Save with VBS extension...

[syntax="vb"]
' ###########################################################################
' ## UltraVNC Viewer SingleClick Launcher ##
' ## Autor: William D. Knak Filho 23-september-2005 ##
' ## Email: delphi [a.t] via.com.br ##
' ###########################################################################

Const ForReading = 1

' Creates the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Open the template file and read all contents
Set objFile = objFSO.OpenTextFile(".\template.vnc", ForReading)
strText = objFile.ReadAll
objFile.Close

Dim MyID
Dim blnOutput

blnOutput = false

' If found this tag, user must enter ID Manually
if inStr(1, strText, "<#CUSTOM_ID#>") then

MyID = InputBox("Informe o código" & Chr(13) & Chr(10) & "(de 1000 a 9999): ", "Código da Conexão")

if ((MyID>=1000) and (MyID<=9999)) then
blnOutput = True
strNewText = Replace(strText, "<#CUSTOM_ID#>", MyID)
end if
' If found the random TAG, the ID is auto-generated
elseif inStr(1, strText, "<#RANDOM_ID#>") then
Randomize Timer
MyID = Int(Rnd*8999)+1000
blnOutput = True
strNewText = Replace(strText, "<#RANDOM_ID#>", MyID)
end if

if blnOutput = True then

Dim strFileName
Dim TmpFolder

' Get the Temporary Folder
Set TmpFolder = objFSO.GetSpecialFolder(2)

strFileName = TmpFolder & "\connection_" & MyID & ".vnc"

' Create new temporary VNC file with Connection ID
Set objFile = objFSO.CreateTextFile(strFileName, true)
objFile.WriteLine strNewText
objFile.Close

' Execute that VNC file
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run strFileName ''' , 1, true

' Deletes the temporary VNC file (with some delay)
WScript.Sleep(5000)
objFSO.DeleteFile strFileName, True
else
MsgBox "Erro: Informe um Código válido."
end if

[/syntax]

This is a sample (incomplete) .VNC file from a saved connection

Code: Select all

[connection]
host=ID
port=<#RANDOM_ID#>
proxyhost=192.168.0.248
proxyport=5901

[options]
use_encoding_0=1
use_encoding_1=1
use_encoding_2=1
use_encoding_3=0
use_encoding_4=1
use_encoding_5=1
use_encoding_6=1
use_encoding_7=1

... ETC... ETC... ETC... LOOK AT <#RANDOM_ID#> TAG.... THIS IS THE KEY
(sorry about my English)
[mod=494,1127528410]replaced BBCode \"code\" by \"syntax=vb\" more readable[/mod]
Last edited by William Knak on 2005-09-24 02:20, edited 1 time in total.
--
William
mortenchristensen
8
8
Posts: 25
Joined: 2004-12-05 22:17
Location: Denmark

Re: Create a file with .VNC extension

Post by mortenchristensen »

William Knak wrote:
4. when user double clicks the .VNC file, VNC Viewer will run with saved parameters, including the ID and Proxy + Port if you used...

5. the VNC file can be easily modified using notepad (it is a .INI file), and you can add a special TAG on ID place...

6. Lets make a VB Script interface to replace that special tag on every connection...
Thank you for your advice and VB-script. I have not taken the needed time to try your idea until now, but now I can see, that it is doing a lot of, what I want.

However it requires 2 files to run, and that makes it far more work to deploy it to a lot of users.

Is it possible to put all values from template.vnc into the VB-script-file, so I only need på put the VB-script-file on my intranet ?

--
Morten Christensen
William Knak
8
8
Posts: 25
Joined: 2005-09-19 17:35
Location: Brasil

Launch Viewer for SingleClick connection - revisited

Post by William Knak »

Hi.. I don't know why I make a monster script to do a simple thing, so a rewrite a new VB Script to start VNC Viewer with a random ID and Proxy settings without other files (the .VNC template). So, you only have to install UltraVNC viewer and run this new script:

[syntax="vb"]
' ###########################################################################
' ## UltraVNC Viewer SingleClick Launcher II ##
' ## Autor: William D. Knak Filho 13-october-2005 ##
' ## Email: delphi [a.t] via.com.br ##
' ###########################################################################

Dim MyID
Dim strParams
Dim objShell

CONST VIEWER_PATH = """%PROGRAMFILES%\UltraVNC\vncviewer.exe"""
CONST PROXY = "127.0.0.1:5901"

Randomize Timer
MyID = Int(Rnd*8999)+1000

' Launch VNC Viewer with Proxy param and a Random ID
Set objShell = CreateObject("WScript.Shell")
strParams = " ID:" & MyID & " -proxy " & PROXY
objShell.Run VIEWER_PATH & strParams

' There are other params. Look at your UltraVNC installation folder
' for the documentation, usually:
' %programfiles%\UltraVNC\doc\install\cmdline.html

[/syntax]

Save this script as RemoteSupport.vbs or something.vbs. Now you can easily share this script on your server if all stations have UltraVNC installed at default location. Better, huhh?
Last edited by William Knak on 2005-10-13 07:54, edited 4 times in total.
--
William
mortenchristensen
8
8
Posts: 25
Joined: 2004-12-05 22:17
Location: Denmark

Re: Launch Viewer for SingleClick connection - revisited

Post by mortenchristensen »

Thanks William

This rewrite is exactly the thing I needed. I have mix'ed it with your input-box from the first script in the solution below.


'###########################################################################
' ## UltraVNC Viewer SingleClick Launcher II ##
' ## Autor: William D. Knak Filho 13-october-2005 ##
' ## Email: delphi [a.t] via.com.br ##
' ## Minor modifications by Morten Christensen 16-october-2005 ##
' ## Email: mc [a.t] mc.cx ##
'###########################################################################

Dim MyID
Dim strParams
Dim objShell

CONST VIEWER_PATH """%PROGRAMFILES%\UltraVNC\vncviewer.exe"""
CONST PROXY = "127.0.0.1:5901"

' Set comment-mark on line below, if you want an ID-dialog-box and not the Randomize Timer for the ID
MyID = Int(Rnd*8999)+1000

' Uncomment on of the lines below, if you want to enter the ID in a dialog box
' In portuguese
' MyID = InputBox("Informe o c¢digo" & Chr(13) & Chr(10) & "(de 1000 a 9999): ", "C¢digo da ConexÆo")
' In english
' MyID = InputBox("Enter an ID-code" & Chr(13) & Chr(10) & "(from 1000 to 9999)," & Chr(13) & Chr(10) & "give it to your customer" & Chr(13) & Chr(10) & "and hit enter: ", "ID-number for VNC SingleClick connection")
' In danish
' MyID = InputBox("Indtast et ID-kode-nummer" & Chr(13) & Chr(10) & "(mellem 1000 og 9999)," & Chr(13) & Chr(10) & "oplys det til kunden" & Chr(13) & Chr(10) & "og tast enter: ", "Kode-nummer til VNC SingleClick forbindelse")

if ((MyID>=1000) and (MyID<=9999)) then
blnOutput = True
end if

' Launch VNC Viewer with Proxy param and a Random ID
Set objShell = CreateObject("WScript.Shell")
strParams = " ID:" & MyID & " -proxy " & PROXY
objShell.Run VIEWER_PATH & strParams

' There are other params. Look at your UltraVNC installation folder
' for the documentation, usually:
' %programfiles%\UltraVNC\doc\install\cmdline.html
Post Reply