home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / open.cmd < prev    next >
OS/2 REXX Batch file  |  1994-12-30  |  2KB  |  76 lines

  1. /* OPEN.CMD - open an object in a specified view */
  2.  
  3. /* Original stolen from OPEN.CMD as listed in Melissa Woo's excellent
  4.  * "Stupid OS/2 Tricks" (get it from ftp-os2.cdrom.com).
  5.  * Not very much remains from the original, though.
  6.  *
  7.  * If anyone can make this script:
  8.  *   1. Work with files with spaces in the path.
  9.  *   2. Open abstract objects
  10.  *   3. Open view's with spaces in their names
  11.  *   4. List available view's for an object and/or check the view's
  12.  *      available against the view requested.
  13.  * you're more than welcome to make the change.
  14.  *
  15.  * Questions can be directed to (although not necessarily answered by)
  16.  * etxbrfa@kk.ericsson.se or bjorn@algonet.se (same person, different
  17.  * addresses).
  18.  *
  19.  * Oh, BTW, you're completely on your own with this script. It works for
  20.  * me, on my machine, for what little testing I've done. If it doesn't
  21.  * work for you, too bad. I will claim no responsibility for anything
  22.  * this program causes, or doesn't cause for that matter. Screwed up
  23.  * data, wrong view's, bad weather, terrible lunch, and so on, are *not*
  24.  * my fault; they're your fault for taking the risk.
  25.  *
  26.  * However, if it works, great! If you feel like it please send me a post
  27.  * card. The address is:
  28.  *
  29.  *   Bjorn Fahller  c/o Eklund
  30.  *   Kvistbrogran 15
  31.  *   S-124 67 Bandhagen
  32.  *   SWEDEN.
  33.  */
  34.  
  35. call RxFuncAdd "SysSetObjectData", "RexxUtil", "SysSetObjectData"
  36. PARSE ARG objectpath view
  37.  
  38. if objectpath == '' then do
  39.    say "open objectpath view"
  40.    exit
  41. end  /* Do */
  42.  
  43. if view == '' then
  44.    view='DEFAULT'
  45.  
  46. drive=filespec("drive", objectpath)
  47. path=filespec("path", objectpath)
  48. name=filespec("name", objectpath)
  49.  
  50. if drive == '' then
  51.    drive=filespec("drive", directory())
  52.  
  53. if path == '' then
  54.    path=filespec("path", directory())
  55.  
  56.  
  57. objectpath=drive''path''name
  58.  
  59. rc = SysSetObjectData(objectpath, "OPEN="view) ;
  60.  
  61. if rc == 0 then do /* hmm, maybe it was a relative path */
  62.    if RIGHT(directory(), 1) == '\' then
  63.       here = directory()
  64.    else
  65.       here = directory()'\'
  66.    part=filespec("path", here)
  67.    objectpath=drive''part''path''name
  68.    rc = SysSetObjectData(objectpath, "OPEN="view) ;
  69. end  /* Do */
  70.  
  71. if rc == 0 then
  72.   say 'Could not open ' objectpath
  73. exit
  74.  
  75.  
  76.