Weird quirk in MSDOS batch wrapper for vncveiwer

Shing-Fat (Fred) Ma fma "at" doe.carleton.ca
Tue, 01 Jan 2002 11:52:50 +0000


Thanks, Alex.

I'm in a bit of a bind here.  Since I'm not a software guy and not really a
MS-DOS/Win guy, and also relatively new to VNC  and
secure ssh connections (and VNC is the Nth solution
I'v investigated), I am in the unfortunate situation of having spent
all my time getting the means working and the ends has been seriously
neglected.  So I'm saving your email for when I have a chance to find out
about VB and how to use it.  I don't know if it exists on my system.
For now, I just forego the wrapper.  I have so many shortcuts
because I treat the ones that came with the TightVNC installation as
sacred and want to preserve them (they must have been specially defined
for some reason!).  I also have a few shortcuts speckled through my
laptop.  Being a laptop, I can be connecting to home ADSL, the university
LAN, or at the company where I intern.  Or I can be visiting family in
Toronto and relying on 56Kbps or less to access those places.  So I
want a few viewer configurations.  Actually, I probably spent far more
time learning how to do the MSDOS attempt on a wrapper than I will
ever save by having shortcuts in my whole life, but it is annoying
and error-prone having punch in the same things again and again.
And I am spoiled by unix scripting that I got lulled into taking a shot
at it.  But it never seemed to end.  Now I must stop.  But thanks, I
appreciate the work you put into it  and I will eventually have a
second look at it and your solution

Fred

--------------------------------------------------------------------------
Fred Ma
Department of Electronics
Carleton University, Mackenzie Building
1125 Colonel By Drive
Ottawa, Ontario
Canada     K1S 5B6
fma "at" doe.carleton.ca
==========================================================================

>
> Date: Mon, 31 Dec 2001 04:58:25 -0500
> From: "Alex Angelopoulos" <alex "at" bittnet.com>
> Subject: Re: Weird quirk in MSDOS batch wrapper for vncveiwer
>
> Fred...
>
> Speaking as someone who does a bit with Win32 scripting (and used to do much more with it on Unix in college) you know of course
> that you are working with implements "poorly suited for their intended purpose".
> :) - of course, your options are limited...
>
> I tried the script you showed on XP, and I get the same server not found error whether I am using it with or without the optional
> args embedded, no matter what the version of viewer I use.
>
> A VBScript may be much cleaner for you, and one which gives you a clean command line is fairly trivial to write if you know WSH very
> well. I went ahead and wrote a wrapper for this in VBScript.  This should work as far as giving you a clean command line, and
> executes properly with WSH 5.6 ( you may need to update your version of WSH to make it work, but I doubt it).
>
> If you DO need to update, the download should be
> http://download.microsoft.com/download/winscript56/Install/5.6/W9XNT4Me/EN-US/scr56en.exe
> for a North American English version that works on Me.
>
> If it works, in "payment" I would like to hear what you are doing and why you are using so many configurations - I do a lot with
> remote control tools from Windows clients, and your situation sounds alittle interesting....
>
> SCRIPT FOLLOWS NOTES
> - -------------------------------------------------------------------------------------------------
> (1) To make linewrap issues apparent, I have numbered the lines.
> (2) This should work whether you have cscript or wscript defined as your "default" WSH environment.
> (3) To "see" the command line, uncomment line 027.
> (4) If you make mods to this, make sure that any paths with embedded spaces are wrapped with quotes (as in line 009, a
> never-documented and ever-present irritation in VBScript and Jscript) AND make certain you have spaces attached between components.
> - ----------------------------------------------------------------------------------------------
>
> 001.  'INITIALIZE OBJECTS
> 002.   'init arguments object
> 003.   Set objArgs = WScript.Arguments
> 004.   'init the Shell object so we can issue a shell command to run the command line when we are done
> 005.   Set objShell = WScript.CreateObject("WScript.Shell")
> 006.
> 007.  'INITIALIZE VARIABLES
> 008.   ' Use the chr(34) to wrap quotes around path with spaces in it
> 009.   cmdBase = chr(34) & "C:\Program Files\ORL\vncviewer.exe" & chr(34)
> 010.   'here's the static options you want
> 011.   cmdMid = "-encoding hextile -compresslevel 9 -quality 0 -noshared -noemulate3 -fullscreen"
> 012.   'init the arguments to nothing
> 013.   cmdArg = ""
> 014.
> 015.  'BUILD COMMAND LINE ARGUMENT SECTION
> 016.   For I = 0 to objArgs.Count - 1
> 017.    'build a command line out of parsed arguments, one space between each
> 018.    cmdArg = cmdArg & " " & objArgs(I)
> 019.   Next
> 020.
> 021.  'ASSEMBLE AND CLEAN THE LINE
> 022.   'chop any leading/trailing whitespace
> 023.   cmdLine = trim(cmdBase & " " & cmdMid & " " & cmdArg)
> 024.
> 025.  'TEST IT IF YOU WANT
> 026.   'Following line if uncommented will show you what your line looks like, delimited with a period at start and end
> 027.   'WScript.Echo "." & cmdLine & "."
> 028.
> 029.  'DO IT
> 030.   'The following line runs the command so that vncviewer is VISIBLE (1) and script does NOT wait until apps exits, but
> terminates ("true").
> 031.   objShell.Run(cmdLine, 1, true)
> - ----------------------------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, mail majordomo "at" uk.research.att.com with the line:
'unsubscribe vnc-list' in the message BODY
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------