home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdor2.zip / DISK_10 / IMAGE9.ZIP / OPEN.CMD < prev    next >
OS/2 REXX Batch file  |  1993-08-20  |  3KB  |  100 lines

  1. /*****************************************************************************
  2.  *                  OPEN - Open Folder View of a Directory                   *
  3.  *                     CORE Development (CORE at WATSON)                     *
  4.  *****************************************************************************
  5.  *                    Licensed Materials-Property of IBM                     *
  6.  *               5604-472 (c) Copyright IBM Corporation, 1993                *
  7.  *                           All rights reserved.                            *
  8.  *                  US Government Users Restricted Rights -                  *
  9.  *                 Use, duplication or disclosure restricted                 *
  10.  *                by GSA ADP Schedule Contract with IBM Corp.                *
  11.  *****************************************************************************/
  12. trace 'O'
  13. Object = ''
  14. Type = ''
  15. parse upper arg Args
  16. Args = strip(Args)
  17. do while Args <> ''
  18.   if abbrev(Args, '"')
  19.     then parse var Args '"' Arg '"' Args
  20.     else parse var Args Arg Args
  21.   if abbrev(Arg, '?')
  22.     then signal Tell
  23.     else if wordpos(Arg, 'DEFAULT SETTINGS ICON TREE DETAILS') > 0
  24.       then if Type = ''
  25.         then Type = Arg
  26.         else signal Tell
  27.       else if Object = ''
  28.         then Object = Arg
  29.         else signal Tell
  30. end
  31.  
  32. call rxFuncAdd 'sysLoadFuncs', 'REXXUTIL', 'sysLoadFuncs'
  33. signal on syntax name NoRexxUtil
  34. call sysLoadFuncs
  35. signal off syntax
  36.  
  37. if Object = ''
  38.   then Object = directory()
  39.   else do
  40.     Object = strip(Object,,'"')
  41.     if \abbrev(Object, '?') & \abbrev(Object, '<')
  42.       then do
  43.         Home = directory()
  44.         New = directory(Object)
  45.         if New <> ''
  46.           then Object = New
  47.         call directory Home
  48.       end
  49.   end
  50. if Type = ''
  51.   then Type = 'DEFAULT'
  52.  
  53. signal on syntax name WrongRxUtil
  54. Failure = \sysSetObjectData(Object, 'OPEN='Type';')
  55. signal off syntax
  56. if Failure & \abbrev(Object, '<')
  57.   then Failure = \sysSetObjectData('<'Object'>', 'OPEN='Type';')
  58. if Failure
  59.   then say 'Could not open' Type 'view of "'Object'".'
  60. exit
  61.  
  62. Tell:
  63. say
  64. say ' OPEN - Open the a folder view of the current directory.'
  65. say
  66. say ' OPEN [object [view]]   or   OPEN [view [object]]'
  67. say
  68. say ' "Object" can be a absolute or relative directory name, or an OS/2'
  69. say '    object name.  The default is the current directory.'
  70. say ' "View" can be any of DEFAULT, SETTINGS, ICON, TREE or DETAILS.  The'
  71. say '    default is DEFAULT.'
  72. say
  73. say ' Examples:'
  74. say '   OPEN D:\OS2\SYSTEM DETAILS'
  75. say '   OPEN ICON D:\OS2'
  76. say '   OPEN TREE'
  77. say '   OPEN ..'
  78. say '   OPEN "<WP_NOWHERE>"'
  79. say '   OPEN "?:\README"'
  80. say
  81. exit
  82.  
  83. NoRexxUtil:
  84. if rc = 43
  85.   then do
  86.     say ' OPEN:  Error loading REXXUTIL library.  OPEN only works on'
  87.     say ' OS/2 2.x systems and REXXUTIL.DLL must be available.'
  88.   end
  89.   else say rc 'Something strange just happened...'
  90. exit 0
  91.  
  92. WrongRxUtil:
  93. if rc = 43
  94.   then do
  95.     say ' OPEN:  REXXUTIL.DLL on your system does not include the'
  96.     say ' SysSetObjectData function.  OPEN can not be used.'
  97.   end
  98.   else say rc 'Something strange just happened...'
  99. exit 0
  100.