home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / ma9609.zip / OS2PIcon.Cmd next >
OS/2 REXX Batch file  |  1995-04-29  |  3KB  |  81 lines

  1. /***************************************************************************/
  2. /* OS2PIcon.Cmd                                                            */
  3. /*                                                                         */
  4. /* Creates an icon for the OS/2 Periodical Database                        */
  5. /*                                                                         */
  6. /* Revisions:                                                              */
  7. /*     04/29/95 1.0 - Changed name of database to OS/2 Periodical Database.*/
  8. /*     09/07/94 1.0 - Created.                                             */
  9. /***************************************************************************/
  10.  
  11.    objectid = '<OS2PUBDB>'
  12.  
  13. /* Load REXX Utility Functions */
  14.  
  15.    if AddRexxUtil( 'SysCreateObject' ) then signal ERROR
  16.    if AddRexxUtil( 'SysSetObjectData' ) then signal ERROR
  17.  
  18. /* Get arguments */
  19.  
  20.    parse upper arg path location extra
  21.  
  22. /* If no path or "." specified, use current directory */
  23.  
  24.    if path = '' then
  25.       path = '.'
  26.  
  27.    if path = '.' then
  28.       path = directory()
  29.  
  30. /* If no location specified, put it on the desktop */
  31.  
  32.    if location = '' then
  33.       location = '<WP_DESKTOP>'
  34.  
  35. /* Create the program object */
  36.  
  37.    classname = 'WPProgram'
  38.    title     = 'OS/2 Periodical^Database'
  39.    setup     = 'OBJECTID='objectid';' || ,
  40.                'EXENAME=VIEW.EXE;' || ,
  41.                'PARAMETERS='path'\OS2PUBS.INF ABOUT;' || ,
  42.                'ICONFILE='path'\OS2PUBS.ICO;' || ,
  43.                'PROGTYPE=PM;'
  44.  
  45.    result = SysCreateObject( classname, title, location, setup, 'f' )
  46.    if result = 1 /* created */ then
  47.       say 'Program object created'
  48.    else do
  49.    /* See if object already exists */
  50.       result = SysSetObjectData( objectid, setup )
  51.       if result = 1 /* updated */ then
  52.          say 'Program object already exists'
  53.       else do
  54.          say 'Unable to create program object'
  55.          signal ERROR
  56.       end  /* Do */
  57.    end  /* Do */
  58.  
  59. /* Exit the REXX procedure */
  60.  
  61.    exit x2d(0000)
  62.  
  63. ERROR:
  64.    exit x2d(1604)
  65.  
  66. /* AddRexxUtil procedure */
  67.  
  68. AddRexxUtil: procedure
  69.  
  70.    parse arg name
  71.  
  72.    if RxFuncQuery( name ) \= 0 /* not registered */ then do
  73.       if RxFuncAdd( name, 'RexxUtil', name ) \= 0 /* not successful */ then do
  74.           say 'Unable to register REXX Utility Function' name
  75.           return 1  /* failure */
  76.       end  /* Do */
  77.    end  /* Do */
  78.  
  79.    return 0  /* success */
  80.  
  81.