home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / lyrisos2.exe / REXXUTIL.DAT < prev    next >
Text File  |  1996-01-12  |  35KB  |  693 lines

  1. /**************************************************************
  2. *  This script file is provided to give an easy access to     *
  3. *  REXX commands dealing with the creation/modifcation of     *
  4. *  FOLDERS and OBJECTS (Groups & Icons) for use with OS/2     *
  5. *  2.0 and up.  This file is designed to be included from     *
  6. *  another script file before these functions can be called.  *
  7. **************************************************************/
  8.  
  9. /******************************************************************
  10. *  The following block defines variables that are used in this    *
  11. *  script file.  All 'global' variables in this script file will  *
  12. *  begin with the character 'Rexx' to help prevent duplicate      *
  13. *  definitions.                                                   *
  14. ******************************************************************/
  15. @DefineVars
  16.         @Drive   @RexxOS2Drive = C  // contains value of OS/2 Drive
  17.         @Integer @RexxOS2Cntr = 0   // used to determine OS/2 Drive
  18.         // due to an oversight in the scripting language it is
  19.         // necessary to use the following two variables in order to
  20.         // write to a file using block comment notation - / *   */
  21.         @QSTR    @RexxFslash = "/" 
  22.         @QSTR    @RexxAsteric  = "*"
  23.         @QSTR    @RexxFolderID = "INSTALL_FOLDER" // default folder ID
  24. @EndVars
  25.  
  26. /****************************************************************
  27. *  The following block defines the prototypes for the script    *
  28. *  functions used in this file.  All of the prototypes for the  *
  29. *  functions declared in this file are shown here.              *
  30. ****************************************************************/
  31. @DefineProto
  32.         @INT  @ChkIfOS2Running(@Void)
  33.         @INT  @ChkIfREXXInstalled(@Void)
  34.         @Void @CreateREXXCMDFile(@IN @QSTR @REXXCMDFile)
  35.         @Void @CreateWPFolder(@IN @QSTR @Title,
  36.                                         @IN @QSTR @LOCATION,
  37.                                         @IN @QSTR @RexxFolderID,
  38.                                         @IN @QSTR @SETUPSTR)
  39.         @Void @CreateWPIcon(@IN @QSTR @RexxFolderID, 
  40.                                         @IN @QSTR @Title,
  41.                                         @IN @QSTR @EXENAME,
  42.                                         @IN @QSTR @ICONFILE,
  43.                                         @IN @QSTR @WKINGDIR,
  44.                                         @IN @QSTR @SETUPSTR)
  45.         @Void @ExecuteREXXCMDFile(@IN @QSTR @REXXCMDFile)
  46.         @Void @FinishREXXCMDFile(@IN @QSTR @REXXCMDFile)
  47.         @INT  @GetOS2Drive(@INOUT @Drive @RexxOS2Drive)
  48.         @Void @ModifyWPObject(@IN @QSTR @OBJECTID, @IN @QSTR @SETUPSTR)
  49. @EndProto
  50.  
  51.  
  52. /********************************************************************
  53. NAME
  54.                 @ChkIfOS2Running()
  55.  
  56. SYNOPSIS
  57.                 Function returning an integer value.
  58.  
  59. DESCRIPTION
  60.                 This function returns TRUE if OS/2 is running and FALSE
  61.                 if it not.  It's algorithm checks to see if it can find
  62.                 OS/2 first (where it's installed) and then checks to
  63.                 see if several environment variables are set (ones that
  64.                 seem to be exclusive to OS/2 only).  If any of the
  65.                 variables are not set, then this function returns FALSE.
  66.                 If this function can't find the OS/2 drive, then this
  67.                 function returns FALSE.
  68.  
  69. PARAMETERS
  70.                 This function takes no parameters.
  71.  
  72. EXAMPLE
  73.                 @If(@CheckIfOS2Running())
  74.                                 @Display
  75.                                         OS/2 is running
  76.                                         @pause
  77.                                 @EndDisplay
  78.                 @EndIf
  79.  
  80. SEE ALSO
  81.                 @GetOS2Drive(), @CheckIfREXXInstalled()
  82. ********************************************************************/
  83. @DefineFunc @INT @ChkIfOS2Running(@Void)
  84.   @If (@GetOS2Drive(@RexxOS2Drive) != 0)
  85.                 // We can't find where OS/2 is installed, so regardless of whether
  86.                 // we're running under OS/2, return that it is not running since
  87.                 // we won't be able to check if REXX is installed.
  88.                 @Return(@FALSE)
  89.   @EndIf
  90.   @If ("@GetENV("OS2_SHELL")" == "" &&
  91.                 "@GetENV("AUTOSTART")" == "" &&
  92.                 "@GetENV("RUNWORKPLACE")" == "")
  93.                 // all three environment variables were NULL, so it is
  94.                 // very likely (even though we found where OS/2 is installed)
  95.                 // that we're not running OS/2
  96.                 @Return(@False)
  97.   @EndIf
  98.   @Return(@TRUE)
  99. @EndFunc // ChkIfOS2Running()
  100.  
  101.  
  102. /********************************************************************
  103. NAME
  104.                 @ChkIfREXXInstalled()
  105.  
  106. SYNOPSIS
  107.                 Function returning an integer value.
  108.  
  109. DESCRIPTION
  110.                 This function returns TRUE if OS/2 has REXX installed and
  111.                 FALSE if it does not.  It's algorithm checks to see if it
  112.                 can find several files used by REXX in the specific OS/2
  113.                 directories where REXX should be installed.  If any of the
  114.                 files can not be found, this function returns that REXX
  115.                 is not installed.
  116.  
  117. PARAMETERS
  118.                 This function takes no parameters.
  119.  
  120. EXAMPLE
  121.                 @If(@CheckIfOS2Running() && @CheckIfREXXInstalled())
  122.                                 // we're running OS/2 and REXX is installed so
  123.                                 // we can now execute the REXX CMD script we
  124.                                 // just created.
  125.                                 @Spawn("@RexxCMDScript")
  126.                 @EndIf
  127.  
  128. SEE ALSO
  129.                 @GetOS2Drive(), @CheckIfOS2Running()
  130. ********************************************************************/
  131. @DefineFunc @INT @ChkIfREXXInstalled(@Void)
  132.   @If (@Exists("@RexxOS2Drive:\\OS2\\DLL\\REXX.DLL") &&
  133.                 @Exists("@RexxOS2Drive:\\OS2\\DLL\\REXXAPI.DLL") &&
  134.                 @Exists("@RexxOS2Drive:\\OS2\\DLL\\REXXUTIL.DLL") &&
  135.                 @Exists("@RexxOS2Drive:\\OS2\\RXQUEUE.EXE") &&
  136.                 @Exists("@RexxOS2Drive:\\OS2\\DLL\\REXXINIT.DLL"))
  137.                 // all the files necessary for REXX are present, so assume
  138.                 // REXX is installed.  (still possible that is isn't)
  139.                 @Return(@TRUE)
  140.   @EndIf
  141.         @Return(@FALSE)
  142. @EndFunc // ChkIfREXXInstalled()
  143.  
  144.  
  145. /********************************************************************
  146. NAME
  147.                 @CreateRexxCMDFile()
  148.  
  149. SYNOPSIS
  150.                 @Void @CreateREXXCMDFile(@IN @QSTR @REXXCMDFile)
  151.                 Function taking an @QSTRING parameter and returning @VOID.
  152.                 
  153. DESCRIPTION
  154.                 This function does not return a value.  The only parameter
  155.                 this function takes is the name of the REXX script file
  156.                 (including path) that is going to be created.  In addition
  157.                 to creating the file, this script function will put the
  158.                 necessary REXX commands into the REXX script to initialize
  159.                 proper execution of the REXX script.
  160.  
  161. PARAMETERS
  162.                 @IN @QSTR @REXXCMDFile
  163.                                 The name of the file to be created (including path)
  164.  
  165. EXAMPLE
  166.                 @CreateREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  167.  
  168. SEE ALSO
  169.                 @CreateWPFolder(), @CreateWPIcon(), @ModifyWPObject(),
  170.                 @ExecuteREXXCMDFile(), @FinishREXXCMDFile()
  171. ********************************************************************/
  172. @DefineFunc @Void @CreateREXXCMDFile(@IN @QSTR @REXXCMDFile)
  173.         // REXX scripts must start with a comment, so write one
  174.         @Write("@REXXCMDFile", "WT", "@RexxFslash@RexxAsteric REXX CMD Script */\n\n")
  175.         @Write(,,"@RexxFslash@RexxAsteric Created on @DateToStr(@SystemDate) during the installation\n")
  176.         @Write(,,"   of @Name, version @Version. */\n\n")
  177.  
  178.         // add REXX commands to load in REXX UTIL function library
  179.         @Write(,,"@RexxFslash@RexxAsteric Load REXXUTIL */\n")
  180.         @Write(,,"CALL RxFuncAdd 'SysLoadFuncs', 'REXXUtil', 'SysLoadFuncs'\n")
  181.         @Write(,,"CALL SysLoadFuncs\n\n")
  182.         @Return()
  183. @EndFunc // @CreateREXXCMDFile()
  184.  
  185.  
  186. /********************************************************************
  187. NAME
  188.                 @CreateWPFolder()
  189.  
  190. SYNOPSIS
  191.                 @Void @CreateWPFolder(@IN @QSTR @Title,
  192.                                                         @IN @QSTR @LOCATION,
  193.                                                         @IN @QSTR @RexxFolderID,
  194.                                                         @IN @QSTR @SETUPSTR)
  195.  
  196.                 Function taking four @QSTRING parameters and returning @VOID.
  197.                 
  198. DESCRIPTION
  199.                 This function does not return a value.  This function is used
  200.                 to create folders either on the DESKTOP or inside other folders
  201.                 since OS/2 allows the creation of folders within folders.
  202.                 Folders are analogous to GROUPS under Windows, with the objects
  203.                 inside folders equivalent to ICONS or ITEMS in Windows.
  204.                 
  205. PARAMETERS
  206.                 @IN @QSTR @Title
  207.                                 A quoted string containing the name of the FOLDER to be
  208.                                 created.  (that is the text that will appear beneath the
  209.                                 ICON for this particualr folder).
  210.  
  211.                 @IN @QSTR @LOCATION
  212.                                 A quoted string (or variable) containig the text used
  213.                                 to identify the location this folder will be created.
  214.                                 This value can be for example:
  215.  
  216.                                                                         "WP_DESKTOP"
  217.  
  218.                                 if this folder is to be created on the OS/2 Workplace
  219.                                 desktop (most common usage).  However if there is already
  220.                                 a folder (UTILITIES  for example) where you wish to place
  221.                                 this folder, then the ID for that folder can be used.
  222.  
  223.                 @IN @QSTR @RexxFolderID
  224.                                 A quoted string containig the name of the FOLDERID that
  225.                                 the operating system will return when the folder is
  226.                                 created.  This is used for other commands such as
  227.                                 the destination (or location) for @CreateWPIcon() - 
  228.                                 specifying where the ICON(s) should be placed.
  229.  
  230.                 @IN @QSTR @SETUPSTR)
  231.                                 A quoted string containing optional parameters that apply
  232.                                 to creating folders - fonts, background bitmaps, colors,
  233.                                 drag & drop capabilities and many more.  Although this
  234.                                 parameter is required, it is not required to have a value.
  235.                                 Actually most often it will not contain a value and can
  236.                                 actually be placed as "" for the fourth paramter.  If the
  237.                                 fourth parameter is actually used, then it is assumed
  238.                                 that the user who needs to use specific features will
  239.                                 already know REXX syntax.  If the user does not know the
  240.                                 REXX syntax for these types of options, it is recommended
  241.                                 that the user purchase the following resource:
  242.                                 
  243.                                                         "Teach Yourself REXX in 21 Days"
  244.                                                                         by Schindler & Schindler, SAMS Publishing,
  245.                                                                         Copyright 1994.
  246.                                                                         ISBN: 0-672-30529-1
  247.  
  248.  
  249.                         Note:
  250.                                         For the first three parameters, neither the single
  251.                                         quote ('), nor the braces ( < and > ) are needed
  252.                                         around the text as required by REXX syntax.  These
  253.                                         characters are automatically placed into the REXX
  254.                                         command script for you.  However, since the REXX
  255.                                         command script syntax for options (the fourth
  256.                                         parameter to this function) can be quit complex,
  257.                                         we are only providing an interface through which
  258.                                         the exact string can be placed into the REXX script.
  259.                                         Therefore the syntax as it is exactly required should
  260.                                         be placed within quotes - using all characters necessary
  261.                                         including single quotes ('), semicolons (;), braces
  262.                                         ( < and > ) where necessary.
  263.  
  264.                                         The following is a typical example of an optional
  265.                                         setup string and how it would be written within
  266.                                         double quotes (").
  267.  
  268.                                         actual string:
  269.                                         'OBJECTID=<SUB_KDC_FOLDER_install3>;EXENAME='xe';STARTUPDIR='wrkdir';ICONFILE='icon;
  270.  
  271.                                         actual string used as the fourth paramter to this script function:
  272.                                         "'OBJECTID=<SUB_KDC_FOLDER_install3>;EXENAME='xe';STARTUPDIR='wrkdir';ICONFILE='icon;"
  273.  
  274. EXAMPLE
  275.                 // create the REXX script
  276.                 @CreateREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  277.  
  278.                 // add command to create FOLDER (group) on the desktop using
  279.                 // the folder name of "@Name @Version".  The folder ID for
  280.                 // creating Icons in that folder will be "KDC_FOLDER", and the
  281.                 // fourth parameter for optional parameters is not being used
  282.                 // however the "" is still placed to fill the fourth parameter
  283.                 // requirements.
  284.                 @CreateWPFolder("@Name @Version", "WP_DESKTOP", "KDC_FOLDER", "")
  285.  
  286.                 // add command to create OBJECT (icon)
  287.                 @IconName = "@OutDrive:\\@SubDir\\DBPROG.exe"
  288.                 @IconPath = "@OutDrive:\\@SubDir\\DBPROG.ico"
  289.                 @WRKDir = "@OutDrive:\\@SubDir"
  290.                 @CreateWPIcon("KDC_FOLDER", "DB APP", "@IconName", "@IconPath", "@WrkDir", "")
  291.  
  292. SEE ALSO
  293.                 @CreateREXXCMDFile(), @CreateWPIcon(), @ModifyWPObject(),
  294.                 @ExecuteREXXCMDFile(), @FinishREXXCMDFile()
  295. ********************************************************************/
  296. @DefineFunc @Void @CreateWPFolder(@IN @QSTR @Title,
  297.                         @IN @QSTR @LOCATION,
  298.                         @IN @QSTR @RexxFolderID,
  299.                         @IN @QSTR @SETUPSTR)
  300.         @Write(,,"@RexxFslash@RexxAsteric Create the Folder - @Title  on the Desktop */\n")
  301.         @Write(,,"classname = 'WPFolder'\n")
  302.         @Write(,,"location = '<@LOCATION>'\n")
  303.         @If("@SETUPSTR" == ""
  304.                 @Write(,,"setup = 'OBJECTID=<@RexxFolderID>'\n")
  305.         @Else
  306.                 @Write(,,"setup = @SETUPSTR\n")
  307.         @EndIf
  308.         @Write(,,"title = '@Title'\n")
  309.         @Write(,,"return = SysCreateObject(classname, title, location, setup)\n\n")
  310.         @Return()
  311. @EndFunc // @CreateWPFolder()
  312.  
  313.  
  314. /********************************************************************
  315. NAME
  316.                 @CreateWPIcon()
  317.  
  318. SYNOPSIS
  319.                 @Void @CreateWPIcon(@IN @QSTR @RexxFolderID, 
  320.                                                         @IN @QSTR @Title,
  321.                                                         @IN @QSTR @EXENAME,
  322.                                                         @IN @QSTR @ICONFILE,
  323.                                                         @IN @QSTR @WKINGDIR,
  324.                                                         @IN @QSTR @SETUPSTR)
  325.  
  326.                 Function taking six @QSTRING parameters and returning @VOID.
  327.                 
  328. DESCRIPTION
  329.                 This function does not return a value.  This function is used
  330.                 to create objects (either folders or icons) on the DESKTOP or
  331.                 inside other folders since OS/2 allows the creation of folders
  332.                 within folders.  Folders are analogous to GROUPS under Windows,
  333.                 with the objects inside folders equivalent to ICONS or ITEMS in
  334.                 Windows.
  335.                 
  336. PARAMETERS
  337.                 @IN @QSTR @REXXFolderID
  338.                                 A quoted string (or variable) containig the text used
  339.                                 to identify the location this folder will be created.
  340.                                 This value can be for example:
  341.  
  342.                                                                         "WP_DESKTOP"     or    "KDC_FOLDER"
  343.  
  344.                                 if this item is to be created on the OS/2 Workplace
  345.                                 desktop.  However it is more likely it will contain the
  346.                                 value used as the third parameter of the @CreateWPFolder()
  347.                                 function - the ID assigned by the Operating System when
  348.                                 the folder was created.
  349.  
  350.                 @IN @QSTR @Title
  351.                                 A quoted string containing the name of the object to be
  352.                                 created.  (that is the text that will appear beneath the
  353.                                 ICON for this particualr item).
  354.  
  355.                 @IN @QSTR @EXEName
  356.                                 A quoted string containing the name of the object's exe
  357.                                 to be executed when the item is double clicked.  (this
  358.                                 variable should contain the exe (with optional path) only
  359.                                 and NO COMMAND LINE OPTIONS.
  360.  
  361.                 @IN @QSTR @ICONFile
  362.                                 A quoted string containig the name of the icon used for this
  363.                                 object.
  364.  
  365.                 @IN @QSTR @WKINGDIR
  366.                                 A quoted string containing the working directory to be used
  367.                                 when this particular item is executed.
  368.  
  369.                 @IN @QSTR @SETUPSTR
  370.                                 A quoted string containing an optional setup string to modify
  371.                                 other attributes of folders and objects such as fonts, colors,
  372.                                 backgrounds, full screen vs windowed, PM application vs text,
  373.                                 windows program, drag & drop characteristics, etc.
  374.  
  375.                         Note:
  376.                                         For the first five parameters, neither the single
  377.                                         quote ('), nor the braces ( < and > ) are needed
  378.                                         around the text as required by REXX syntax.  These
  379.                                         characters are automatically placed into the REXX
  380.                                         command script for you.  However, since the REXX
  381.                                         command script syntax for options (the sixth
  382.                                         parameter to this function) can be quit complex,
  383.                                         we are only providing an interface through which
  384.                                         the exact string can be placed into the REXX script.
  385.                                         Therefore the syntax as it is exactly required should
  386.                                         be placed within quotes - using all characters necessary
  387.                                         including single quotes ('), semicolons (;), braces
  388.                                         ( < and > ) where necessary.
  389.  
  390.                                         It is assumed that the developer know the appropriate REXX
  391.                                         syntax for manipulating these optional parameters.  If you
  392.                                         are unfamiliar with REXX syntax, please refer to an outside
  393.                                         source which documents the REXX syntax.  One source can be
  394.                                         found from OS/2 directly (using the INFORMATION icon), or
  395.                                         several books exist on the subject.  One particular book
  396.                                         KDC recommends is the following:
  397.  
  398.                                                         "Teach Yourself REXX in 21 Days"
  399.                                                                         by Schindler & Schindler, SAMS Publishing,
  400.                                                                         Copyright 1994.
  401.                                                                         ISBN: 0-672-30529-1
  402.  
  403. EXAMPLE
  404.                 // create the REXX script
  405.                 @CreateREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  406.  
  407.                 // add command to create FOLDER (group) on the desktop using
  408.                 // the folder name of "@Name @Version".  The folder ID for
  409.                 // creating Icons in that folder will be "KDC_FOLDER", and the
  410.                 // fourth parameter for optional parameters is not being used
  411.                 // however the "" is still placed to fill the fourth parameter
  412.                 // requirements.
  413.                 @CreateWPFolder("@Name @Version", "WP_DESKTOP", "KDC_FOLDER", "")
  414.  
  415.                 // add command to create OBJECT (icon)
  416.                 @IconName = "@OutDrive:\\@SubDir\\DBPROG.exe"
  417.                 @IconPath = "@OutDrive:\\@SubDir\\DBPROG.ico"
  418.                 @WRKDir = "@OutDrive:\\@SubDir"
  419.                 @CreateWPIcon("KDC_FOLDER", "DB APP", "@IconName", "@IconPath",
  420.                                         "@WrkDir", "")
  421.  
  422. SEE ALSO
  423.                 @CreateREXXCMDFile(), @CreateWPFolder(), @ModifyWPObject(),
  424.                 @ExecuteREXXCMDFile(), @FinishREXXCMDFile()
  425. ********************************************************************/
  426. @DefineFunc @Void @CreateWPIcon(@IN @QSTR @RexxFolderID, 
  427.                 @IN @QSTR @Title,
  428.                 @IN @QSTR @EXENAME,
  429.                 @IN @QSTR @ICONFILE,
  430.                 @IN @QSTR @WKINGDIR,
  431.                 @IN @QSTR @SETUPSTR)
  432.  
  433.         @Write(,,"@RexxFslash@RexxAsteric Create the Icon - @Title */\n")
  434.         @Write(,,"classname = 'WPProgram'\n")
  435.         @Write(,,"location = '<@RexxFolderID>'\n")
  436.         @Write(,,"title = '@Title'\n")
  437.         @If("@SETUPSTR" == "")
  438.                 @Write(,,"xe = '@EXENAME'\n")
  439.                 @Write(,,"icon = '@ICONFILE'\n")
  440.                 @Write(,,"wrkdir = '@WKINGDIR'\n")
  441.                 @Write(,,"setup = 'OBJECTID=<@RexxFolderID_@TITLE>;EXENAME='xe';STARTUPDIR='wrkdir';ICONFILE='icon;\n")
  442.         @Else
  443.                 @Write(,,"setup = @SETUPSTR\n")
  444.         @EndIf
  445.         @Write(,,"return = SysCreateObject(classname, title, location, setup)\n\n")
  446.         @Return()
  447. @EndFunc // @CreateWPIcon()
  448.  
  449.  
  450. /********************************************************************
  451. NAME
  452.                 @ExecuteRexxCMDFile()
  453.  
  454. SYNOPSIS
  455.                 @Void @ExecuteREXXCMDFile(@IN @QSTR @REXXCMDFile)
  456.                 Function taking an @QSTRING parameter and returning @VOID.
  457.                 
  458. DESCRIPTION
  459.                 This function executes the REXX command script if possible.
  460.                 If first checks to see if OS/2 is runnig, and then also if
  461.                 REXX is installed.  If both conditions are true, then it will
  462.                 spawn a process off to execute the REXX script.  To the end-user
  463.                 this will be transparent as no focus changes or task switching
  464.                 will occur.  If INSTALL is run from within a window rather than
  465.                 full screen, then the only change that takes place during
  466.                 execution is the text in the title bar for the INSTALL window
  467.                 will briefly contain the name of the script command being
  468.                 executed.
  469.  
  470. PARAMETERS
  471.                 @IN @QSTR @REXXCMDFile
  472.                                 The name of the file to be executed (including path)
  473.  
  474. EXAMPLE
  475.                 // create the REXX script
  476.                 @CreateREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  477.  
  478.                 // add command to create FOLDER (group) on the desktop using
  479.                 // the folder name of "@Name @Version".  The folder ID for
  480.                 // creating Icons in that folder will be "KDC_FOLDER", and the
  481.                 // fourth parameter for optional parameters is not being used
  482.                 // however the "" is still placed to fill the fourth parameter
  483.                 // requirements.
  484.                 @CreateWPFolder("@Name @Version", "WP_DESKTOP", "KDC_FOLDER", "")
  485.  
  486.                 // add command to create OBJECT (icon)
  487.                 @IconName = "@OutDrive:\\@SubDir\\DBPROG.exe"
  488.                 @IconPath = "@OutDrive:\\@SubDir\\DBPROG.ico"
  489.                 @WRKDir = "@OutDrive:\\@SubDir"
  490.                 @CreateWPIcon("KDC_FOLDER", "DB APP", "@IconName", "@IconPath",
  491.                                         "@WrkDir", "")
  492.  
  493.                 // write the EXIT command to the REXX file
  494.                 @FinishREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  495.  
  496.                 // actually execute the REXX command script if possible
  497.                 @ExecuteREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  498.  
  499. SEE ALSO
  500.                 @CreateWPFolder(), @CreateWPIcon(), @ModifyWPObject(),
  501.                 @CreateREXXCMDFile(), @FinishREXXCMDFile()
  502. ********************************************************************/
  503. @DefineFunc @Void @ExecuteREXXCMDFile(@IN @QSTR @REXXCMDFile)
  504.         @If(@ChkIfOS2Running() && @ChkIfREXXInstalled())
  505.                 @Spawn("@REXXCMDFile")
  506.         @EndIf
  507.         @Return()
  508. @EndFunc // @ExecuteREXXCMDFile()
  509.  
  510.  
  511. /********************************************************************
  512. NAME
  513.                 @FinishRexxCMDFile()
  514.  
  515. SYNOPSIS
  516.                 @Void @FinishREXXCMDFile(@IN @QSTR @REXXCMDFile)
  517.                 Function taking an @QSTRING parameter and returning @VOID.
  518.                 
  519. DESCRIPTION
  520.                 This function will finish writing to the REXX command script
  521.                 the 'EXIT' command.  It should be called after all other
  522.                 script commands that add text to the REXX script file.  This
  523.                 will ensure proper exiting of the REXX command script after
  524.                 execution and thus enabling proper return of control to
  525.                 INSTALL.
  526.  
  527. PARAMETERS
  528.                 @IN @QSTR @REXXCMDFile
  529.                                 The name of the file to write the EXIT command (including path)
  530.  
  531. EXAMPLE
  532.                 // create the REXX script
  533.                 @CreateREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  534.  
  535.                 // add command to create FOLDER (group) on the desktop using
  536.                 // the folder name of "@Name @Version".  The folder ID for
  537.                 // creating Icons in that folder will be "KDC_FOLDER", and the
  538.                 // fourth parameter for optional parameters is not being used
  539.                 // however the "" is still placed to fill the fourth parameter
  540.                 // requirements.
  541.                 @CreateWPFolder("@Name @Version", "WP_DESKTOP", "KDC_FOLDER", "")
  542.  
  543.                 // add command to create OBJECT (icon)
  544.                 @IconName = "@OutDrive:\\@SubDir\\DBPROG.exe"
  545.                 @IconPath = "@OutDrive:\\@SubDir\\DBPROG.ico"
  546.                 @WRKDir = "@OutDrive:\\@SubDir"
  547.                 @CreateWPIcon("KDC_FOLDER", "DB APP", "@IconName", "@IconPath",
  548.                                         "@WrkDir", "")
  549.  
  550.                 // write the EXIT command to the REXX file
  551.                 @FinishREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  552.  
  553.                 // actually execute the REXX command script if possible
  554.                 @ExecuteREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  555.  
  556. SEE ALSO
  557.                 @CreateWPFolder(), @CreateWPIcon(), @ModifyWPObject(),
  558.                 @CreateREXXCMDFile(), @ExecuteREXXCMDFile()
  559. ********************************************************************/
  560. @DefineFunc @Void @FinishREXXCMDFile(@IN @QSTR @REXXCMDFile)
  561.         @Write("@REXXCMDFile", "AT", "EXIT\n")
  562.         @Return()
  563. @EndFunc // @FinishREXXCMDFile()
  564.  
  565.  
  566. /********************************************************************
  567. NAME
  568.                 @GetOS2Drive()
  569.  
  570. SYNOPSIS
  571.                 Function returning an integer value.
  572.  
  573. DESCRIPTION
  574.                 This function returns 0 if the OS/2 directories can be found,
  575.                 and 1 if they can not be found.  If the directories can be found
  576.                 then the drive variable that is passed in will be updated so
  577.                 that when the functions returns it will contain the correct value.
  578.  
  579. PARAMETERS
  580.                 @INOUT @Drive @RexxOS2Drive
  581.                 This value will store the drive containing the OS/2 directories
  582.                 if they can be found.
  583.  
  584. EXAMPLE
  585.                 @If(@GetOS2Drive(@OS2Drive))
  586.                                 @Display
  587.                                         Could not find the OS/2 Drive.
  588.                                         REXX will not be run.
  589.                                         @pause
  590.                                 @EndDisplay
  591.                 @EndIf
  592.  
  593. SEE ALSO
  594.                 @CheckIfOS2Installed(), @CheckIfREXXInstalled()
  595. ********************************************************************/
  596. @DefineFunc @INT @GetOS2Drive(@INOUT @Drive @RexxOS2Drive)
  597.         @If(@Exists("@BootDrive:\\OS2") && @Exists("@BootDrive:\\OS2\\DLL"))
  598.                 @RexxOS2Drive = @BootDrive // found drive
  599.                 @Return(0)
  600.         @EndIf
  601.  
  602.         @RexxOS2Cntr = 67
  603. LOOP:
  604.         @RexxOS2Drive = (@RexxOS2Cntr)
  605.         @If(@Exists("@RexxOS2Drive:\\OS2") && @Exists("@RexxOS2Drive:\\OS2\\DLL"))
  606.                 @Return(0) // found drive
  607.         @Else
  608.                 @RexxOS2Cntr = (@RexxOS2Cntr + 1)
  609.                 @If(@RexxOS2Cntr > 90)
  610.                         @Return(1) // did not find drive
  611.                 @Else
  612.                         @GOTO LOOP
  613.                 @EndIf
  614.         @EndIf
  615.         @Return(1) // did not find drive
  616. @EndFunc // @GetOS2Drive
  617.  
  618.  
  619. /********************************************************************
  620. NAME
  621.                 @ModifyWPObject()
  622.  
  623. SYNOPSIS
  624.                 @Void @ModifyWPObject(@IN @QSTR @OBJECTID, @IN @QSTR @SETUPSTR)
  625.                 Function taking two @QSTRING parameters and returning @VOID.
  626.                 
  627. DESCRIPTION
  628.                 This function will write the REXX commands necessary to modify an
  629.                 existing Object (could also be folder).  It is recommended that the
  630.                 fourth parameter of @CreateWPFolder() and sixth parameter of
  631.                 @CreateWPIcon() not actually be used (pass a value of "") and if
  632.                 the skilled REXX programmer need to customize the object after it has
  633.                 been created, use this function instead of the above mentioned optional
  634.                 parameters.  As was described for the optional paramters in the two
  635.                 functions above, it is assumed that the user have an thorough knowledge
  636.                 of REXX syntax when refering to modification of objects.
  637.  
  638. PARAMETERS
  639.                 @IN @QSTR @OBJECTID
  640.                                 The OBJECT ID of the object to be modified.
  641.  
  642.                 @IN @QSTR @SETUPSTR
  643.                                 The optional setup string to be applied to the specified object.
  644.                                 Please note that exact REXX syntax must be used in this parameter
  645.                                 including all punctuation characters, delimeters, etc. (single
  646.                                 quotes, commas, semicolons, double quotes, etc.)
  647.  
  648. EXAMPLE
  649.                 // create the REXX script
  650.                 @CreateREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  651.  
  652.                 // add command to create FOLDER (group) on the desktop using
  653.                 // the folder name of "@Name @Version".  The folder ID for
  654.                 // creating Icons in that folder will be "KDC_FOLDER", and the
  655.                 // fourth parameter for optional parameters is not being used
  656.                 // however the "" is still placed to fill the fourth parameter
  657.                 // requirements.
  658.                 @CreateWPFolder("@Name @Version", "WP_DESKTOP", "KDC_FOLDER", "")
  659.  
  660.                 // add command to create OBJECT (icon)
  661.                 @IconName = "@OutDrive:\\@SubDir\\DBPROG.exe"
  662.                 @IconPath = "@OutDrive:\\@SubDir\\DBPROG.ico"
  663.                 @WRKDir = "@OutDrive:\\@SubDir"
  664.                 @CreateWPIcon("KDC_FOLDER", "DB APP", "@IconName", "@IconPath",
  665.                                         "@WrkDir", "")
  666.  
  667.                 // make the background of the Folder to be STARS.BMP
  668.                 @ModifyWPObject("KDC_FOLDER", "'BACKGROUND=D:\\OS2\\BITMAP\\STARS.BMP'")
  669.  
  670.                 // write the EXIT command to the REXX file
  671.                 @FinishREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  672.  
  673.                 // actually execute the REXX command script if possible
  674.                 @ExecuteREXXCMDFile("@OutDrive:\\@Subdir\\rxscript.cmd")
  675.  
  676. SEE ALSO
  677.                 @CreateWPFolder(), @CreateWPIcon(), @FinishREXXCMDFile(),
  678.                 @CreateREXXCMDFile(), @ExecuteREXXCMDFile()
  679. ********************************************************************/
  680. @DefineFunc @Void @ModifyWPObject(@IN @QSTR @OBJECTID, @IN @QSTR @SETUPSTR)
  681.  
  682.         @Write(,,"@RexxFslash@RexxAsteric Modify Object Atrributes of - @OBJECTID */\n")
  683.         @Write(,,"object = '<@OBJECTID>'\n")
  684.         @Write(,,"settings = @SETUPSTR\n")
  685.         @Write(,,"return = SysSetObjectData(object, settings)\n\n")
  686.         @Return()
  687. @EndFunc // @ModifyWPObject()
  688. /****************************************************************************
  689. *  This is the end of this script.  This script is intended to be included  *
  690. *  from another script, and after doing so, the above script functions may  *
  691. *  be called anywhere ordinary functions are valid.                         *
  692. ****************************************************************************/
  693.