@Echo off

rem Script for connection to JobClient via RemoteDesktop Connection
set Path=#03-BinPublic_DP#\UltraVnc;#03-BinPublic_DP#;%Path%


set Client_ComputerName=#JobComputers_tbl.ComputerName#
set Client_ComputerFQDN=#JobComputers_tbl.ComputerFQDN#
if "%Client_ComputerFQDN%" equ "" set Client_ComputerFQDN=%Client_ComputerName%

set 20-JobComputerScripts_DP=#20-JobComputerScripts_DP#
set 01-BinServer_DP=#01-BinServer_DP#
set 02-BinClient_DP=#02-BinClient_DP#
set 03-BinPublic_DP=#03-BinPublic_DP#
set 04-Templates_DP=#04-Templates_DP#
set 10-Doku_DP=#10-Doku_DP#
set 90-DATA_DP=#90-DATA_DP#
set S_Root_DP=#00-ApplRoot_DP#

rem Titelzeile schreiben
title #MyApplTitleShort# connect Remote to:[\\%Client_ComputerName%]

:Menue
 set RS_W=1024& set RS_H=768
 set RM_W=1200& set RM_H=840
 set RL_W=1240& set RL_H=940
 set RXL_W=1600& set RXL_H=1024

 set VS_S=10/5&  set VS_D=Scale 0.5 small..:
 set VM_S=10/7&  set VM_D=Scale 0.7 middel.:
 set VL_S=10/10& set VL_D=Scale 1.0 large..:

 Call ColorSet.cmd OK
 if /I "%Client_ComputerName%" neq "%computername%" goto :jumbOver
    Echo -----------------------------------------------------------------------

    Call ColorSet.cmd ERR
    Banner ERR
    Echo Info: You try to create a self referencing remote connection
    Echo on the computer you are currently working with [\\%Client_ComputerName%]
    pause
    Echo -----------------------------------------------------------------------
 :jumbOver

 Echo.
 Echo --------------------------------------------------------------------------
 Echo Connect Remote Tool to \\%Client_ComputerName%
 Echo to get the connection using   FQDN=[%Client_ComputerFQDN%]
 Echo.
 Echo please select the resolution you would like to use
 Echo.
 Echo  RDP  --- connect via Remote Desktop ------
 Echo  RS  = W:[%RS_W%]  H:[%RS_H%] small
 Echo  RM  = W:[%RM_W%]  H:[%RM_H%] middel
 Echo  RL  = W:[%RL_W%]  H:[%RL_H%] large
 Echo  RXL = W:[%RXL_W%] H:[%RXL_H%] large
 Echo.
 Echo  VNC  --- connect via Ultra VNC -----------
 Echo  VS  = %VS_D% [%VS_S%]
 Echo  VM  = %VM_D% [%VM_S%]
 Echo  VL  = %VL_D% [%VL_S%]
 Echo.
 Echo  P = Ping this Host (%Client_ComputerFQDN%)
 Echo.
 Echo  Q  = Quit (end this menue)
 Echo.
 set doNext=

 set /P doNext= waehle Funktion:

 Color A0
 if /I "%doNext%"=="Q"   Exit
 if /I "%doNext%"=="RS"   set Res=/W:%RS_W%  /H:%RS_H%&  goto :RemoteDesktop
 if /I "%doNext%"=="RM"   set Res=/W:%RM_W%  /H:%RM_H%&  goto :RemoteDesktop
 if /I "%doNext%"=="RL"   set Res=/W:%RL_W%  /H:%RL_H%&  goto :RemoteDesktop
 if /I "%doNext%"=="RXL"  set Res=/W:%RXL_W% /H:%RXL_H%& goto :RemoteDesktop

 if /I "%doNext%"=="VS"   set vncOpt=-scale %VS_S%& goto :VncViewer
 if /I "%doNext%"=="VM"   set vncOpt=-scale %VM_S%& goto :VncViewer
 if /I "%doNext%"=="VL"   set vncOpt=-scale %VL_S%& goto :VncViewer


 if /I "%doNext%"=="P"   Call :Ping
 goto :Menue

:RemoteDesktop
 start "RDP" mstsc.exe /V:%Client_ComputerFQDN% %Res%
 goto :Ende

:VncViewer
 Echo JobComputers_tbl.OsPassword:[#JobComputers_tbl.OsPassword#]
 set vncPw=#JobComputers_tbl.OsPassword#
 set ToRun=vncviewer.exe -connect "%Client_ComputerName%"
 set ToRun=%ToRun% -shared -64colors
 if "%vncOpt%" neq "" set ToRun=%ToRun% %vncOpt%
 if "%vncPw%" neq "" set ToRun=%ToRun% -password "%vncPw%"
 Banner UVNC:
 Banner %Client_ComputerName%
 start "Ultra VNC Viewer" %ToRun%

goto :Ende

:Ping
 Echo.
 Echo --------------------------------------------------------------------------
 Echo Ping \\%Client_ComputerName% FQDN=[%Client_ComputerFQDN%]
 Ping %Client_ComputerFQDN%
 Echo --------------------------------------------------------------------------
 goto :eof

:Ende
