home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / objst11.zip / viewst.cmd < prev   
OS/2 REXX Batch file  |  1995-07-20  |  3KB  |  73 lines

  1. /* REXX Scipt to start a windows viewer from WebEx */
  2.  
  3. /* Obviously, this script expects WebEx to call it like this:
  4.    webst.cmd %s.  That is, it just expects Web Explorer to pass
  5.    the filename of the temporary file it created for whatever it
  6.    just downloaded.  This script can be configured to pass any
  7.    other arguments desired to the actual viewer. */  
  8.  
  9. /* These first few lines take the name of the temporary file
  10.    passed from Web Explorer, and make a copy of it.  This is necessary
  11.    because WebEx will delete the temporary file it created as soon as
  12.    this REXX script exits, which would mean the temp file wouldn't
  13.    be there for the viewer to open.  The downside is that this new
  14.    file will never be deleted.  I recommend making an object which
  15.    calls a .cmd file which deletes these temp files.  You can put this
  16.    in your startup folder, and also call it whenever you want.
  17.    In my config.sys, I define both the TEMP and TMP environment
  18.    variables, like this:  SET TEMP=f:\temp
  19.                           SET TMP=f:\temp
  20.    Most programs will respect these variables.  The f:\temp can be
  21.    replaces by whatever path is desired.  WebEx, and many other programs
  22.    will now use this directory for their temporary files.  You can now
  23.    create a batch file which, on startup, calls the command "del /n f:\temp\*".
  24.    This will delete all the files in the temp directory on every bootup. */
  25.  
  26. /* The filename Web Explorer passes is an 8.3 filename.  The character
  27.    right before the period always seems to be a number.  I just map
  28.    this last number into a letter.  This will insure the filename is unique
  29.    (as long as Web Explorer is creating unique filenames), and they
  30.    won't collide with filenames Web Explorer makes. This method has the
  31.    advantage of maintaining the original file's extension. */
  32.  
  33. parse arg filenmin
  34.  
  35. periodpos=pos(".",filenmin)
  36. filenlen=length(filenmin)
  37. lastdigit=right(left(filenmin,periodpos-1),1)
  38. fileleft=left(filenmin,periodpos-2)
  39. exten=right(filenmin,filenlen+1-periodpos)
  40. if (lastdigit='0') then lastletter='a'
  41. if (lastdigit='1') then lastletter='b'
  42. if (lastdigit='2') then lastletter='c'
  43. if (lastdigit='3') then lastletter='d'
  44. if (lastdigit='4') then lastletter='e'
  45. if (lastdigit='5') then lastletter='f'
  46. if (lastdigit='6') then lastletter='g'
  47. if (lastdigit='7') then lastletter='h'
  48. if (lastdigit='8') then lastletter='i'
  49. if (lastdigit='9') then lastletter='j'
  50. filenm= fileleft || lastletter || exten
  51.  
  52. /* filenmin contains Web Explorer's filename. */
  53.  
  54. 'copy' filenmin filenm
  55.  
  56. /* Finally, call objst.exe, which will start the viewer.  The first
  57.    parameter passed must be the object handle of the object to open,
  58.    obtained with FeelX.  After this, any parameters can be passed to
  59.    the program, with the filename interspersed between them as the
  60.    program needs.  In general it might look like this:
  61.    'objst.exe <handle> <parameters1> <filename> <more parameters>'.
  62.    To add your own parameters, edit the paramstring1, paramstring2
  63.    definitions below.  Right now, they are both set to be empty.
  64.    In this case, 170010 was the object handle of an object on my
  65.    desktop.  There were no other parameters to be passed, except the
  66.    filename.                                                         */
  67.  
  68. objecthandle='170010'
  69. paramstring1=''
  70. paramstring2=''
  71.  
  72. 'objst.exe' paramstring1 objecthandle paramstring2 filenm
  73.