Subject: REXXUTIL Information and Samples

The following attempts to better explain some of the powerful features
provided by OS/2 V2's dynamic link library; REXXUTIL.DLL (Rexx utility
functions). REXXUTIL functions are described in the online 'REXX Information'
reference and the 'OS/2 2.0 Technical Library Procedures Language/2 REXX
Reference' publication (order number S10G-6268). The information following is
intended to provide a more detailed description of some of the functions.

Plans for this information
--------------------------
Much of this file has changed since the first few attempts at compiling useful
REXXUTIL information. Plans are to place this information out on an IBM
Internal FORUM, (REXXOS2 FORUM) and the OS2REXX CFORUM which makes its way out
into the external customer world. Hopefully within a month or so of making it
available I've received any corrections/omissions from both IBMer's and
customers. Thereafter I plan to create an OS2EWS package that will contain
this text information with the sample CMD files as separate files. Also
I plan on including an INF formatted file of the information. I really do
want the information to be as accurate as possible before creating the INF
file so please report to me any items of omission or error.

Publications
------------
One should realize that many of the functions provided by REXXUTIL have
origins with Presentation Manager Winxxx calls. These publications are helpful
and be reviewed for more information:

S10G-6265 OS/2 PM Programming Reference Vol - 2
          Contains all the Winxxx calls, the Workplace Shell classes, and
          their _wpxxx messages. Also this is available as an online doc
          that comes with the OS/2 Toolkit.
S10G-6309 OS/2 System Object Model Reference
          Also an online doc that comes with the OS/2 Toolkit.
GBOF-2254 OS/2 Technical Redbooks (series of technical documents)
          GG24-3732 OS/2 V2 Volume 3: Presentation Manager & WPS
          GG24-3774 OS/2 V2 Volume 4: Application Development
ZB35-5100 The REXX Language: A Practical Approach to Programming,
          ISBN 0-13-780651-5

Some of the functions used/explained herein:

SysIni:
-------
Using REXXUTIL's SysIni function one can modify many settings of the WorkPlace
Shell as well as change other applications settings that make use of *.INI
files such as the system OS2.INI and OS2SYS.INI.

SysCreateObject: (PM WinCreateObject - Create Workplace Object)
----------------
Using REXXUTIL's SysCreateObject function one can create various objects;
like folders, programs, and shadow objects using Rexx. This section for the
most part includes parameter information which was gathered together from
various sources of information.

SysSetObjectData: (PM WinSetObjectData - Set Object Data)
-----------------
Using REXXUTIL's SysSetObjectData function one can change an objects
characteristics (of an already created object, if you know its objectid).

SysDestroyObject: (PM WinDestroyObject - Destroy Workplace Object)
-----------------
Using REXXUTIL's SysDestroyObject one can delete an object created if you
know its objectid.

Misc Notes:
If one views the *.RC files located in your bootdrive:\OS2 directory you
can learn a lot about the various INI settings and folder structure.
Review INI.RC and INISYS.RC files, they are used to create your OS2.INI
and OS2SYS.INI files. (Note in the *.RC files "?:" is used to indicate
the boot drive)

Some of REXXUTIL's functions are only available when using the very latest
REXX20 PACKAGE which consists of the very latest REXX fixes and enhancements
for GA OS/2 V2.0. Should you have problems running any of the sample programs
you should make sure your system has the vary latest REXX20 updates. In
addition to the REXX fixes, various OS/2 V2 base fixes may be needed as well.
You may need to install/apply the latest 2.0 Service Pack, or even OS/2 2.1 in
order for some of the operations to behave properly.

If anyone discovers other parameters or other "hidden" features of
any of the functions discussed, please share your discovery. I'll try to
update the information as I receive it.

Thanks...
Michael Lamb MIKELAMB(KGNVMC)         Michael Lamb
Workstation Technical Support         4 Cross Creek Rd
ISSC - MHV Solution Center            New Paltz, NY 12561-3805
30NC/370 Neighborhood Rd
Kingston NY 12401
(914)385-0666 t/l-695-0666

Change Log:
  04/30/92 - Added information about DuplicateFlag parm
           - Added more setup string information from manuals
  06/02/92 - Added information about breaking Title line character "^"
           - Added information about adding multiple DOS_DEVICE statements
           - Added code to SHADOW.CMD to make shadow object of a file
  !!NOTE!! - The REXXOS2 fixes are required to make some of
             the newer samples work properly.
  06/30/92 - Added information regarding two new REXXUTIL functions:
             SysSetObjectData and SysDestroyObject, also two new
             samples STARTDOS, BOOTDOS (Thanks to Rick McGuire)
  07/13/92 - Reorganized the way the material is presented. Also added more
             sample Rexx routines REBUILD, OBJCLASS and LPTADD, descriptions
             follow. Also changed parm CONCURRENTVIEW to CCVIEW (Thanks
             Dan Kehn, Felix Sawicki)
  07/15/92 - Updated entire document as I mistakenly truncated it at 80
             characters. Rewrote some sample Rexx routines so they do not
             extend beyond 80 characters. Also updated the SysSetObjectData
             description to show how can open an object (Thanks Rick). Added
             information about creating multi-line titles, carat works for
             two line titles but not more than 2.
             New samples, OBJECTID and FONTS included, descriptions follow.
  07/29/92 - Corrected an error I made when I broke the setup lines into
             multiple lines. I needed to add ]]'s to make sure they
             concatenated without spaces (Thanks Rick). Also added
             information regarding changing some System Settings (added
             new section after sample Rexx code). Also added warning
             in REBUILD.CMD sample about replacing Folder objects. Also
             added new sample ICONRES.CMD which builds a folder containing
             many of the OS/2 V2 installed icons using system DLL files.
  01/30/93   Added to some examples the use of SysDestroyObject to clean up
             after creating objects, also added the syntax for the call.
             Changed REBUILD.CMD sample to used 'U' for updateifexists as
             the duplicateflag to prevent problems. Added warning about
             the 'R' duplicateflag parameter to field description.
             Added information about changing Background tab, Change color
             button values. Changed OBJECTID.CMD to enclose results in
             double quotes to easier distinguish results.
             Changed descriptions of calls to better match what's found in the
             toolkit documentation for the Winxxx calls.
  04/11/93   Added some information in ASSOCTYPE, ASSOCFILTER section.
             Added new PROGTYPE values. Added ICONVIEWPOS information.
  07/04/93   Too many changes to note. Lots having to do with OS/2 V2.1

This append consists of multiple pieces of information:

1) Large block of text containing information that pertains to the subject.
   (TEXT INFORMATION)
2) Sample Rexx code, some complete programs, others code fragments:
 - (FOLDER.CMD)
   Creates a folder and program objects in the folder
 - (SHADOW.CMD)
   Creates shadows of objects
 - (FLDSHAD.CMD)
   Creates a folder, then program object in the folder, then place a shadow
   of the program object on the desktop.
 - (MKSHAD.CMD)
   Creates a shadow object of an objectid, file or drive/directory.
 - (STARTDOS.CMD)
   Starts a DOS program using specific DOS VDM settings.
 - (BOOTDOS.CMD)
   Starts a DOS session, booting from a specific DOS image with
   specific DOS VDM settings.
 - (REBUILD.CMD)
   Allows one to rebuild OS/2 system objects, kinda like MAKEINI does.
 - (LPTADD.CMD)
   Code using SysIni to add LPT4-9 ports.
 - (OBJECTID.CMD)
   Code using SysIni to list OBJECTIDs known to the WorkPlace Shell
 - (FONTS.CMD)
   Code using SysIni to list installed fonts and verify their existence.
 - ICONRES.CMD
   Code building a folder containing many of the various icons found in
   installed DLL files for OS/2 V2. Demonstrates use of setup string
   parameter ICONRESOURCE.
 - SWAPEDIT.CMD
   Code that allows you to make the Enhanced Editor (EPM) the default open
   action for most data objects instead of the OS/2 Enhanced Editor (E).
 - OPENWPS.CMD
   Code that allows you to open up an objectid or directory using views
   you specify.
3) Code Fragments
 - (SYSSET)
   Shows using SysIni to toggle various System Settings

((BEGIN TEXT INFORMATION))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-- Information regarding the SysCreateObject function of REXXUTIL --

Function: SysCreateObject
Syntax:
result=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)

 classname: The name of the class of which this object is a member.

 title:    The object title, as it is to appear when displayed on the user
           interface underneath an icon or on the title bar of an open object.
           (Note this can be changed later using the TITLE keyword)

 location: The object location. This can be specified as either an
           object ID (for example, <WP_DESKTOP>) or a file system path
           (for example, C:\bin\mytools).
           (Object ids will be explained later)

 setup:    A WinCreateObject setup string. Described more later on.

 duplicateflag: This parameter indicates what action should be taken
           when the Setup string specifies an object ID, and an object with
           that object ID already exists. If the setup string does not give
           an object ID, another object will be created.

 result    The return code from WinCreateObject. This returns 1 (TRUE) if the
           object was created and 0 (FALSE) if the object was not created.

 Purpose:  Create a new instance of an object class.

-- Information regarding the SysSetObjectData function of REXXUTIL --

Function: SysSetObjectData
Syntax:
result=SysSetObjectData(name, setup)

 name:     The object name. This can be specified as an object id (for
           example <WP_DESKTOP>) or as a fully qualified file name.

 setup:    A WinCreateObject setup string. Described more later on.

 result:   The return code from WinSetObjectData. This will return 1 (TRUE)
           if the object was updated and 0 (FALSE) if the object was not
           updated.

 Purpose:  Alter the settings of an existing object.

           Can be used to open an instance of an object:
           /* open up the system folder */
           call SysSetObjectData '<WP_OS2SYS>', 'OPEN=DEFAULT;'

           Can be used to change the title of an object:
           /* change Information folder name */
           call SysSetObjectData '<WP_INFO>', 'TITLE=InfoFolder'

See the description of the SysCreateObject location and setup strings
following for an explanation of the parameters.

-- Information regarding the SysDestroyObject function of REXXUTIL --

Function: SysDestroyObject
Syntax:
result=SysDestroyObject(name)

 name:     The object name. This should be specified as an object id, for
           example <WP_CMDREF>. It can also be a fully specified file name.

 result:   The return code from WinDestroyData. This will return 1 (TRUE)
           if the object was destroyed and 0 (FALSE) if the object was
           not destroyed.

 Purpose:  Delete an existing workplace object, or file.

See the description of the SysCreateObject location parameter
following for an explanation of the object name. See the OBJECTID.CMD sample
for a way to determine the objectid's the system knows about.

--Parameters Explained-------------------------------------------------------

Parameters to the functions are now explained in more detail.

classname:
  A registered object class defined to the system. Of particular interest are
  the WPFolder/WPProgram/WPShadow classes. Note using the sample Rexx code
  included in the SysQueryClassList function help screen one can list all
  of the registered classes:

  call SysQueryClassList "list."
  do i = 1 to list.0
     say 'Class' i 'is' list.i
  end

title:
  The objects title you want to use. If you wish to break the title line you
  use a comma "," as the line break character. However, there were problems
  with this and it may or may not work depending on whether you have the
  latest REXX and OS/2 V2 fixes installed. You may instead decide to use
  a hex 0A character (line-feed) in the string to separate lines.

  Rexx example:  Note: x2c is Rexx's hex to character function.

  title='First'x2c(A)'Second'x2c(A)'Third'

  Note if you wish to use the special characters; comma or semi-colon in the
  string, prefix the character with the carat symbol.

  Example title, you want:
  ] My Activities     ]   you would use...
  ] December 25, 1992 ]     title='My Activities,December 25^,1992'

location:
  The objects location can be specified as either an existing object id,
  for example <WP_DESKTOP>, or alternatively a fully qualified file name of
  any file or directory.

  An object id string must always start with the '<' character and be
  terminated by the '>' character and is thus an invalid file system name.

  By looking at your \OS2\INI.RC file you can see a use of many object ids
  such as <WP_DESKTOP>. If this is used as a location then your object will
  be placed on the WorkPlace Shell desktop.

  If you are creating an object you should make sure you use the OBJECTID
  setup string parameter and give that object a unique object id. We'll see
  how this works later.

  HINTS: Here are some predefined object ids of system folders. Also if you
         are thinking of placing an object in the Startup Folder <WP_START>,
         make it a shadow of an object.
         <WP_DESKTOP>   Desktop
         <WP_START>     Startup folder
         <WP_OS2SYS>    OS/2 System folder
         <WP_TEMPS>     Templates folder
         <WP_CONFIG>    System Setup folder
         <WP_INFO>      Information folder
         <WP_DRIVES>    Drives folder
         <WP_NOWHERE>   Hidden folder
         <WP_PROMPTS>   Command Prompts folder
         <WP_TOOLS>     Productivity folder
         <WP_GAMES>     Games folder
         ---Some other common OS/2 folder objectids---
         <MAH_FOLDER>   Mahjongg folder
         <MMPM2_FOLDER> Multimedia folder
         <MMPM2_SOUNDS> Multimedia Sound Bites folder
         <MMPM2_MOVIES> Multimedia Movies folder
         <TK_TOOLKIT>   Toolkit 2.1 folder
         <TK_DEVINFO>   Toolkit Information folder
         <TK_DEVTOOLS>  Development Tools folder
         <TK_CSAMPLE>   Sample Programs folder

setup:
  This field needs the most explaining. Each object class, WPProgram,
  WPFolder, etc, documents its setup string keynames and parameters.
  A larger section follows that details many of the available keynames and
  parameters. The setup string contains a series of "keyname=value" pairs,
  that change the behavior of the object. "keynames" are separated by
  semicolons, and "values" are separated by commas.

    "key=value;key2=value1,value2;"

  If you want a literal comma or semicolon inside one of your fields you
  must precede the comma/semi-colon with a carat as in the following:
      ^,   A literal comma
      ^;   A literal semicolon

  Note that ALL setup string parameters have safe defaults, so it is never
  necessary to pass unnecessary parameters to an object.

  (Note: The setup string was limited to a total length of 255 bytes in the
         2.0 GA code, this limitation is removed if the Service Pack is
         applied or you are using OS/2 2.1) (APAR PJ02271)

duplicateflag:
  There are three possible values for this parameter:
  FailIfExists - No object should be created if an object with the
      given object already exists. This is the default and maps to the
      PM creation flag, CO_FAILIFEXISTS
  UpdateIfExists - If an object with the given object ID already exists,
      the existing object will be updated with the new setting information.
      Maps to the creation flag, CO_UPDATEIFEXISTS. If the object does
      not exist, it is created.
  ReplaceIfExists - If an object with the given object ID already exists,
      the existing object should be replaced. Maps to the PM creation
      flag, CO_REPLACEIFEXISTS.
  WARNING: Be careful using the 'R' ReplaceIfExists value. Any attempt to
           rebuild an object first deletes any object that is using that
           same <objectid>. This can be useful if you want to restore an
           object back to its original installed state. This can also be
           bad since if you rebuild a folder it first deletes all objects
           in it since those objects are tied to the folder object.
  Note: Only the first character is required/examined, i.e. F, R, or U

--Setup Strings--------------------------------------------------------------

  Using WPFolder and WPProgram classes in your SysCreateObject call you can
  build folder and program objects. What follows are setup string parameters.
  Their various key names, values, and a short description follow
  each item. The <<xxx>> items are used to indicate what Workplace Shell
  settings "page" you would find this information on.

  An instance of each class is created initially by the system in its
  template form. It has the title "Folder" / "Program", respectively, and
  resides in the systems "Templates" folder.

*********************************
***WPFolder setup string parms***
*********************************
KEYNAME      VALUE           Description
-----------------------------------------------------------------------------
<<View>>
OPEN         ICON            Open icon view when object is created/updated.
             TREE            Open tree view when object is created/updated.
             DETAILS         Open details view when object is created/updated.
           Example:
             /* Open up the tree view of the system folder */
             call SysSetObjectData '<WP_OS2SYS>', 'OPEN=TREE;'
ICONVIEW     s1,s2,...sn   Set icon view to specified style(s).
TREEVIEW     s1,s2,...sn   Set tree view to specified style(s).
DETAILSVIEW  s1,s2,...sn   Set details view to specified style(s).
(styles)     FLOWED          flowed list items
             NONFLOWED       non-flowed list items
             NONGRID         non-gridded icon view
             NORMAL          normal size icons
             MINI            small icons
             INVISIBLE       no icons
             LINES           lines in tree view
             NOLINES         no lines in tree view
ICONFONT     value           Font size and facename. See Font Notes following.
TREEFONT     value           Font size and facename. See Font Notes following
DETAILSFONT  value           Font size and facename. See Font Notes following
(Font Notes)
The format for the value is normally;   size.facename fontstyle hex0
  example:   8.Courier Bold
  Remember the value should end with null zero.
  Example code to change the Information Folder icon view font:
    call SysSetObjectData '<WP_INFO>', 'ICONFONT=8.Courier Bold'x2c(0)

We say 'normally' because there are certain circumstances where you must
separate values using a period. Also if you use a font style of 'Normal'
you just leave off the font style (don't use the word 'Normal')
Following is a small table to help.

FaceName: Courier FontStyle: Normal
  'ICONFONT=8.Courier'x2c(0)
FaceName: Courier FontStyle: Bold Italic
  'TREEFONT=8.Courier Bold Italic'x2c(0)
10 FaceName: System Proportional FontStyle: Bold
  'DETAILSFONT=10.System Proportional.Bold'x2c(0)

HINT: To find out what the string should look like, create a folder, name it
      simple like MYFOLD, then manually change the font size/name using the
      Open/Settings/Change font button. Close the settings, then from an
      OS/2 command line first determine the name of your desktop, for a
      typical 2.0 FAT file system it would be something like C:\OS!2_2.0_D
      (It gets easier for 2.1 where the Desktop is normally named C:\DESKTOP)
      Then locate the folder you created C:\OS!2_2.0_D\MYFOLD
      Then enter:  EAUTIL C:\OS!2_2.0_D\MYFOLD MYFOLD.EAS /S /P
      This will create a MYFOLD.EAS file, use a browse program to view this
      file and you'll see the values required.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<Background>>
BACKGROUND   filename        Sets the folder background. filename is the
                             name of a file in the \OS2\BITMAP directory
                             of the boot drive.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<File>>
WORKAREA     YES             Make the folder a Workarea folder
             NO
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<Window>>
HIDEBUTTON   YES             Views of this object will have a hide button
                             as opposed to a minimize button.
             NO              Views of this object will have a minimize button
                             as opposed to a hide button.
MINWIN       HIDE            Views of this object will hide when their
                             minimize button is selected.
             VIEWER          Views of this object will minimize to the
                             minimized window viewer when their minimize
                             button is selected.
             DESKTOP         Views of this object will minimize to the
                             Desktop when their minimize button is selected.
CCVIEW       YES             New views of this object will be created every
                             time the user selects open.
             NO              Open views of this object will resurface when
                             the user selects open.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<General>>

** See General and Miscellaneous section following ***

-----------------------------------------------------------------------------

**********************************
***WPProgram setup string parms***
**********************************
KEYNAME      VALUE           Description
-----------------------------------------------------------------------------
<<Program>>
EXENAME      filename        Sets the name of the program
PARAMETERS   params          Sets the parameters list, which may
                             include substitution characters
                             ---Substitution characters---
                             Special substitution parameters are allowed:
                                   :(bracket blank bracket) You are prompted
                                      to type any parameters you want to use.
                             text  :Characters placed inside of the brackets
                                      are displayed as the prompt string.
                             no parm :If the program object is started by
                                      clicking on it no parameters are passed.
                                      If you start the program object by
                                      dragging a file over it, the full
                                      filename is passed.
                             %       :No parameters are passed. Useful for
                                      program objects you may want to start
                                      from a folders pop-up menu.
                             %*      :Like passing no parms, but useful if you
                                      need to insert the filename of a dragged
                                      object somewhere other than at the end
                                      of the parameter list.
                             %**P    :Insert drive and path information without
                                      the last backslash (\).
                             %**D    :Insert drive with ':' or UNC name.
                             %**N    :Insert file name without extension.
                             %**F    :Insert file name with extension.
                             %**E    :Insert extension without leading dot. In
                                      HPFS, the extension always comes after
                                      the last dot.
                             REMEMBER: If you specify a parameter in the field
                                       the name of any file being dragged onto
                                       this object is added to the end of the
                                       parameter list.
STARTUPDIR   pathname        Sets the working directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<Sessions>>
PROGTYPE     OS/2 session values:
             PM              Sets the session type to PM
             FULLSCREEN      Sets the session type to OS/2 full screen
             WINDOWABLEVIO   Sets the session type to OS/2 windowed
             DOS session values:
             VDM             Sets the session type to DOS full screen
             WINDOWEDVDM     Sets the session type to DOS windowed
             WIN-OS/2 session values:
             WIN             WIN-OS2 full screen
             WINDOWEDWIN     WIN-OS2 windowed, NOT a separate VDM session
             SEPARATEWIN     WIN-OS2 windowed, Separate VDM session
             -- Values for OS/2 2.1 systems --
             PROG_31_STD     WIN-OS2 full screen, Windows 3.1 Standard mode.
             PROG_31_STDSEAMLESSVDM
                             WIN-OS2 windowed, Separate VDM session,
                             3.1 Standard mode
             PROG_31_STDSEAMLESSCOMMON
                             WIN-OS2 windowed, NOT a separate VDM session,
                             3.1 Standard mode
             PROG_31_ENH     WIN-OS/2 full screen, NOT a separate VDM session,
                             3.1 Enhanced Compatibility
             PROG_31_ENHSEAMLESSVDM
                             WIN-OS2 windowed, Separate VDM session,
                             3.1 Enhanced Compatibility
             PROG_31_ENHSEAMLESSCOMMON
                             WIN-OS2 windowed, NOT a separate VDM session,
                             3.1 Enhanced Compatibility
MINIMIZED    YES             Start program minimized
MAXIMIZED    YES             Start program maximized
NOAUTOCLOSE  YES             Leaves the window open upon program termination.
             NO              Closes the window when the program terminates.
SET          XXX=VVV         XXX is any environment variable. VVV sets the
                             value of the environment variable. When used will
                             wipe out many variables you may have assumed were
                             set. Check environment space closely when using.
                             Also used to specify DOS settings for DOS and
                             Windows programs. --See next section--
----------------------------
- DOS and WIN-OS2 Settings -
----------------------------
IMPORTANT NOTES:
1) To change these values you use SET keyname=
  Example:   SET DOS_FILES=45;SET DOS_HIGH=1;
  Also for some use values of 1 for On, 0 for off
  Example:   SET COM_HOLD=1;     (on, default is off)
2) To add more than one line to a setting you can use the same technique used
  to have more than one title line. See the discussion previous regarding
  that technique. Here's an example using the DOS_DEVICE keyname:
  Rexx example:
  setup='...;SET DOS_DEVICE=C:\OS2\MDOS\ANSI.SYS'x2c(A)'C:\OS2\MDOS\EGA.SYS...'
3) Some settings may already have default values, like DOS_VERSION. You must
  be careful since any action against that setting is treated as a
  replacement (even if you are using the updateifexist duplicateflag value).
  So if you wanted to add one item to DOS_VERSION, you should also include all
  of the existing values.
4) Some settings are new once you've installed the OS/2 V2 Service Pack or
  upgraded to OS/2 V2.1. As well some may not be on your workstation due to
  your hardware configuration, for instance use of VIDEO_8514A_XGA_IOTRAP
  is only available on certain systems.
5) WIN-OS2 Settings are new to V2 users and appear once the Service Pack is
  installed or you have upgraded to OS/2 V2.1. Refer to the section
  "Global WIN-OS2 Settings" for more information.

List of DOS and WIN-OS2 Setting fields
-----------------------------------------------------------------------------
Keyname                   Values and notes about usage
                          (<>'s are used to signify default setting for some)
                          (Remember 1=on and 0=off for those that us on/off)
-----------------------------------------------------------------------------
WIN_RUNMODE               Use the PROGTYPE parameter mentioned previously
                          to define a enhanced mode WIN-OS2 program (Also
                          see note 5 from above)
WIN_DDE                   (See note 5 above)
WIN_CLIPBOARD             (See note 5 above)
AUDIO_ADAPTER_SHARING     On Off
COM_DIRECT_ACCESS         On <Off>
COM_HOLD                  On <Off>
COM_RECEIVE_BUFFER_FLUSH  Valid settings: <NONE>
                                           ALL
                                           RECEIVE DATA INTERRUPT ENABLE
                                           SWITCH TO FOREGROUND
COM_SELECT                Valid settings: <ALL> COM1 COM2 COM3 COM4 NONE
DOS_AUTOEXEC              C:\AUTOEXEC.BAT
                          Use full BATch filename also you can pass parameters
DOS_BACKGROUND_EXECUTION  <On> Off
DOS_BREAK                 On <Off>
DOS_DEVICE                Default: empty
                          Remember to separate any used with "," for newline
DOS_FCBS                  Limits: 0-255, default 16
DOS_FCBS_KEEP             Limits: 0-255, default 8
DOS_FILES                 Limits: 20-255, default 20
DOS_HIGH                  On <Off>
DOS_LASTDRIVE             Limits: last physical drive to Z, default Z
DOS_RMSIZE                Limits: 128-640, default 640, increments of 16
DOS_SHELL                 Default: "?:\OS2\MDOS\COMMAND.COM "
                                   "?:\OS2\MDOS\ /P" where ?
                                    is the boot drive
DOS_STARTUP_DRIVE         Default: empty
                          Accepts text; like A: or C:\DISKS\DRDOS.IMG
DOS_UMB                   On <Off>
DOS_VERSION               Default: DCJSS02.EXE,3,40,255
                                   DFIA0MOD.SYS,3,40,255
                                   DXMA0MOD.SYS,3,40,255
                                   IBMCACHE.COM,3,40,255
                                   IBMCACHE.SYS,3,40,255
                                   ISAM.EXE,3,40,255
                                   ISAM2.EXE,3,40,255
                                   ISQL.EXE,3,40,255
                                   NET3.COM,3,40,255
                                   EXCEL.EXE,10,10,4
                                   PSCPG.COM,3,40,255
                                   SAF.EXE,3,40,255
                                   WIN200.BIN,10,10,4
                          Remember what you put here will replace the existing
                          list of items so be careful, also remember to use
                          carats in front of any commas you need.
                          Example:
                          'SET DOS_VERSION=IBMCACHE.SYS^,3^,40^,255;']],...
DPMI_DOS_API              Valid settings: <AUTO>  ENABLED  DISABLED
DPMI_MEMORY_LIMIT         Limits: 0-512, default 4
DPMI_NETWORK_BUFF_SIZE    Limits: 1-64, default 8
EMS_FRAME_LOCATION        Valid settings: <AUTO> NONE C000 C400 C800 CC00
                                                      D000 D400 D800 DC00
                                                      8000 8400 8800 8C00 9000
EMS_HIGH_OS_MAP_REGION    Limits: 0-96, default 32, note increments of 16
EMS_LOW_OS_MAP_REGION     Limits: 0-576, default 384, note increments of 16
EMS_MEMORY_LIMIT          Limits: 0-32768, default 2048, note increments of 16
HW_NOSOUND                On <Off>
HW_ROM_TO_RAM             On <Off>
HW_TIMER                  On <Off>
IDLE_SECONDS              Limits: 0-60, default 0
IDLE_SENSITIVITY          Limits: 1-100, default 75
INT_DURING_IO             On <Off>
KBD_ALTHOME_BYPASS        On <Off>
KBD_BUFFER_EXTEND         <On> Off
KBD_CTRL_BYPASS           Valid settings: <NONE>  ALT_ESC  CTRL_ESC
KBD_RATE_LOCK             On <Off>
MEM_EXCLUDE_REGIONS       Initially empty, you can specify a range of memory
                          to exclude or you can supply a singe address for the
                          beginning of a 4KB region, if you need several
                          regions separate them with a comma (don't forget to
                          use the carat since commas are special setup string
                          parameters) Example:
                          'SET MEM_EXCLUDE_REGIONS=C0000^,D0000-D8000;']],
MEM_INCLUDE_REGIONS       Initially empty, you can specify a range of memory
                          to include or you can supply a singe address for the
                          beginning of a 4KB region, if you need several
                          regions separate them with a comma (don't forget to
                          use the carat since commas are special setup string
                          parameters) Example:
                          'SET MEM_INCLUDE_REGIONS=C0000^,D0000-D7FFF;']],
                          NOTE: The include region D0000-D80000 will include
                                the entire memory between D8000 and D8FFFF.
MOUSE_EXCLUSIVE_ACCESS    On <Off>
NETWARE_RESOURCES         Valid settings: NONE  PRIVATE  GLOBAL
                          Special note, you use the words to change the value
                          BUT the string MUST be 7 characters long!
                          Example:
                          'SET NETWARE_RESOURCES=GLOBAL ;'
PRINT_SEPARATE_OUTPUT     <On> Off
PRINT_TIMEOUT             Limits: 0-3600, default 15
TOUCH_EXCLUSIVE_ACCESS    On Off
VIDEO_8514A_XGA_IOTRAP    <On> Off
VIDEO_FASTPASTE           On <Off>
VIDEO_MODE_RESTRICTION    Valid settings: <NONE>  CGA  MONO
                          Special note, you use the words to change the value
                          BUT the string MUST be 15 characters long!
                          Example:
                          'SET VIDEO_MODE_RESTRICTION=CGA            ;'
VIDEO_ONDEMAND_MEMORY     <On> Off
VIDEO_RETRACE_EMULATION   <On> Off
VIDEO_ROM_EMULATION       <On> Off
VIDEO_SWITCH_NOTIFICATION On <Off>
VIDEO_WINDOW_REFRESH      Limits: 1-600, default 1
XMS_HANDLES               Limits: 0-128, default 32
XMS_MEMORY_LIMIT          Limits: 0-16384, default 2048, increment of 4
XMS_MINIMUM_HMA           Limits: 0-63, default 0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<Association>>
ASSOCFILTER  filters         Sets the filename filter for files
                             associated to this program.
                             Multiple filters are separated by commas.
                             See notes about preserving existing filter
                             values following.
ASSOCTYPE    type            Sets the type of files associated to this
                             program. Multiple filters are separated
                             by commas.
                             See notes about preserving existing associate
                             types following.
* Preserving existing values *
  When using ASSOCFILTER and/or ASSOCTYPE include two commas at the end of
  your string to preserve any settings that are already applied:
  Example: ... ASSOCTYPE=Metafile,PIF file,,;ASSOCFILTER=*.MET,*.PIF,,; ...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<Window>>
MINWIN       HIDE            Views of this object will hide when their
                             minimize button is selected.
             VIEWER          Views of this object will minimize to the
                             minimized window viewer when their minimize
                             button is selected.
             DESKTOP         Views of this object will minimize to the
                             Desktop when their minimize button is selected.
CCVIEW       YES             New views of this object will be created every
                             time the user selects open.
             NO              Open views of this object will resurface when
                             the user selects open.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<<General>>

** See General and Miscellaneous section following ***

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
**General and Miscellaneous**
  NOTE: Some keynames are valid for any objects. Here in this section many of
  them are described. These can be used for the WPFolder and WPProgram objects.
ICONFILE     filename        This sets the object's icon.
ICONRESOURCE id,module       This sets the object's icon. 'id' is the
                             identity of an icon resource in the 'module'
                             dynamic link library (DLL). For example:
                             ICONRESOURCE=73 PMWP;
                             This would indicate resource 73 in PMWP.DLL.
                             See a supplied sample command file for more info.
ICONPOS      x,y             This sets the object's initial icon position.
                             The x and y values represent the position in
                             the object's folder in percentage coordinates.
ICONVIEWPOS  w,x,y,z         This sets the object's initial size. The values
                             represent relative position in percentage
                             coordinates. For example: ICONPOS=25 25 50 50
                             Would create a folder whose bottom left corner is
                             25% from the left and 25% from the bottom and half
                             the screen width/height.
TEMPLATE     YES             Creates object as a template.
             NO              Resets objects template property.
TITLE        value           Can be used to assign a name/title to an object.
OBJECTID     <name>          This sets the object's identity. The object
                             id will stay with the object even if it is
                             moved or renamed. An object id is any unique
                             string preceded with a '<' and terminated
                             with a '>'. This may also be a real name
                             specified as a fully qualified path name.
                             IMPORTANT: For any object you create you should
                             use a unique objectid! Do this for two reasons:
                             1) If you use an objectid it signifies a unique
                                object that will not be recreated if you use
                                the "FailIfExists" flag in your Rexx call. Not
                                using an objectid would cause multiple objects
                                to be created if the same program was run
                                over and over.
                             2) Should you need to later delete it or change
                                your object, you can use this objectid in your
                                Rexx call to refer to it.
                             Also one should not use an objectid that starts
                             with "WP_" as many OS/2 objects use those,
                             consider those reserved characters.
HELPPANEL    id              This sets the object's default help panel.
HELPLIBRARY  filename        This sets the help library.
OPEN         SETTINGS        Open settings view of object when created/updated.
             DEFAULT         Open default view of object when created/updated.
                             Don't forget for folder objects you can use
                             OPEN with these values: ICON, TREE, DETAILS
NODELETE     YES             Will not allow you to delete the object.
             NO              Resets the object's no delete property.
NOCOPY       YES             Will not allow you to make a copy.
             NO              Resets the object's no copy property.
NOMOVE       YES             Will not allow you to move the object to another
                             folder, will create shadow on a move.
             NO              Resets the object's no move property.
NODRAG       YES             Will not allow you to drag the object.
             NO              Resets the object's no drag property.
NOLINK       YES             Will not allow you to create a shadow link.
             NO              Resets the object's no link property.
NOSHADOW     YES             Will not allow you to create a shadow link.
             NO              Resets the object's no shadow property.
NORENAME     YES             Will not allow you to rename the object.
             NO              Resets the object's no rename property.
NOPRINT      YES             Will not allow you to print it.
             NO              Resets the object's no print property.
NOTVISIBLE   YES             Will not display the object.
             NO              Resets the object's not visible property.
-----------------------------------------------------------------------------

****************************
***WPShadow setup string ***
****************************
A shadow object is a persistent link or reference to any other object. This
is achieved by storing away the location and identity of the object that it
is linked to and then rerouting all requests for help, context menus, and
open views on to the object that it is linked to. Delete, Copy, and Move are
the only action requests that are handled by the WPShadow object and are not
rerouted to the linked object.

When you place objects into your Startup folder you should be placing a
shadow object there. See the SHADOW sample code for an example of its usage.

These are the keyname-value pairs supported by the WPShadow class.

KEYNAME      VALUE           Description
-----------------------------------------------------------------------------
SHADOWID     <name> or       The value for this is an object's id (OBJECTID)
             filename        or a fully qualified pathname of a directory,
                             program file, or data file.
Note: When creating a shadow object always use the OBJECTID= string to give
      your object a unique id so that later you may refer to it, and
      potentially delete it with SysDestroyObject.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
((END TEXT INFORMATION))

((BEGIN REXX CMD SAMPLES))

- (FOLDER.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* FOLDER.CMD: Sample code using REXXUTIL function calls                */
/*                                                                      */
/* Builds a folder on the DeskTop and places some program objects in it.*/
/*                                                                      */
/* Demonstrates use of these REXXUTIL functions:                        */
/*   SysCreateObject   - create or update an object                     */
/*   SysDestroyObject  - delete an object                               */
/*   SysSetObjectData  - update an existing object                      */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.1                                                          */

/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax

call SysCls
Say '';Say 'Using REXXUTILs to Add a Folder and Program Objects...'

Say '';Say 'Press Y to add Test Folder to Desktop...';Say '';
parse upper value SysGetKey('NOECHO') with key
If key<>'Y' Then Signal Exiter

/* All of the routines pass parameters to a subroutine to perform the call */
classname='WPFolder'
title    ='Test Folder'
location ='<WP_DESKTOP>'
setup    ='OBJECTID=<TEST_FOLDER>;'
Call BldObj

Say '';
Say 'Press ENTER and we will open up that folder and watch as other objects'
Say 'are added into it.'
key=SysGetKey()
Call SysSetObjectData '<TEST_FOLDER>', 'OPEN=DEFAULT;'

Say 'Place a program object into the folder...';Say '';
classname='WPProgram'
title    ='SYSLEVEL-FULLSCR'
location ='<TEST_FOLDER>'
setup    ='OBJECTID=<TEST_SYSL>;']],
          'EXENAME=\OS2\SYSLEVEL.EXE;']],
          'PROGTYPE=FULLSCREEN;'
Call BldObj

classname='WPProgram'
title    ='CHKDSK-PM'
location ='<TEST_FOLDER>'
setup    ='OBJECTID=<TEST_PMCK>;']],
          'EXENAME=\OS2\PMCHKDSK.EXE;']],
          'MINIMIZED=YES;']],
          'PROGTYPE=PM;'
Call BldObj

classname='WPProgram'
title    ='SYSLEVEL-VIO'
location ='<TEST_FOLDER>'
setup    ='OBJECTID=<TEST_SYSLVIO>;']],
          'EXENAME=\OS2\SYSLEVEL.EXE;']],
          'PROGTYPE=WINDOWABLEVIO;'
Call BldObj

classname='WPProgram'
title    ='MEM-Fullscreen'
location ='<TEST_FOLDER>'
setup    ='OBJECTID=<TEST_MEMFUL>;']],
          'EXENAME=\OS2\MDOS\MEM.EXE;']],
          'PROGTYPE=VDM;']],
          'PARAMETERS=/?;']],
          'NOAUTOCLOSE=YES;'
Call BldObj

classname='WPProgram'
title    ='MEM-WindowVDM'
location ='<TEST_FOLDER>'
setup    ='OBJECTID=<TEST_MEMWIN>;']],
          'EXENAME=\OS2\MDOS\MEM.EXE;']],
          'PROGTYPE=WINDOWEDVDM;']],
          'PARAMETERS=/?;']],
          'NOAUTOCLOSE=YES;'
Call BldObj

Say ''
Say 'Okay, now lets change the title of the folder using SysSetObjectData.'
Say 'Press ENTER and watch the folder get renamed...'
key=SysGetKey()
Call SysSetObjectData '<TEST_FOLDER>',  'TITLE=System Stuff';

Say ''
Say 'All done, now we will remove the objects by using...'
Say '...the SysDestroyObject call against the folder objectid.'
Say 'Note: If you delete a folder all objects contained within are removed.'
Say 'Press ENTER to watch the objects disappear...'
key=SysGetKey()
Call SysDestroyObject '<TEST_FOLDER>'

Exiter:
Call SysDropFuncs
Exit

/* Build Object */
BldObj:
call charout ,'Building: 'title

/*The basic call is listed next.                                           */
/*rc=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)*/

/* Build object using UPDATEIFEXIST as duplicateflag */
result = SysCreateObject(classname, title, location, setup, 'U')

If result=1 Then call charout ,'...   Object created!'
Else             call charout ,'...   Not created! Return code='result

Say '';
Return

- (SHADOW.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* SHADOW.CMD: Sample code using REXXUTIL function calls                */
/*                                                                      */
/* Builds shadows in the DeskTop and Startup Folder                     */
/*                                                                      */
/* Demonstrates use of these REXXUTIL functions:                        */
/*   SysCreateObject   - create or update an object                     */
/*   SysDestroyObject  - delete an object                               */
/*   SysSetObjectData  - update an existing object                      */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.1                                                          */

/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax

Call SysCls
Say '';Say 'Demonstration using REXXUTILs to Add Shadow Objects...'

/* The titles and objectid's are found from the \OS2\INI.RC file */

Say '';Say 'First lets place some items on the Desktop...'
Call AddShad 'Enhanced Editor',,  /* Title */
             '<WP_DESKTOP>',,     /* Location for shadow object */
             '<WP_EPM>',,         /* Value of existing objectid or file */
             '<SHAD_WP_EPM>'      /* New unique value of this shadow object */

Call AddShad 'OS/2 Window',,      /* Title */
             '<WP_DESKTOP>',,     /* Location for shadow object */
             '<WP_OS2WIN>',,      /* Value of existing objectid or file */
             '<SHAD_WP_OS2WIN>'   /* New unique value of this shadow object */

Call AddShad 'OS/2 DeskTop',,     /* Title */
             '<WP_DESKTOP>',,     /* Location for shadow object */
             '<WP_DESKTOP>',,     /* Value of existing objectid or file */
             '<SHAD_WP_DESKTOP>'  /* New unique value of this shadow object */

Say '';Say 'You can even make shadow objects of files...'
Call AddShad 'CONFIG.SYS',,       /* Title */
             '<WP_DESKTOP>',,     /* Location for shadow object */
             'C:\CONFIG.SYS',,    /* Value of data file */
             '<SHAD_CONFIG_SYS>'  /* New unique value of this shadow object */

Say '';Say 'Now lets place an item in the Startup Folder...'
Say 'First would you like me to open the Startup Folder so you can see the'
Say 'object being created? Press Y to open the folder.'
parse upper value SysGetKey('NOECHO') with key
If key='Y' Then Call SysSetObjectData '<WP_START>', 'OPEN=DEFAULT;'

Call AddShad 'System Clock',,     /* Title */
             '<WP_START>',,       /* Location for shadow object */
             '<WP_CLOCK>',,       /* Value of existing objectid of file */
             '<SHAD_WP_CLOCK>'    /* New unique value of this shadow object */

Say '';Say 'All done, if you would like me to remove the objects press R'
parse upper value SysGetKey('NOECHO') with key
If key='R' Then Do
   Call SysDestroyObject '<SHAD_WP_EPM>'
   Call SysDestroyObject '<SHAD_WP_OS2WIN>'
   Call SysDestroyObject '<SHAD_WP_CLOCK>'
   Call SysDestroyObject '<SHAD_WP_DESKTOP>'
   Call SysDestroyObject '<SHAD_CONFIG_SYS>'
End

Say '';Say 'Demonstration over...'
Exiter:
Call SysDropFuncs
Exit

/* Routine to create a shadow object when passed arguments: */
/* Title, Location, ShadowId, and ObjectId                  */
AddShad:
Parse arg title,loc,shadowid,objectid
Say '';Say 'Press Y to add shadow object: 'title' to 'loc
parse upper value SysGetKey('NOECHO') with key
If key='Y' Then Do
   setup='SHADOWID='shadowid';OBJECTID='objectid';'

   /*The basic call is listed next.                                         */
   /*rc=SysCreateObject(classname,title,location <,setup>, <,duplicateflag>)*/

   /* Build object using FAIL as duplicateflag */
   result=SysCreateObject('WPShadow', title, loc, setup, 'F')

   If result=1 Then Say 'Object created'
   Else             Say 'Not created, return code='result
End
Return

- (FLDSHAD.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* FLDSHAD.CMD: Sample code using REXXUTIL function calls               */
/*                                                                      */
/* Builds a folder on the DeskTop places a program object in it then    */
/* places a shadow of the program object on the DeskTop.                */
/*                                                                      */
/* Demonstrates use of these REXXUTIL functions:                        */
/*   SysCreateObject   - create or update an object                     */
/*   SysDestroyObject  - delete an object                               */
/*   SysSetObjectData  - update an existing object                      */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.1                                                          */

/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax

/*The basic call is listed next.                                           */
/*rc=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)*/

call SysCls
Say '';Say 'Using REXXUTILs to Add Folder/Program/Shadow Objects...'

Say '';Say 'Press Y to add Test Folder to Desktop...';Say '';
parse upper value SysGetKey('NOECHO') with key
If key<>'Y' Then Signal Exiter

classname='WPFolder'
title    ='Test Folder'
location ='<WP_DESKTOP>'
setup    ='OBJECTID=<TEST2_FOLDER>'
Call BldObj

Say '';
Say 'Press ENTER and we will open up that folder and watch as an object'
Say 'is added into it.'
key=SysGetKey()
Call SysSetObjectData '<TEST2_FOLDER>', 'OPEN=DEFAULT;'

classname='WPProgram'
title    ='SYSLEVEL-VIO'
location ='<TEST2_FOLDER>'
setup    ='OBJECTID=<TEST2_SYSLVIO>;']],
          'EXENAME=\OS2\SYSLEVEL.EXE;']],
          'PROGTYPE=WINDOWABLEVIO;'
Call BldObj

Say '';
Say 'Press ENTER and we will place a shadow of the new object on the Desktop.'
key=SysGetKey()

classname='WPShadow'
title    ='SYSLEVEL-VIO'
location ='<WP_DESKTOP>'
setup    ='SHADOWID=<TEST2_SYSLVIO>;OBJECTID=<SHAD_TEST2_SYSLVIO>;'
Call BldObj

Say ''
Say 'All done, now we will remove the objects by using...'
Say '...the SysDestroyObject call.'
Say 'Note: If you delete a folder all objects contained within are removed.'
Say 'Press ENTER to watch the objects disappear...'
key=SysGetKey()
Call SysDestroyObject '<SHAD_TEST2_SYSLVIO>'
Call SysDestroyObject '<TEST2_FOLDER>'

Exiter:
Call SysDropFuncs
Exit

/* Build Object */
BldObj:
call charout ,'Building: 'title

/*The basic call is listed next.                                            */
/*rc=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>) */

/* Build object using UPDATEIFEXIST as duplicateflag */
result = SysCreateObject(classname, title, location, setup, 'U')

If result=1 Then call charout ,'...   Object created!'
Else             call charout ,'...   Not created! Return code='result

Say '';
Return

- (MKSHAD.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* MKSHAD.CMD: Sample code using REXXUTIL function calls                */
/*                                                                      */
/* Builds shadows when passed names of files, drive/directories, or     */
/* existing objectid of WorkPlace Shell objects.                        */
/*                                                                      */
/* Enter: MKSHAD ?   for more information                               */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.0                                                          */
/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax
Parse arg name loc how
If name='?' ] translate(name)='HELP' Then Signal Helper
yes=1;no=0;
name=strip(name,'B','"')
loc=strip(loc,'B','"')
how=strip(how,'B','"')
hname=name
/* Default is to prompt before creating shadow unless /N is passed */
If translate(how)='/N' Then Do,
   how=''; quiet=yes;
End
Else If translate(loc)='/N' Then Do
   loc=''; quiet=yes;
End
Else If translate(name)='/N' Then Do
   name=''; quiet=yes;
End
Else quiet=no;
/* If no parm is passed assume need current directory shadowed on desktop */
If name='' Then name=directory()
/* Passing an objectid to be shadowed */
Else If left(name,1)='<' & right(name,1)='>' Then Do
     /* Check to see if it exists, build a list of all existing objectids */
     App='PM_Workplace:Location'
     call SysIni 'USER', App, 'All:', 'ObjIDTab'
     Do t=1 to ObjIDTab.0
        If name=ObjIDTab.t Then leave
     End
     If name<>ObjIDTab.t Then Do
        Say 'ERROR! Objectid:' name' not found'
        Signal Exiter
     End
End
Else Do
   /* If this file exists then no need to check other possibilities */
   Fname=stream(name,'C','Q EXISTS')
   If fname<>'' Then name=fname /* fully qualified name is returned */
   Else Do /* Must be a drive/directory passed */
      If right(name,1)<>'\' Then name=name]]'\'
      name=filespec('drive',name)]]filespec('path',name)
      name=strip(name,'T','\')
      If right(name,1)=':' Then name=name]]'\'
      Call SysFileTree name, mystem, 'D'
      If mystem.0=0 Then Do
         Say 'Sorry, cannot tell what should be shadowed.'
         Say 'The value:' hname
         Say 'Is not a file nor drive/directory that exists.'
         Signal Exiter
      End
   End
End
/* Location processing */
If loc<>'' Then Do
   /* Check to see if location exists, build list of all existing objectids */
   App='PM_Workplace:Location'
   call SysIni 'USER', App, 'All:', 'ObjIDTab'
   Do t=1 to ObjIDTab.0
      If loc=ObjIDTab.t Then leave
   End
   If loc<>ObjIDTab.t Then Do
      Say 'WARNING! Location:' loc' not found'
      Say 'Will create shadow on DeskTop instead.'
      loc='<WP_DESKTOP>'
   End
End
Else loc='<WP_DESKTOP>'
/* If an objectid then strip < character, leave end in */
If left(name,1)='<' & right(name,1)='>' Then obj='<SHAD_'strip(name,'B','<')
Else obj='<SHAD_'name'>'
If quiet=no Then Do
   Say 'Create a shadow of      :' name
   Say 'Location to be created  :' loc
   Say 'Objectid for the object :' obj
   Say 'To create press C any other key ends the program'
   parse upper value SysGetKey('NOECHO') with key
   If key<>'C' Then Signal Exiter
End
setup='SHADOWID='name';OBJECTID='obj';'
result=SysCreateObject('WPShadow', ' ', loc, setup, 'U')
If quiet=no Then Do
   If result=1 Then Say 'Shadow object created'
   Else             Say 'Not created, return code='result
End
/* Common exit point */
Exiter:
Call SysDropFuncs
Exit
/* Help Routine */
Helper:
Say '** MKSHAD ** Make a shadow object'
Say 'Syntax: MKSHAD name location /n'
Say 'If no parameters are passed it is assumed you want the current drive'
Say 'and directory shadowed to the DeskTop.'
Say 'Otherwise you can specify the name of an existing objectid, and existing'
Say 'file, or drive/directory to be shadowed. Followed by the location of'
Say 'where the shadow should be placed. If no location is specified then the'
Say 'DeskTop is assumed. The location should be an existing objectid of a'
Say 'folder and should be enclosed in double quotes, i.e. "<WP_STARTUP>"'
Say 'Look at your \OS2\INI.RC for many existing objectids for system objects.'
Say 'If you use /N then you are not prompted for confirmation, the object'
Say 'will immediately be created.'
Say '---Examples---'
Say ' MKSHAD C:\OS2'
Say ' - Shadow of C:\OS2 directory placed on the DeskTop.'
Say ' MKSHAD "<WP_OS2WIN>" "<WP_STARTUP>"'
Say ' - Shadow of OS/2 Window object placed into Startup folder.'
Say ' MKSHAD C:\CONFIG.SYS /n'
Say ' - Shadow of CONFIG.SYS placed on the DeskTop, no prompts.'
Say ' MKSHAD C:\OS2\MDOS\WINOS2\README.ATM "<WP_INFO>"'
Say ' - Shadow of README.ATM placed in the Information folder.'
Signal Exiter

- (STARTDOS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* STARTDOS.CMD: Sample code using REXXUTIL's SysCreateObject function  */
/* Starts a DOS program using specific DOS VDM settings.  This is       */
/* particularly useful for LAN execution that requires NET USE commands.*/
/* The example invokes the PKZIP.EXE program using files setting of 45  */
/* Rick McGuire:  MCGUIRE/GDLVM7                                        */
/* Load REXXUTIL */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs

/* The basic call is listed next.                                          */
/* result = SysCreateObject(classname, title, location, setup)             */

classname='WPProgram'
title='My DOS Program'
location='<WP_NOWHERE>'                  /* place in invisible folder      */
program='EXENAME=C:\PKZIP.EXE;'          /* DOS program name               */
type='PROGTYPE=WINDOWEDVDM;'             /* type of DOS session (windowed) */
startup='STARTUPDIR=C:\;'                /* startup directory              */
settings='SET DOS_FILES=45;'             /* required DOS settings          */
open='OPEN=DEFAULT;'                     /* open now                       */

call SysCreateObject classname, title, location,,
    program]]type]]startup]]settings]]open, 'REPLACE'
Return

- (BOOTDOS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* BOOTDOS.CMD: Sample code using REXXUTIL's SysCreateObject function   */
/* Starts a DOS session, booting from a specific DOS image with         */
/* specific DOS VDM settings.                                           */
/* Rick McGuire:  MCGUIRE/GDLVM7                                        */
/* Load REXXUTIL */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs

/* The basic call is listed next.                                          */
/* result = SysCreateObject(classname, title, location, setup)             */

classname='WPProgram'
title='Booted DR DOS'
location='<WP_NOWHERE>'                  /* place in invisible folder      */
program='EXENAME=*;'                     /* DOS program name (use shell)   */
type='PROGTYPE=WINDOWEDVDM;'             /* type of DOS session (windowed) */
image='C:\DRDOS.VM;'                     /* DOS image file                 */
                                         /* required DOS settings          */
settings='SET DOS_BACKGROUND_EXECUTION=ON;'
open='OPEN=DEFAULT;'                     /* open now                       */

call SysCreateObject classname, title, location,,
    program]]type]]image]]settings]]open, 'REPLACE'
Return

- (REBUILD.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* REBUILD.CMD: Sample code using REXXUTIL's SysCreateObject function   */
/* Can be used to rebuild objects created during the installation of    */
/* your OS/2 system. The \OS2\INSTALL\INI.RC file contains information  */
/* that can be used by the SysCreateObject function.                    */
/* The INI.RC file is used by MAKEINI.EXE to create your OS2.INI file   */
/*                                                                      */
/* Syntax:  Enter  "REBUILD ?" for complete syntax                      */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.1                                                          */

'@ECHO OFF'
/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax

Arg parms
cmdparms=parms /* Save command line parms for later processing */

/* Until REXXUTIL offers a function call to retrieve the OS2 boot drive   */
/* we assume the environment variable COMSPEC has location of boot drive. */
BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))

parse upper var cmdparms type '(' inifile .
/* If user does not enter location of *.RC file then try to find it */
If inifile='' Then inifile=BtDrv]]'\OS2\INI.RC'
rcx=stream(inifile,'C','Q EXISTS')
If rcx='' Then Do
   Say '';Say '';Say inifile 'not found'
   Signal Exiter
End
type=left(type,1)
If verify(type,'FPOA') Then Signal Helper

/* Initialize tables and table counters */
iniftab.=''; iniptab.='' iniotab.=''; /*Folders, Programs, Others */
iniflns=0;   iniplns=0;  iniolns=0;
initab.='';  inilns=0;
Call stream inifile,'C','CLOSE'
Do while lines(inifile)>0  /* Read RC file into tables */
   lne=linein(inifile)
   parse var lne '"PM_InstallObject"' lne
   If lne\='' Then Do
      parse var lne '"'rest1'" 'lne
      parse var lne '"'setup'"'
      parse var rest1 title';'object';'location';'
      If object='WPFolder' Then Do
         iniflns=iniflns+1
         iniftab.1.iniflns=object;   iniftab.2.iniflns=title;
         iniftab.3.iniflns=location; iniftab.4.iniflns=setup;
      End
      Else If object='WPProgram' Then Do
         iniplns=iniplns+1
         iniptab.1.iniplns=object;   iniptab.2.iniplns=title;
         iniptab.3.iniplns=location; iniptab.4.iniplns=setup;
      End
      Else Do
         iniolns=iniolns+1
         iniotab.1.iniolns=object;   iniotab.2.iniolns=title;
         iniotab.3.iniolns=location; iniotab.4.iniolns=setup;
      End
   End
End
Call stream inifile,'C','CLOSE'

/* Calculation for screen loop */
parse value SysTextScreenSize() with row col
scrsz=row-12

If type='F' ] type='A' Then Do; /* Folder routine */
   objt='Folder'; inilns=iniflns;
   Do i=1 to inilns; Do j=1 to 4;
      initab.j.i=iniftab.j.i
   End; End;
   Call DispSel
End;
If type='P' ] type='A' Then Do; /* Program routine */
   objt='Program'; inilns=iniplns;
   Do i=1 to inilns; Do j=1 to 4;
      initab.j.i=iniptab.j.i
   End; End;
   Call DispSel
End;
If type='O' ] type='A' Then Do; /* Other routine */
   objt='Other'; inilns=iniolns;
   Do i=1 to inilns; Do j=1 to 4;
      initab.j.i=iniotab.j.i
   End; End;
   Call DispSel
End;

Exiter: /* When get here done with processing */
Call SysDropFuncs
Exit

/* Routine to display objects and allow selection */
DispSel:
key=''
Do while key\='Q'
   Call SysCls; Say '';Say objt' objects found in: 'inifile;Say '';
   Do i=1 to inilns
      If trunc(i/scrsz)==i/scrsz Then Call Promptx 1
      If key='Q' Then leave
      n=right('  ']]i,3)]]') ']]left(initab.2.i]]copies(' ',30),30)
      n=n]]left(initab.3.i]]copies(' ',20),20)
      Say n
   End
   If key\='Q' Then Call Promptx 0
End
Return

/* Screen loop routine also calls object build routine */
Promptx: Arg scr
Say '';Say 'To attempt to rebuild an object enter the number of the object'
If scr=0 Then Say 'or enter Q to quit...'
Else Say 'or press enter to show next screen...  Or enter Q to Quit...'
pull key .
If (key>=1) & (key <=inilns) then Do
    rcx=BldIt(initab.1.key,initab.2.key,initab.3.key,initab.4.key)

    /* Ask if want objects in folder rebuilt */
    If object='WPFolder' Then Do
       Say '';Say 'Press Y to recreate the program objects in this folder.'
       parse upper value SysGetKey('NOECHO') with ansr
       If ansr='Y' Then Do
          parse var setup 'OBJECTID='obj';'
          Do ii=1 to iniplns;
             If iniptab.3.ii=obj Then Do
                rcx=BldIt(iniptab.1.ii,iniptab.2.ii,iniptab.3.ii,iniptab.4.ii)
             End
          End;
       End;
    End;

End;
If scr=1 Then Do;
   Call SysCls;Say '';Say objt' objects found in: 'inifile;Say '';
End;
Return

/* Routine to build object */
BldIt: Parse Arg object,title,location,setup
Say 'Command generated:'
Say 'SysCreateObject('object', 'title', 'location', 'setup', U)'
/* Build object using UPDATE as duplicateflag */
result = SysCreateObject(object, title, location, setup, 'U')
If result=1 Then Say '...   Object created!'
Else             Say '...   Not created! Return code='result
Say '';Say 'Press any key to continue...'
SysGetKey('NOECHO')
Return result

/* Syntax help */
Helper:
call SysCls
Say '';Say ''; Say 'REBUILD:'
Say 'Routine to rebuild system installed objects listed in *.RC files.'
Say 'Can be used as an alternative to using the MAKEINI command.'
Say 'Your INI.RC file is used by MAKEINI.EXE during installation to'
Say 'create your OS2.INI file.'
Say ''; Say 'Syntax:';Say '';
Say 'REBUILD object (filespec'
Say '';Say 'Valid objects A(ll), F(olders), P(rograms), O(ther)'
Say 'Can also can use (filespec for name of *.RC file, default is \OS2\INI.RC'
Signal Exiter

- (LPTADD.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* LPTADD.CMD: Sample code using REXXUTIL's SysIni function.            */
/* Routine will expand the number of LPT ports the WorkPlace Shell      */
/* recognizes from LPT1-3 to LPT1-9. Also a routine to add LPT3-9 to    */
/* the WIN-OS2 WIN.INI file.                                            */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.0                                                          */
'@ECHO OFF'
/* Load REXXUTIL */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs

/* The basic call for setting a single key value is listed next.        */
/* result = SysIni(inifile, app, key, val)                            */

call SysCls; Say '';
Say 'Using REXXUTILs SysIni call to add LPT4-9 to the WorkPlace Shell'
Say '';Say 'Press Y to add/initialize LPT4-9 ports...';Say '';
parse upper value SysGetKey('NOECHO') with key
If key='Y' Then Do
   Say 'LPT Ports: setting up for LPT4-9 ports...'
   Do n=4 to 9
      Say ' Setting up PM_LPT'n'...'
      rx=SysIni('SYSTEM', 'PM_SPOOLER_PORT', 'LPT'n, ';']]'00'x)
      If rx\='' Then Say 'LPT'n' Bad result='result
      rx=SysIni('SYSTEM', 'PM_LPT'n,         'DESCRIPTION', 'LPT']]n]]'00'x)
      If rx\='' Then Say 'LPT'n' Bad result='result
      rx=SysIni('SYSTEM', 'PM_LPT'n,         'INITIALIZATION', ';']]'00'x)
      If rx\='' Then Say 'LPT'n' Bad result='result
      rx=SysIni('SYSTEM', 'PM_LPT'n,         'PORTDRIVER', 'PARALLEL;']]'00'x)
      If rx\='' Then Say 'LPT'n' Bad result='result
      rx=SysIni('SYSTEM', 'PM_LPT'n,         'TERMINATION', ';']]'00'x)
      If rx\='' Then Say 'LPT'n' Bad result='result
      rx=SysIni('SYSTEM', 'PM_LPT'n,         'TIMEOUT', '45;']]'00'x)
      If rx\='' Then Say 'LPT'n' Bad result='result
   End
   Say 'LPT4-9 added... Press any key to continue...'
   SysGetKey('NOECHO')
End

call SysCls; Say '';
Say 'Can now attempt to add LPT3-9 to your WIN-OS2 WIN.INI file.'
Say '';Say 'Press Y to attempt to add LPT3-9 ports to WIN-OS2...';Say '';
parse upper value SysGetKey('NOECHO') with key
If key='Y' Then Do
  /* Change \OS2\MDOS\WINOS2\WIN.INI to add more ports LPT3-LPT9 */
  win.='';winnew.='';
  /* Until REXXUTIL offers a function call to retrieve the OS2 boot drive  */
  /* we assume the environment variable COMSPEC has location of boot drive. */
  BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))
  fn=BtDrv'\OS2\MDOS\WINOS2\WIN.INI';
  fnx=stream(fn,'C','QUERY EXISTS')
  fn=fnx;
  If fn\='' Then Do /* If file exists then process adding extra ports */
     Call stream fn,'C','CLOSE'
     Do i=1 to 10000 while LINES(fn)>0
        parse value linein(fn) with win.i
     End
     Call stream fn,'C','CLOSE'
     i=i-1; k=0;
     Do j=1 to i /* Look for FILE:= then if line before = LPT2.OS2= add 3-9 */
        If win.j='FILE:=' Then Do
           m=j-1; winchg=no;
           If win.m='LPT2.OS2=' Then Do
              Say 'LPT Ports: setting up for Windows LPT3-9 ports...'
              winchg=yes;
              Do n=3 to 9
                 Say ' Setting up: LPT'n'.OS2='
                 k=k+1; winnew.k='LPT'n'.OS2='
              End;
           End;
        End;
        k=k+1;
        winnew.k=win.j;
     End;
     If winchg=yes Then Do;
        parse var fnx fnx'.' .
        ifn=fnx]]'.???';
        ifn=SysTempFileName(ifn)
        '@COPY' fn ifn '1>NUL 2>NUL' /* Copy original to backup name */
        Say 'Copy of' fn 'saved as' ifn
        Say 'Writing' fn 'with added lines.'
        call lineout fn,,1 /* Start writing at first character */
        Do i=1 to k /* write file back out */
           call lineout fn,winnew.i
        End
        Call stream fn,'C','CLOSE'
     End;
     Else Say 'Lines not added, either already done or not what we expect.'
  End;
  Else Say 'Could not locate' fn 'program ending...'
End;
Say 'LPTADD ending...'
Call SysDropFuncs
Exit

- (OBJECTID.CMD) - - --  - - - - - - - - - - - - - - - - - - - - - - - - - -

/* OBJECTID.CMD: Sample code using REXXUTIL's SysIni function.          */
/* Routine will display the OBJECTIDs known to the WorkPlace Shell      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.1                                                          */
'@ECHO OFF'
/* Load REXXUTIL */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs

/* List ObjectIds */
App='PM_Workplace:Location'
call SysIni 'USER', App, 'All:', 'Keys'
if Result \= 'ERROR:' then do
   Call SysCls
   Say '';Say '';
   Say 'Listing ObjectId information (value enclosed in quotes)'; Say '';
   parse value SysTextScreenSize() with row col
   j=row-10
   Do i=1 to Keys.0
      If trunc(i/j)==i/j Then Do
         Say '';Say 'Press any key to show next screen...'
         key=SysGetKey()
         Call SysCls
         Say '';Say '';
         Say 'Listing ObjectId information (value enclosed in quotes)'; Say '';
      End
      Say '"'Keys.i'"'
   End
End
Else Say 'Error querying for' App
Call SysDropFuncs
Exit

- (FONTS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* FONTS.CMD: Sample code using REXXUTIL's SysIni function.             */
/* Routine will display the FONTS known to the WorkPlace Shell,         */
/* verifies that the font file exists and also if passed REBUILD as a   */
/* parameter will rebuild the INI entries based upon INI.RC values.     */

/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.1                                                          */

'@ECHO OFF'
/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax
Parse upper arg parm

App='PM_Fonts'
/* Until REXXUTIL offers a function call to retrieve the OS2 boot drive   */
/* we assume the environment variable COMSPEC has location of boot drive. */
BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))
If Parm<>'REBUILD' Then Do
   call SysIni 'USER', App, 'All:', 'Keys'
   If Result \= 'ERROR:' then do
      Do j=1 to Keys.0
         fname=space(SysIni('USER', App, Keys.j))
         msg=''
         If stream(BtDrv]]fname,'C','Q EXISTS')='' Then,
            msg='**Font file not found***';
         Keys.j=Keys.j 'Installed as:' fname ]] msg
      End
      Call SysCls
      Say '';Say '';Say 'Listing Installed Fonts';Say '';
      parse value SysTextScreenSize() with row col
      j=row-10
      Do i=1 to Keys.0
         If trunc(i/j)==i/j Then Do
            Say '';Say 'Press any key to show next screen...'
            key=SysGetKey()
            Call SysCls
            Say '';Say '';Say 'Listing Installed Fonts';Say '';
         End
         Say left(Keys.i,75)
      End
   End
   Else Say 'Error querying for' App
End
Else Do /* Requesting to rebuild fonts as listed in INI.RC */
   inifile=BtDrv]]'\OS2\INI.RC'
   rcx=stream(inifile,'C','Q EXISTS')
   If rcx='' Then Do
      Say '';Say '';
      Say inifile 'not found, cannot rebuild PM_Fonts INI entries'
      Signal Exiter
   End
   Do while lines(inifile)>0
      lne=linein(inifile)
      parse var lne '"PM_Fonts"' lne
      If lne\='' Then Do
         parse var lne '"'key'" 'lne
         parse var lne '"'val'"'
         msg=''
         Call charout ,'Building' left(key,13) left(val,25)
         If stream(BtDrv]]val,'C','Q EXISTS')='' Then,
            Say ' ** Font file 'BtDrv]]val' not found.'
         Else Do
            Call SysIni 'USER', App, key, val
            If result='' Then Say ' ...Okay...'
            Else Say ' ...'result
         End
      End
   End
   Call stream inifile,'C','CLOSE'
End
Say ''
Say 'FONTS completed, will display the FONTS known to the WorkPlace Shell,'
Say 'and verify that the font file exists. Also if passed REBUILD as a'
Say 'parameter will rebuild the INI entries based upon INI.RC values.'
Exiter:
Call SysDropFuncs
Exit

- (ICONRES.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* ICONRES.CMD: Sample code using REXXUTIL's SysCreateObject function   */
/* Routine will create a folder containing many icons available in      */
/* installed DLLs on an OS/2 V2 system. Shows how to use the setup      */
/* string parm: ICONRESOURCE                                            */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.0                                                          */
'@ECHO OFF'
/* Load REXXUTIL */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs

call SysCls
Say '';
Say 'Using REXXUTILs to demonstrate use of the ICONRESOURCE parameter.'
Say 'A folder will be created and populated with various icons found'
Say 'in some installed DLL files.'
Say '';
Say 'ICONRESOURCE is a SysCreateObject setup string parameter, has syntax:'
Say '';
Say '  ICONRESOURCE=id module       Ex:  ICONRESOURCE=3 PMWP;'
Say '  id=number of the icon resource, module=filename of the DLL'
Say ''; Say 'NOTE: Over 70 icons, program will run for a minute or two.'
Say '      After program ends the WPS will continue to resolve objects, also'
Say '      the building of the objects adds approx 100K to your OS2.INI.'
Say '';Say 'Press Y to add the folder to Desktop and populate...';Say '';
parse upper value SysGetKey('NOECHO') with key
If key<>'Y' Then Signal Exiter

/* Build folder for icons */
call charout ,'Building: ICONRESOURCE Icon Folder'
result = SysCreateObject('WPFolder', 'ICONRESOURCE'x2c(A)'Icon Folder',,
        '<WP_DESKTOP>', 'OBJECTID=<ICN_FOLDER>;', 'U')
If result=1 Then call charout ,'...   Object created!'
Else             call charout ,'...   Not created! Return code='result
Say '';
classname='WPAbstract'
location='<ICN_FOLDER>'
/* WPCONFIG 1-13 WPPRTMRI 3-16 19-23 */
fn='PMWP'
Do i=1 to 75
   If i<5 ] i=13 ] (i>15 & i<21) ] i=22 ] (i>23 & i<30) ] i=32 ] i=33,
    ] i=44 ] i=46 ] i=48 ] i=52 ] i=53 ] (i>55 & i<73) Then Call BldObj
End
fn='WPCONFIG'
Do i=1 to 13
   Call BldObj
End
fn='WPPRTMRI'
Do i=3 to 23
   If (i<17 ] i>18) Then Call BldObj
End
Say '';Say 'All done, to remove drag folder to shredder...'
Exiter:
Call SysDropFuncs
Exit

/* Build Object */
BldObj:
if i<10 then j='0']]i
else j=i
title=fn'-']]j
setup='ICONRESOURCE=']]j]]' 'fn';OBJECTID=<ICN-'fn'-']]j]]'>'
call charout ,'Building: 'title
result = SysCreateObject(classname, title, location, setup, 'U')
If result=1 Then call charout ,'...   Object created!'
Else             call charout ,'...   Not created! Return code='result
Say '';
Return

- (SWAPEDIT.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* SWAPEDIT.CMD: Sample code using REXXUTIL function calls              */
/*                                                                      */
/* Swaps the OS/2 System Editor (E) with the Enhanced Editor (EPM).     */
/*                                                                      */
/* Enter: SWAPEDIT  for more information                                */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.0                                                          */
/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax
Parse arg parm
/* Default is to prompt before swapping unless /N is passed */
If translate(parm)<>'/N' Then Call Logo
/* First apply the same associations to EPM as the System Editor */
setup    ='ASSOCTYPE=Plain Text,OS/2 Command File,DOS Command File,,;']],
          'ASSOCFILTER=*.DOC,*.TXT,,;'
result=SysSetObjectData('<WP_EPM>',setup)
If result=1 Then Say 'EPM object updated...'
Else             Say 'EPM object NOT updated! Return code='result

/* Now Replace the System Editor object (gets deleted then recreated) */
title    ='OS/2 System Editor'
setup    ='OBJECTID=<WP_SYSED>;']],
          'EXENAME=E.EXE;']],
          'ASSOCTYPE=Plain Text,OS/2 Command File,DOS Command File,,;']],
          'ASSOCFILTER=*.DOC,*.TXT,,;']],
          'HELPPANEL=9289;']],
          'PROGTYPE=PM;'
result=SysCreateObject('WPProgram', title, '<WP_TOOLS>', setup, 'R')
If result=1 Then Say 'System Editor object recreated...'
Else             Say 'System Editor object NOT created! Return code='result
/* Common exit point */
Exiter:
Call SysDropFuncs
Exit
/* Introductory message and confirmation */
Logo:
Call SysCls; Say; Say;
Say 'SWAPEDIT: Swap OS/2 System Editor (E) with the Enhanced Editor (EPM)'
Say ''
Say 'Some users of OS/2 would rather use the EPM editor for default actions'
Say 'against data file objects. One way to do this is to place the same'
Say 'associations on EPM as are on E, then delete and recreate the E program'
Say 'object. Use: SWAPEDIT /N  to perform the operation with no confirmation.'
Say ''
Say 'This program will place the same initial associations the OS/2 System'
Say 'Editor had on the Enhanced Editor. Then recreate the OS/2 System Editor'
Say 'program object. Afterwards for data file objects you will see the'
Say 'Enhanced Editor as the default choice and optionally you can use the'
Say 'OS/2 System Editor if you select the Open setting.'
Say ''
Say 'WARNING: Some files are over 255 characters in length and the EPM'
Say '         editor does not support this, so when editing files such as'
Say '         your CONFIG.SYS you should probably use the OS/2 System Editor.'
Say ''
Say 'Press C to continue or any other key to end the program'
parse upper value SysGetKey('NOECHO') with key
If key<>'C' Then Signal Exiter
Return

- (OPENWPS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/* OPENWPS.CMD: Sample code using REXXUTIL function calls               */
/*                                                                      */
/* REXX Command file that allows you to open various views of objects.  */
/*                                                                      */
/* Enter: OPENWPS ?   for more information                              */
/*                                                                      */
/* Mike Lamb: MIKELAMB/KGNVMC / 30NC/370 Neighborhood Rd                */
/* ISSC MHV - Solution Center / Kingston NY 12401                       */
/* Version 1.0                                                          */

/* Load REXXUTIL */
Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Signal on Syntax Name LoadCheck
Call SysLoadFuncs
LoadCheck: /* rc of 43 means REXXUTILs not found */
If rc=43 Then Do
   Say ''
   Say 'ERROR: Not able to load REXXUTILs. Perhaps REXX not installed or'
   Say '       REXXUTIL.DLL not found in a LIBPATH drive/directory.'
   Exit
End
Signal off Syntax
Parse Arg parm
If parm='?' ] translate(parm)='HELP' Then Signal Helper

quiet=0;       /* Set default message display */
type='DEFAULT' /* Set default open type */
objid=''       /* Set default object to open */
Do i=1 to words(parm)
  prm=word(parm,i)
  uparm=translate(prm)
  Select /* See if value is an open type */
    when uparm='SETTINGS' Then type='SETTINGS'
    when uparm='DEFAULT'  Then type='DEFAULT'
    when uparm='DETAILS'  Then type='DETAILS'
    when uparm='TREE'     Then type='TREE'
    when uparm='ICON'     Then type='ICON'
    when uparm='/N'       Then quiet=1
    otherwise Nop
  End
  If objid='' Then Do
     /* See if this value is an objectid */
     prm2=strip(prm,'B','"')
     If left(prm2,1)='<' & right(prm2,1)='>' Then Do
        /* Check to see if it exists, build list of all existing objectids */
        App='PM_Workplace:Location'
        call SysIni 'USER', App, 'All:', 'ObjIDTab'
        Do t=1 to ObjIDTab.0
           If prm2=ObjIDTab.t Then leave
        End
        If prm2<>ObjIDTab.t Then Do
           prm3=translate(prm2) /* Maybe need to uppercase value */
           Do t=1 to ObjIDTab.0
              If prm3=ObjIDTab.t Then leave
           End
           If prm3<>ObjIDTab.t Then Do
              Say 'ERROR! Objectid:' prm2' not found'
              Signal Exiter
           End
           Else objid=prm3
        End
        Else objid=prm2
     End
     Else Do
       If right(prm,1)=':' Then Call SysFileTree prm'\', mystem, 'D'
       Else Call SysFileTree prm, mystem, 'D'
       If mystem.0<>0 Then objid=prm
     End
  End
End
/* If no objectid nor valid directory passed open default directory */
If objid='' Then objid=Directory()
If quiet=0 Then Say 'Opening 'type' view of 'objid
/* Call to open the object */
Call SysSetObjectData objid, 'OPEN='type
If quiet=0 Then Do
   If result=1 Then Say 'Object opened'
   Else             Say 'Object NOT opened, return code='result
End
Exit

/* Common exit point */
Exiter:
Call SysDropFuncs
Exit

/* Help Routine */
Helper:
Call SysCls; Say; Say;
Say '** OPENWPS ** Open a WPS object or directory'
Say ''
Say 'Syntax: OPENWPS name view /n'
Say ''
Say 'If no parameters are passed it is assumed you want the current drive'
Say 'and directory opened using the DEFAULT view.'
Say 'Otherwise you can specify the name of an existing objectid, or'
Say 'drive/directory to be opened. Also you can specify the open view:'
Say 'Valid views:  ICON  TREE  DETAILS  SETTINGS  DEFAULT'
Say ''
Say 'When you specify an objectid you must enclosed it in double quotes,'
Say 'i.e. "<WP_INFO>" Look in \OS2\INI.RC for many existing objectids.'
Say ''
Say 'If you use /N then no messages are displayed, unless problems occur.'
Say ''
Say '---Examples---'
Say ' OPENWPS                           OPENWPS D:\ /N  '
Say ' - Open the default directory.     - Open root of D:, no messages.'
Say ' OPENWPS "<WP_INFO>"               OPENWPS "<WP_PULSE>" /N'
Say ' - Open the Information folder.    - Open the Pulse object, no messages.'
Signal Exiter

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
((END REXX CMD SAMPLES))

((BEGIN CODE FRAGMENTS))
- (SYSSET)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

System Settings
===============
During our attempts at customizing the shell using REXXUTILs for newly created
workstations we discovered many items can be controlled. Our first attempt was
to turn off the default setting for Workplace Shell Print Screen. We wanted it
disabled instead of enabled (saves our customers from accidentally printing
the workplace shell screen contents :-)
From there we learned other items could be changed:

Remember the basic SysIni call is:
  result = SysIni(inifile, app, key, val)

Note: Some items if changed did not seem to take effect until the next reboot.

To see the menu items that can be changed go to:
 OS/2 System / System Setup / System, Confirmation tab

Confirmation
------------
/* Confirm on folder delete                      0=not checked 1=checked */
res=SysIni('USER', 'PM_ControlPanel', 'ConfirmSubDelete', '0']]'00'x)
/* Confirm delete                                0=not checked 1=checked */
res=SysIni('USER', 'PM_ControlPanel', 'ConfirmDelete', '0']]'00'x)
/* Confirm on rename of files with extensions    0=not checked 1=checked */
res=SysIni('USER', 'PM_ControlPanel', 'ConfirmRenameFilesWithExt', '0']]'00'x)
/* Confirm on copy, move, create shadow          0=not checked 1=checked */
res=SysIni('USER', 'PM_ControlPanel', 'ConfirmCopyMoveEtc', '0']]'00'x)
/* Display progress indication dialog            0=not checked 1=checked */
res=SysIni('USER', 'PM_ControlPanel', 'DisplayProgressInd', '0']]'00'x)

To see the menu items that can be changed go to:
 OS/2 System / System Setup / System, Title tab

Title
-----
/* Title clash */
/* Prompt for appropriate action  16 */
/* Auto-rename object             2  */
/* Replace existing object        8  */
result = SysIni('USER', 'PM_ControlPanel', 'NameClash', '16']]'00'x)

To see the menu items that can be changed go to:
 OS/2 System / System Setup / System, Window tab

Button appearance for windows
-----------------------------
/* Hide button = 1 plus hex 0 */
result = SysIni('USER', 'PM_ControlPanel', 'MinButtonType', '1']]'00'x)
/* Minimize button = 2 plus hex 0 */
result = SysIni('USER', 'PM_ControlPanel', 'MinButtonType', '2']]'00'x)

Animation
---------
/* Enabled = hex 01 00 00 00 */
result = SysIni('USER', 'PM_ControlPanel', 'Animation', '01000000'x)
/* Disabled = hex 00 00 00 00 */
result = SysIni('USER', 'PM_ControlPanel', 'Animation', '00000000'x)

Minimize button behavior
------------------------
/* Hide Window = 1 plus hex 0 */
result = SysIni('USER', 'PM_ControlPanel', 'HiddenMinWindows', '1']]'00'x)
/* Minimize window to viewer = 2 plus hex 0 */
result = SysIni('USER', 'PM_ControlPanel', 'HiddenMinWindows', '2']]'00'x)
/* Minimize window to desktop = 3 plus hex 0 */
result = SysIni('USER', 'PM_ControlPanel', 'HiddenMinWindows', '3']]'00'x)

Object Open Behavior
--------------------
/* Display existing window; delete CCVIEW key */
result = SysIni('USER', 'PM_Workplace', 'CCVIEW', 'DELETE:')
/* Create new window; CCVIEW key set to 'ON' */
result = SysIni('USER', 'PM_Workplace', 'CCVIEW', 'ON']]'00'x)

To see the menu items that can be changed go to:
 OS/2 System / System Setup / System, Print Screen tab

Print Screen
------------
/* Disable print screen */
result = SysIni('USER', 'PM_ControlPanel', 'PrintScreen', '0']]'00'x)
/* Enable print screen */
result = SysIni('USER', 'PM_ControlPanel', 'PrintScreen', '1']]'00'x)

To see the menu items that can be changed go to:
 OS/2 System / System Setup / System, Logo tab

Logo
----
/* Indefinite */
result = SysIni('USER', 'PM_ControlPanel', 'LogoDisplayTime', '-1']]'00'x)
/* None */
result = SysIni('USER', 'PM_ControlPanel', 'LogoDisplayTime', '0']]'00'x)
/* Timed   Range: Seconds:0-59 Tenths: 0-9 */
/*  100  = 0 seconds 1 tenths              */
/* 2000  = 2 seconds 0 tenths (default)    */
/* 59900 = 59 seconds 9 tenths             */
result = SysIni('USER', 'PM_ControlPanel', 'LogoDisplayTime', '2000']]'00'x)

To see the menu items that can be changed hightlight your desktop, then
   use Open / Settings / Background tab

Change color button
-------------------
Select the Values button to display the numeric values you'll need for the
INI call. (Use the values when the RGB button is selected)

/* Setting Desktop background color                  R   G   B          */
result = SysIni('USER', 'PM_Colors', 'Background', '204 204 204']]'00'x)

Note: Lots of other colors can be customized as well, review your \OS2\INI.RC
      file for the correct App and Key fields.

To see the menu items that can be changed go to:
 OS/2 System / System Setup / Sound

Warning Beep
------------
/* Turn off Warning Beep */
result = SysIni('USER', 'PM_ControlPanel', 'Beep', '0']]'00'x)
/* Turn on Warning Beep */
result = SysIni('USER', 'PM_ControlPanel', 'Beep', '1']]'00'x)

Remember: Most changes will not be reflected automatically. The next reboot
          should pick up your changes. These calls would be best used when
          first building a workstation, not for dynamic updates.

Global WIN-OS2 Settings
=======================
With OS/2 V2.1 you are able to control certain WIN-OS/2 session properties
for all Windows applications. You can locate this new control by going to:

OS/2 System / System Setup / WIN-OS/2 Setup

The changes you make here will be reflected for all newly created objects
that use WIN-OS/2 settings. No setup string exists to change WIN_DDE, nor
WIN_CLIPBOARD on a program by program basis.

App WINOS2
----------
 3.1 Session tab
 ---------------
   Key PM_Global31SessionType
   Value 15 - WIN-OS/2 Window separate session (3.1 Standard)
   Value 16 - WIN-OS/2 Window (3.1 Standard)
   Value 17 - WIN-OS/2 Window separate session (3.1 Enhanced Compatibility)
   Value 18 - WIN-OS/2 Window (3.1 Enhanced Compatibility)
   Value 19 - WIN-OS/2 Full screen (3.1 Enhanced Compatibility)
   Value 20 - WIN-OS/2 Full screen (3.1 Standard)

Example:
/* Set global session type to WIN-OS/2 Full screen (3.1 Standard) */
result = SysIni('USER', 'WINOS2', 'PM_Global31SessionType', '20']]'00'x)

 WIN-OS/2 Settings button
 ------------------------
   Key PM_GlobalWin31DataExchange
   Value 0  - WIN_DDE On  WIN_CLIPBOARD On
   Value 4  - WIN_DDE Off WIN_CLIPBOARD On
   Value 8  - WIN_DDE On  WIN_CLIPBOARD Off
   Value 12 - WIN_DDE Off WIN_CLIPBOARD Off

Example:
/* Set DDE on, Clipboard off */
result = SysIni('USER', 'WINOS2', 'PM_GlobalWin31DataExchange', '8']]'00'x)

   Key PM_GlobalWindows31Settings
   Need to supply the text of DOS, WIN settings separated by nul 0 character
   AND the string ends with nul 0 nul 0

Example:
/* Default settings */
setting='DPMI_MEMORY_LIMIT=64']]'00'x]],
        'PROGTYPE=PROG_31_STD']]'00'x]],
        'KBD_ALTHOME_BYPASS=1']]'00'x]],
        'VIDEO_SWITCH_NOTIFICATION=1']]'00'x]],
        'VIDEO_8514A_XGA_IOTRAP=0']]'00'x]]'00'x
result = SysIni('USER', 'WINOS2', 'PM_GlobalWindows31Settings', setting)

 Data Exchange tab
 -----------------
 Data exchange between OS/2, DOS and WIN-OS/2 sessions
   Dynamic data exchange
     Key PM_DDESupport
     Value 0 - Public (share with WIN-OS/2)
     Value 1 - Private (non-share with WIN-OS/2)
       Example:
       /* Set DDE Private */
       result = SysIni('USER', 'WINOS2', 'PM_DDESupport', '1']]'00'x)
   Clipboard
     Key PM_ClipboardSupport
     Value 0 - Public (share with WIN-OS/2)
     Value 1 - Private (non-share with WIN-OS/2)
       Example:
       /* Set Clipboard Private */
       result = SysIni('USER', 'WINOS2', 'PM_ClipboardSupport', '1']]'00'x)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
((END CODE FRAGMENTS))

END: REXXUTIL Information and Samples
