home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdor3.zip / DISK_13 / IMAGE12.ZIP / CATALOG / DOORAUTO.CMD < prev    next >
OS/2 REXX Batch file  |  1993-08-23  |  4KB  |  133 lines

  1. /*****************************************************************************
  2.  *            IBM NetDoor Catalog - Recreate NetDoor Startup folder          *
  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. signal on syntax
  14. signal on novalue
  15. call on halt
  16. call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
  17. Ver = 'CAddInit'()
  18. if abbrev(Ver, 'ERROR:')
  19.   then exit 200
  20. Title = RxCAdd.STitle 'Installation'               
  21. XCode = 0
  22. if 'REGFUNC'('COUENV') <> 0
  23.   then call AddExit 206, 'Error registering COUENV.DLL.'
  24.  
  25. ObjId = '<CORE_STARTUP_FOLDER>'
  26. CDr = strip(rxCouInfo('GET', 'REMOTE'), 'T', '\')'\'
  27. if rxCouInfo('VER') = 1
  28.   then Icon = CDr'CATALOG\COUAUTO.ICO'
  29.   else Icon = CDr'COREADD\COUAUTO.ICO'
  30.  
  31. select
  32.   when RxCAdd.OpType = 'ADD'
  33.     then do
  34.       if rxOs2Ver() < 2.0
  35.         then call AddExit 2, 'The CORE Startup Folder is only supported on',
  36.             'OS/2 2.0 and later.'
  37.       if \SysCreateObject('WPFolder', 'CORE Startup', '<CORE_COREFOLDER>',,
  38.           'OBJECTID='ObjId';ICONFILE='Icon, 'U')
  39.         then if \SysCreateObject('WPFolder', 'CORE Startup', '<WP_DESKTOP>',,
  40.             'OBJECTID='ObjId';ICONFILE='Icon, 'U')
  41.           then call AddExit 3, Title 'could not be created.'
  42.           else call 'MessageBox' Title, 'The startup folder was created',
  43.               'on the desktop as the product folder could not be',
  44.               'located.'
  45.     end
  46.   when RxCAdd.OpType = 'REMOVE'
  47.     then do
  48.       call 'MessageBox' 'If you really want to destroy the CORE Startup',
  49.           'folder and all of it''s contents, shred it.'
  50.       XCode = 2
  51.     end
  52.   otherwise do
  53.     call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
  54.     XCode = 201
  55.   end
  56. end
  57. call AddExit XCode
  58.  
  59. RunItl: procedure expose RXCADD. Title
  60. parse arg ItlName
  61. CDr = rxCouInfo('GET', 'REMOTE')
  62. List = 'VERSION STITLE OPTYPE PREVIOUS'
  63. do I = 1 to words(List)
  64.   Name = 'RXCADD.'word(List, I)
  65.   call value Name, value(Name), 'OS2ENVIRONMENT'
  66. end I
  67. do I = 1 to RXCADD.PROGINFO.0
  68.   call value 'RXCADD.PROGINFO.'I, RXCADD.PROGINFO.I, 'OS2ENVIRONMENT'
  69. end I
  70. if pos('\', ItlName) = 0
  71.   then do
  72.     parse source . . Me
  73.     ItlName = left(Me, lastpos('\', Me))||ItlName
  74.   end
  75. '@CALL' CDr'IMPIT.CMD /R:'ItlName '/NOPAUSE'
  76. if rc <> 0
  77.   then call AddExit 205, 'Error' rc 'returned by ITL interpreter.'
  78. return rc
  79.  
  80. AddExit:
  81. parse arg XCode, Msg
  82. if XCode = ''
  83.   then XCode = 0
  84. if Msg <> ''
  85.   then call 'MessageBox' Title, Msg
  86. call 'CAddComplete' XCode
  87. call 'CAddExit'
  88. exit XCode
  89.  
  90. /***********************************************************************
  91.  *                             ERROR TRAPS                             *
  92.  ***********************************************************************/
  93. BugInit:
  94. signal off error; signal off failure; signal off halt
  95. signal off novalue; signal off notready; signal off syntax
  96. parse upper source . . Me
  97. if symbol('TITLE') = 'LIT'
  98.   then Title = 'Catalog Failure'
  99. Me = Me':'||'0A'x
  100. if symbol('GLOBALS') = 'LIT'
  101.   then do
  102.     Globals = 'TrVal'
  103.     TrVal = 'O'
  104.   end
  105. return
  106.  
  107. Halt:
  108. Where = SigL
  109. call BugInit
  110. call 'MessageBox' Title, Me||'Execution halted by user in line' Where
  111. XXC = 204
  112. signal DebugExit
  113.  
  114. Syntax:
  115. Where = SigL
  116. call BugInit
  117. call 'MessageBox' Title,,
  118.     Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
  119. XXC = 203
  120. signal DebugExit
  121.  
  122. Novalue:
  123. Where = SigL
  124. call BugInit
  125. call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
  126. XXC = 203
  127. signal DebugExit
  128.  
  129. DebugExit:
  130. call 'CAddComplete' XXC
  131. call 'CAddExit'
  132. exit XXC
  133.