home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / sysutils / makeobj / makeobj.cmd < prev    next >
Encoding:
Text File  |  1993-06-15  |  5.4 KB  |  130 lines

  1. /***********************************************************************\
  2.  *                                 PC2.c                               *
  3.  *                 Copyright (C) by Stangl Roman, 1993                 *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed.                                                            *
  6.  *                                                                     *
  7.  *  Copyright (C) by Pflanz Ingo, 1993 for enhancements for use via    *
  8.  *  commandline parameters or filetype association (use for *.cmd,     *
  9.  *  *.bat, *.com, *.exe). For distribution, see above.                 *
  10.  *                                                                     *
  11.  * MakeObj.cmd  Installation batch file.                               *
  12.  *                                                                     *
  13.  *              MakeObj <<<Drive:\>Path\>Executable>                   *
  14.  *              e.g. MakeObj C:\PMAPPS\PC2                             *
  15.  *                                                                     *
  16. \***********************************************************************/
  17.  
  18.                                         /* Register REXX APIs */
  19. Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  20. Call SysLoadFuncs
  21. Signal On Halt Name SignalHandler       /* Exception handler */
  22.  
  23. Filename=" "
  24. Arg Filename
  25. if Filename \= " " then
  26. do
  27.    if SysFileTree(Filename,tempvar,'FO') \=0 then
  28.    do
  29.      say "Could not get enough memory: Panik exit!!!"
  30.      Pull IgnoreInput
  31.      Say "PC/2 abnormal error - exiting..."
  32.      Say
  33.      Say " Press Enter to continue!..."
  34.      EXIT
  35.    end /* do */
  36.    if tempvar.0 \=1 then
  37.      Filename = " "
  38.    else
  39.      Filename = tempvar.1
  40. end /* do */
  41.  
  42. Do While Filename=" " | tempvar.0 \=1
  43.     Call SysCls
  44.     Say "                         WPS Objects Installer"
  45.     Say
  46.     Say " To install any Object with an registered Object ID (Idendity) onto the"
  47.     Say " WPS, you must provide the  file name to be registered as an Object. You may"
  48.     Say " then use PC/2 to launch this object, after you have configured this Object"
  49.     Say " with any needed modifications via the settings notebook. e.g.you may want to"
  50.     Say " create an Object for an Windows application and then reconfigure it as an "
  51.     Say " seamless WIN-OS2 session, allowing you to launch this seamless WIN-OS2"
  52.     Say " session from PC/2."
  53.     Say
  54.     Say " Brackets will automatically added to the ObjectID (typing MyExeFile will"
  55.     Say " result in an ObjectID of <MyExeFile>). The last extension will be removed"
  56.     Say " bevor (PC2.EXE will result in an Object named PC2 with an ObjectID of <PC2>)."
  57.     Say " But dont forget to type in the extension, it is needed."
  58.     Say
  59.     Say " Syntax:       MakeObject <Exefile.EXE>"
  60.     Say
  61.     Say " Press Ctrl-C to end"
  62.     Say
  63.     Parse Value SysCurPos() with Row Col
  64.     Say " Please input: "
  65.     Col=Col+15
  66.     Call SysCurPos Row, Col
  67.     Pull Filename
  68.     if Filename \= " " then
  69.     do
  70.       if SysFileTree(Filename,tempvar,'FO') \=0 then
  71.       do
  72.           say "Could not get enough memory: Panik exit!!!"
  73.           Say "PC/2 abnormal error - exiting..."
  74.           Say
  75.           Say " Press Enter to continue!..."
  76.           Pull IgnoreInput
  77.           EXIT
  78.       end /* do */
  79.       if tempvar.0 \=1 then
  80.           Filename = " "
  81.       else
  82.           Filename = tempvar.1
  83.     end /* do */
  84. End /* do while */
  85. Say
  86.  
  87. exedir = Filename /*SysSearchPath('.',Filename)*/
  88.  
  89. NewObjectName=LEFT(FILESPEC("name",Filename),LASTPOS('.',FILESPEC("name",Filename))-1)
  90. SetupString='OBJECTID=<'||NewObjectName||'>;WORKDIR='FILESPEC("drive",exedir)||FILESPEC("path",exedir)';EXENAME='||exedir||';'
  91.                       /*'PROGTYPE='exetype';'||,'OPEN=DEFAULT;'||,*//* could be added or not */
  92.                                         /* Now create the WPS Object on the Desktop */
  93. rc=SysCreateObject("WPProgram",,
  94.                    NewObjectName,,
  95.                    "<WP_DESKTOP>",,
  96.                    SetupString)
  97. If rc=0 Then Do
  98.     Say " Sorry, WPS Object couldn't be created..."
  99.     Say
  100.     Say " Press Enter to continue!..."
  101.     Pull IgnoreInput
  102. End /* do */
  103. Else Do
  104.     Say " WPS Object sucessfully created..."
  105.     Say
  106.     Say " You may now want to open the Settings of the newly created  WP Object to"
  107.     Say " reconfigure it's setting, e.g. an fullscreen, windows or seamless WIN-OS2"
  108.     Say " session. Don't forget to add the enclosing brackets '<' and '>' on the"
  109.     Say " second line if you drag the object to the PC/2 Programm Installation page."
  110.     Say
  111. End /* do */
  112. Exit
  113.  
  114. /*--------------------------------------------------------------------------------------*\
  115.  * The signal handler to exit after an exception                                        *
  116.  * Req:                                                                                 *
  117.  *      none                                                                            *
  118.  * Returns:                                                                             *
  119.  *      none                                                                            *
  120. \*--------------------------------------------------------------------------------------*/
  121. SignalHandler:
  122. Say
  123. Say
  124. Say "PC/2 abnormal error - exiting..."
  125. Say
  126. Say " Press Enter to continue!..."
  127. Pull IgnoreInput
  128. Exit
  129.  
  130.