@Echo off

rem Script for connection to JobClient via RemoteDesktop Connection
set Path=V:\JobManager\ProgEntw\Ver02\JobManagerV2\03-BinPublic\UltraVnc;V:\JobManager\ProgEntw\Ver02\JobManagerV2\03-BinPublic;%Path%


set Client_ComputerName=PDMDEV01
set Client_ComputerFQDN=
if "%Client_ComputerFQDN%" equ "" set Client_ComputerFQDN=%Client_ComputerName%

set 20-JobComputerScripts_DP=V:\JobManager\ProgEntw\Ver02\JobManagerV2\90-DATA\CustomerNameShort_SettingsGlobal\20-JobComputerScripts
set 01-BinServer_DP=V:\JobManager\ProgEntw\Ver02\JobManagerV2\01-BinServer
set 02-BinClient_DP=V:\JobManager\ProgEntw\Ver02\JobManagerV2\02-BinClient
set 03-BinPublic_DP=V:\JobManager\ProgEntw\Ver02\JobManagerV2\03-BinPublic
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=V:\JobManager\ProgEntw\Ver02\JobManagerV2

rem Titelzeile schreiben
title JS 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:[]
 set vncPw=
 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
