An unfortunate situation is that: the repeater has a timeout feature, that means if it cannot establish the connetion for the two parties within serveral minutes, it simply remove it(them) from the list, and a message box will then be popup at the viewer pc. So if you want to retry, you need to (close the message box, and) click the "Connect" (or re-run your script) again (& Again) Manually.
To solve this problem, I write a small batch file to do this job (close the message box, and re-run a script) for me. Here is what we need:
1. The vncviewer.exe -- I rename it as vncviewer-sp.exe, use it only for this batch file.
2. NirCmdc.exe -- a free tool available at NirSoft. I use it to auto close the viewer message box (if connection is dropped)
3. config-sp.vnc -- the connection file, which save the connecting information, you can create your copy during a successful connection (of course, using the repeater)
4. v2r-autoreconnect.bat -- This is the batch file to do the said job, here is the content:
When all ready, put all the files into a separate folder, which including all the files mentioned, andrem ===========================
rem v2r-autoreconnect.bat
rem ===========================
@echo off
rem ===== Following Code check if the vncviewer-sp.exe is alreading running ======
tasklist | find /i "vncviewer-sp.exe" >nul
if ERRORLEVEL 1 goto :LOOP_BGN
nircmdc.exe infobox "Another Session Is Running Already!" "VNCviewer-Repeater AutoReconnection"
goto :END
:LOOP_BGN
rem ===== Following Code Check the status of vncviewer-sp.exe for every 7 second
rem ===== If the vncviewer-sp.exe is not running, start it.
ping 1.1.1.1 -n 1 -w 7000 >nul
tasklist | find /i "vncviewer-sp.exe" >nul
if ERRORLEVEL 1 start vncviewer-sp.exe -config config-sp.vnc
rem ===== Following statement shows another method to start the vncviewer-sp.exe,
rem ===== if you don't want to use a .vnc file.
rem if ERRORLEVEL 1 start vncviewer-sp.exe -connect ID:1235 -nostatus -proxy uvnc.com:5901
rem ==== The next statement check if the "VNCViewer Message Box" appear,
rem ==== if this happened means the connection to repeater is broken,
rem ==== then close it (this make the vncviewer-sp.exe terminate too, loopback to start again
ping 1.1.1.1 -n 1 -w 500 >nul
nircmdc.exe win close title "VNCViewer Message Box"
goto :LOOP_BGN
:END
also the dsmplugin & key if you use encryption.
To Start, just run the v2r-autoreconnect.bat
To Stop, close the CMD Window opened by v2r-autoreconnect.bat. But the vncviewer-sp.exe may be stilling running, you need to stop it with the TaskMgr, or using the Taskkill command.
To create config-sp.vnc, you may reference [topic=15484]this thread[/topic].