home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / o / os2_util.zip / CRTOBJ.ZIP / CRTOBJ.TXT
Text File  |  1992-07-17  |  41KB  |  1,001 lines

  1. Subject: REXXUTIL Information and Samples
  2.  
  3. The following attempts to better explain some of the powerful features
  4. provided by OS/2 V2's dynamic link library; REXXUTIL.DLL (Rexx utility
  5. functions). REXXUTIL functions are described in the online 'REXX Information'
  6. reference and the 'OS/2 2.0 Technical Library Procedures Language/2 REXX
  7. Reference' publication (order number S10G-6268). The information following is
  8. intended to provide a more detailed description of some of the functions.
  9.  
  10. One should realize that many of the functions provided by REXXUTIL have
  11. origins with Presentation Manager WinXXX calls. The 'OS/2 Technical
  12. Library Presentation Manager Programming Reference Vol2' publication
  13. (order number S10G-6265) can be reviewed for more information.
  14.  
  15. Some of the functions used/explained:
  16.  
  17. SysIni:
  18. Using REXXUTIL's SysIni function one can modify many settings of the WorkPlace
  19. Shell as well as change other applications settings that make use of *.INI
  20. files such as the system OS2.INI and OS2SYS.INI.
  21.  
  22. SysCreateObject: (PM WinCreateObject - Create Workplace Object)
  23. Using REXXUTIL's SysCreateObject function one can create various objects;
  24. like folders, programs, and shadow objects using Rexx. This section for the
  25. most part includes parameter information which was gathered together from
  26. various sources of information.
  27.  
  28. SysSetObjectData: (PM WinSetObjectData - Set Object Data)
  29. Using REXXUTIL's SysSetObjectData function one can change an objects
  30. characteristics (of an already created object, if you know its objectid).
  31.  
  32. SysDestroyObject: (PM WinDestroyObject - Destroy Workplace Object)
  33. Using REXXUTIL's SysDestroyObject one can delete an object created if you
  34. know its objectid.
  35.  
  36. Misc Notes:
  37. If one views the *.RC files located in your bootdrive:\OS2 directory you
  38. can learn a lot about the various INI settings and folder structure.
  39. Review INI.RC and INISYS.RC files, they are used to create your OS2.INI
  40. and OS2SYS.INI files.
  41.  
  42. Some of REXXUTIL's functions are only available when using the very latest
  43. REXX20 PACKAGE which consists of the very latest REXX fixes and enhancements
  44. for OS/2 V2. So should you have problems running any of the sample programs
  45. you should make sure your system has the vary latest REXX20 updates.
  46.  
  47. Change Log:
  48.   04/30/92 - Added information about DuplicateFlag parm
  49.            - Added more setup string information from manuals
  50.   06/02/92 - Added information about breaking Title line character "^"
  51.            - Added information about adding multiple DOS_DEVICE statements
  52.            - Added code to SHADOW.CMD to make shadow object of a file
  53.   !!NOTE!! - The REXXOS2 fixes are required to make some of
  54.              the newer samples work properly.
  55.   06/30/92 - Added information regarding two new REXXUTIL functions:
  56.              SysSetObjectData and SysDestroyObject, also two new
  57.              samples STARTDOS, BOOTDOS (Thanks to Rick McGuire)
  58.   07/13/92 - Reorganized the way the material is presented. Also added more
  59.              sample Rexx routines REBUILD, OBJCLASS and LPTADD, descriptions
  60.              follow. Also changed parm CONCURRENTVIEW to CCVIEW (Thanks
  61.              Dan Kehn, Felix Sawicki)
  62.   07/15/92 - Updated entire document as I mistakenly truncated it at 80
  63.              characters. Rewrote some sample Rexx routines so they do not
  64.              extend beyond 80 characters. Also updated the SysSetObjectData
  65.              description to show how can open an object (Thanks Rick). Added
  66.              information about creating multi-line titles, carat works for
  67.              two line titles but not more than 2.
  68.              New samples, OBJECTID and FONTS included, descriptions follow.
  69.  
  70. This append consists of multiple pieces of information:
  71.  
  72. 1) Large block of text containing information that pertains to the subject.
  73.    (TEXT INFORMATION)
  74. 2) Sample Rexx code, some complete programs, others code fragments:
  75.  - (FOLDER.CMD)
  76.    Creates a folder and program objects in the folder
  77.  - (SHADOW.CMD)
  78.    Creates shadows of objects
  79.  - (FLDSHAD.CMD)
  80.    Creates a folder, then program object in the folder, then place a shadow
  81.    of the program object on the desktop.
  82.  - (STARTDOS.CMD)
  83.    Starts a DOS program using specific DOS VDM settings.
  84.  - (BOOTDOS.CMD)
  85.    Starts a DOS session, booting from a specific DOS image with
  86.    specific DOS VDM settings.
  87.  - (REBUILD.CMD)
  88.    Allows one to rebuild OS/2 system objects, like MAKEINI does.
  89.  - (LPTADD.CMD)
  90.    Code using SysIni to add LPT4-9 ports.
  91.  - (OBJECTID.CMD)
  92.    Code using SysIni to list OBJECTIDs known to the WorkPlace Shell
  93.  - (FONTS.CMD)
  94.    Code using SysIni to list installed fonts.
  95.  
  96. ((BEGIN TEXT INFORMATION))
  97. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  98.  
  99. -- Help information regarding the SysCreateObject function of REXXUTIL --
  100.  
  101. Function: SysCreateObject
  102. Syntax:
  103. result=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)
  104.  
  105.  classname:The name of the object class.
  106.  
  107.  title:    The object title.
  108.  
  109.  location: The object location.  This can be specified as either a
  110.            descriptive path (for example, OS/2 System Folder\System
  111.            Configuration) or a file system path (for example,
  112.            C:\bin\mytools).
  113.  
  114.  setup:    A WinCreateObject setup string.
  115.  
  116.  duplicateflag: This parameter indicates what action should be taken
  117.            when the Setup string specifies an object ID, and an object with
  118.            that object ID already exists. If the setup string does not give
  119.            an object ID, a duplicate object will be created.
  120.  
  121.  result    The return code from WinCreateObject. This returns 1 (TRUE) if the
  122.            object was created and 0 (FALSE) if the object was not created.
  123.  
  124.  Purpose:  Create a new instance of an object class.
  125.  
  126. -- Help information regarding the SysSetObjectData function of REXXUTIL --
  127.  
  128. Function: SysSetObjectData
  129. Syntax:
  130. result=SysSetObjectData(name, setup)
  131.  
  132.  name:     The object name.  This can be specified as an object id (for
  133.            example <WP_DESKTOP>) or as a fully specified file name.
  134.  
  135.  setup:    A WinCreateObject setup string.
  136.  
  137.  Purpose:  Alter the settings of an existing object. Can also be used to
  138.            open an instance of an object:
  139.                                  /* open up the system folder */
  140.            call SysSetObjectData '<WP_OS2SYS>', 'OPEN=DEFAULT;'
  141.  
  142. See the description of the SysCreateObject location and setup strings
  143. following for an explanation of the parameters.
  144.  
  145. -- Help information regarding the SysDestroyObject function of REXXUTIL --
  146.  
  147. Function: SysDestroyObject
  148. Syntax:
  149. result=SysDestroyObject(name)
  150.  
  151.  name:     The object name.  This can be specified as an object id (for
  152.            example <WP_DESKTOP>) or as a fully specified file name.
  153.  
  154.  Purpose:  Destroys an existing object.
  155.  
  156. See the description of the SysCreateObject location parameter
  157. following for an explanation of the object name.
  158.  
  159. --SysCreateObject Parms------------------------------------------------------
  160.  
  161. The SysCreateObject parameters are now explained in more detail.
  162.  
  163. Remember syntax is...
  164. result=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)
  165.  
  166. classname:
  167.   A registered object class defined to the system. Of particular interest are
  168.   the WPFolder/WPProgram/WPShadow classes. Note using the sample Rexx code
  169.   included in the SysQueryClassList function help screen one can list all
  170.   of the registered classes:
  171.  
  172.   call SysQueryClassList "list."
  173.   do i = 1 to list.0
  174.      say 'Class' i 'is' list.i
  175.   end
  176.  
  177. title:
  178.   Easy one, the objects title you want to use. If you wish to break the title
  179.   line use the carat "^" symbol in the title. Ex. 'First line^Second Line'
  180.   This works to break a title into two lines. However to break a title into
  181.   more than two lines you need to separate the title lines with a hex 0A
  182.   (line-feed) character.
  183.   Rexx example:
  184.   h0A='0A'X
  185.   title='First'h0A'Second'h0A'Third'
  186.  
  187. location:
  188.   The objects location can be specified as either a descriptive path (for
  189.   example, OS/2 System Folder\System Configuration) or a file system path
  190.   (for example, C:\bin\mytools). However by looking at the INI.RC file one
  191.   can see a use of other "locations", such as <WP_DESKTOP>. If this is used
  192.   as a location then your object will reside on the WorkPlace Shell desktop.
  193.   If you are creating a folder or program object you should make sure you use
  194.   the setup string option and give that folder a unique OBJECTID. We'll see
  195.   how this works later.
  196.  
  197.   HINTS: Here are some predefined object ids of system folders. Also if you
  198.          are thinking of placing an object in the Startup Folder <WP_START>,
  199.          make it a shadow of an object.
  200.          <WP_DESKTOP>   The Desktop.
  201.          <WP_START>     The Startup folder.
  202.          <WP_OS2SYS>    The System folder.
  203.          <WP_TEMPS>     The Templates folder.
  204.          <WP_CONFIG>    The System Setup folder.
  205.          <WP_INFO>      The Information folder.
  206.          <WP_DRIVES>    The Drives folder.
  207.          <WP_NOWHERE>   The hidden folder.
  208.  
  209. setup:
  210.   This field needs the most explaining, a larger section following details
  211.   many of the available setupstring parameters. The setupstring field contains
  212.   a series of "keyname=value" pairs separated by semi-colons that change the
  213.   behavior of an object. Each object class documents its keynames and the
  214.   parameters it expects to see.
  215.  
  216. duplicateflag:
  217.   There are three possible values for this parameter:
  218.   FailIfExists - No object should be created if an object with the
  219.       given object already exists. This is the default and maps to the
  220.       PM creation flag, CO_FAILIFEXISTS
  221.   ReplaceIfExists - If an object with the given object ID already exists,
  222.       the existing object should be replaced. Maps to the PM creation
  223.       flag, CO_REPLACEIFEXISTS.
  224.   UpdateIfExists - If an object with the given object ID already exists,
  225.       the existing object should be updated with the new information.
  226.       Maps to the creation flag, CO_UPDATEIFEXISTS.
  227.   (Only the first character is required/examined, i.e. F, R, or U)
  228.  
  229. ALL parameters have safe defaults, so it is never necessary to pass
  230. unnecessary parameters to an object.
  231.  
  232. --Setup Strings--------------------------------------------------------------
  233.  
  234.   What follows are both WPFolder and WPProgram setup string parameters.
  235.   Their various key names, values and a short description follow
  236.   each item. The <<xxx>> item is there to give you an idea of what
  237.   Workplace Shell settings "page" you would find this information on.
  238.  
  239. *********************************
  240. ***WPFolder setup string parms***
  241. *********************************
  242. KEYNAME      VALUE           Description
  243. -----------------------------------------------------------------------------
  244. <<View>>
  245. OPEN         ICON            Open icon view when object is created.
  246.              TREE            Open tree view when object is created.
  247.              DETAILS         Open details view when object is created.
  248. ICONVIEW     s1[,s2,...sn]   Set icon view to specified style(s).
  249. TREEVIEW     s1[,s2,...sn]   Set tree view to specified style(s).
  250. DETAILSVIEW  s1[,s2,...sn]   Set details view to specified style(s).
  251. (styles)     FLOWED          flowed list items
  252.              NONFLOWED       non-flowed list items
  253.              NONGRID         non-gridded icon view
  254.              NORMAL          normal size icons
  255.              MINI            small icons
  256.              INVISIBLE       no icons
  257.              LINES           lines in tree view
  258.              NOLINES         no lines in tree view
  259. <<Background>>
  260. BACKGROUND   filename        Sets the folder background. filename is the
  261.                              name of a file in the \OS2\BITMAP directory
  262.                              of the boot drive.
  263. <<File>>
  264. WORKAREA     YES             Make the folder a Workarea folder
  265. <<Window>>
  266. MINWIN       HIDE            Views of this object will hide when their
  267.                              minimize button is selected.
  268.              VIEWER          Views of this object will minimize to the
  269.                              minimized window viewer when their minimize
  270.                              button is selected.
  271.              DESKTOP         Views of this object will minimize to the
  272.                              Desktop when their minimize button is selected.
  273. VIEWBUTTON   HIDE            Views of this object will have a hide button
  274.                              as opposed to a minimize button.
  275.              MINIMIZE        Views of this object will have a minimize button
  276.                              as opposed to a hide button.
  277. CCVIEW       YES             New views of this object will be created every
  278.                              time the user selects open.
  279.              NO              Open views of this object will resurface when
  280.                              the user selects open.
  281. <<General>>
  282. ICONFILE     filename        This sets the object's icon.
  283. ICONRESOURCE id,module       This sets the object's icon. 'id' is the
  284.                              identity of an icon resource in the 'module'
  285.                              dynamic link library (DLL).
  286. ICONPOS      x,y             This sets the object's initial icon position.
  287.                              The x and y values represent the position in
  288.                              the object's folder in percentage coordinates.
  289. TEMPLATE     YES             Creates object as a template.
  290.              NO              Resets objects template property.
  291. -----------------------------------------------------------------------------
  292.  
  293. **********************************
  294. ***WPProgram setup string parms***
  295. **********************************
  296. KEYNAME      VALUE           Description
  297. -----------------------------------------------------------------------------
  298. <<Program>>
  299. EXENAME      filename        Sets the name of the program
  300. PARAMETERS   params          Sets the parameters list, which may
  301.                              include substitution characters
  302. STARTUPDIR   pathname        Sets the working directory
  303. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  304. <<Sessions>>
  305. PROGTYPE     FULLSCREEN      Sets the session type to OS/2 full screen
  306.              PM              Sets the session type to PM
  307.              SEPARATEWIN     Sets the session type to WIN-OS2 window
  308.                              running in a separate VDM.
  309.              VDM             Sets the session type to DOS full screen
  310.              WIN             Sets the session type to WIN-OS2 full screen
  311.              WINDOWABLEVIO   Sets the session type to OS/2 windowed
  312.              WINDOWEDVDM     Sets the session type to DOS windowed
  313.              WINDOWEDWIN     Sets the session type to WIN-OS2 windowed
  314. MINIMIZED    YES             Start program minimized
  315. MAXIMIZED    YES             Start program maximized
  316. NOAUTOCLOSE  YES             Leaves the window open upon program termination.
  317.              NO              Closes the window when the program terminates.
  318. -DOS Settings-
  319. NOTES:
  320. - To change these values you use SET keyname=
  321.   Example:   SET DOS_FILES=45;SET DOS_HIGH=1
  322.   Also for some use values of 1 for ON, 0 for off
  323.   Example:   SET COM_HOLD=1;     (on, default is off)
  324.   To add more than one DOS_DEVICE you need to separate with hex 0A (line-feed)
  325.   Rexx example:
  326.   h0A='0A'X
  327.   setup='...;SET DOS_DEVICE=C:\OS2\MDOS\ANSI.SYS'h0A'C:\OS2\MDOS\EGA.SYS...'
  328.  
  329. List of DOS Setting fields
  330. COM_HOLD
  331. DOS_BACKGROUND_EXECUTION
  332. DOS_BREAK
  333. DOS_DEVICE
  334. DOS_FCBS
  335. DOS_FCBS_KEEP
  336. DOS_FILES
  337. DOS_HIGH
  338. DOS_LASTDRIVE
  339. DOS_RMSIZE
  340. DOS_SHELL
  341. DOS_STARTUP_DRIVE
  342. DOS_UMB
  343. DOS_VERSION
  344. DPMI_DOS_API
  345. DPMI_MEMORY_LIMIT
  346. DPMI_NETWORK_BUFF_SIZE
  347. DPMI_DOS_API
  348. EMS_FRAME_LOCATION
  349. EMS_HIGH_OS_MAP_REGION
  350. EMS_LOW_OS_MAP_REGION
  351. EMS_MEMORY_LIMIT
  352. HW_NOSOUND
  353. HW_ROM_TO_RAM
  354. HW_TIMER
  355. IDLE_SECONDS
  356. IDLE_SENSITIVITY
  357. KBD_ALTHOME_BYPASS
  358. KBD_BUFFER_EXTEND
  359. KBD_RATE_LOCK
  360. MEM_INCLUDE_REGIONS
  361. MEM_EXCLUDE_REGIONS
  362. MOUSE_EXCLUSIVE_ACCESS
  363. PRINT_TIMEOUT
  364. VIDEO_FASTPASTE
  365. VIDEO_MODE_RESTRICTION
  366. VIDEO_ONDEMAND_MEMORY
  367. VIDEO_RETRACE_EMULATION
  368. VIDEO_ROM_EMULATION
  369. VIDEO_SWITCH_NOTIFICATION
  370. VIDEO_WINDOW_REFRESH
  371. VIDEO_8514A_XGA_IOTRAP
  372. XMS_HANDLES
  373. XMS_MEMORY_LIMIT
  374. XMS_MINIMUM_HMA
  375. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  376. <<Association>>
  377. ASSOCFILTER  filters         Sets the filename filter for files
  378.                              associated to this program.
  379.                              Multiple filters are separated by commas.
  380. ASSOCTYPE    type            Sets the type of files associated to this
  381.                              program. Multiple filters are separated
  382.                              by commas.
  383. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  384. <<Window>>
  385. MINWIN       HIDE            Views of this object will hide when their
  386.                              minimize button is selected.
  387.              VIEWER          Views of this object will minimize to the
  388.                              minimized window viewer when their minimize
  389.                              button is selected.
  390.              DESKTOP         Views of this object will minimize to the
  391.                              Desktop when their minimize button is selected.
  392. VIEWBUTTON   HIDE            Views of this object will have a hide button
  393.                              as opposed to a minimize button.
  394.              MINIMIZE        Views of this object will have a minimize button
  395.                              as opposed to a hide button.
  396. CCVIEW       YES             New views of this object will be created every
  397.                              time the user selects open.
  398.              NO              Open views of this object will resurface when
  399.                              the user selects open.
  400. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  401. <<General>>
  402. ICONFILE     filename        This sets the object's icon.
  403. ICONRESOURCE id,module       This sets the object's icon. 'id' is the
  404.                              identity of an icon resource in the 'module'
  405.                              dynamic link library (DLL).
  406. ICONPOS      x,y             This sets the object's initial icon position.
  407.                              The x and y values represent the position in
  408.                              the object's folder in percentage coordinates.
  409. TEMPLATE     YES             Creates object as a template.
  410.              NO              Resets objects template property.
  411. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  412. <<Misc>>
  413. OBJECTID     <name>          This sets the object's identity. The object
  414.                              id will stay with the object even if it is
  415.                              moved or renamed. An object id is any unique
  416.                              string preceded with a '<' and terminated
  417.                              with a '>'. This may also be a real name
  418.                              specified as a fully qualified path name.
  419. HELPPANEL    id              This sets the object's default help panel.
  420. HELPLIBRARY  filename        This sets the help library.
  421. OPEN         SETTINGS        Open settings view when object is created.
  422.              DEFAULT         Open default view when object is created.
  423. NODELETE     YES             Will not allow you to delete the object.
  424. NOCOPY       YES             Will not allow you to make a copy.
  425. NOMOVE       YES             Will not allow you to move the object to another
  426.                              folder, will create shadow on a move.
  427. NODRAG       YES             Will not allow you to drag the object.
  428. NOLINK       YES             Will not allow you to create a shadow link.
  429. NOSHADOW     YES             Will not allow you to create a shadow link.
  430. NORENAME     YES             Will not allow you to rename the object.
  431. NOPRINT      YES             Will not allow you to print it.
  432. NOTVISIBLE   YES             Will not display the object.
  433. -----------------------------------------------------------------------------
  434.  
  435. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  436. ((END TEXT INFORMATION))
  437.  
  438. ((BEGIN REXX CMD SAMPLES))
  439.  
  440. - (FOLDER.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  441.  
  442. /* FOLDER.CMD: Sample code using REXXUTIL's SysCreateObject function    */
  443. /* Builds a folder on the DeskTop and places some program objects in it.*/
  444. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  445. /* Load REXXUTIL */
  446. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  447. call sysloadfuncs
  448.  
  449. /*The basic call is listed next.                                           */
  450. /*rc=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)*/
  451.  
  452. call SysCls
  453. Say '';Say 'Using REXXUTILs to Add a Folder and Program Objects...'
  454.  
  455. Say '';Say 'Press Y to add Test Folder to Desktop...';Say '';
  456. parse upper value SysGetKey('NOECHO') with key
  457. If key<>'Y' Then Exit
  458.  
  459. /* All of the routines pass parameters to a subroutine to perform the call */
  460. classname='WPFolder'
  461. title='Test Folder'
  462. location='<WP_DESKTOP>'
  463. setup='OBJECTID=<TEST_FOLDER>'
  464. Call BldObj
  465.  
  466. Say '';Say 'Now go and open up the folder, currently no items are there.'
  467. Say 'Press ENTER and we will add a few program objects...'
  468. key=SysGetKey()
  469.  
  470. Say 'Place a program object into the folder...';Say '';
  471. classname='WPProgram'
  472. title='SYSLEVEL-FULLSCR'
  473. location='<TEST_FOLDER>'
  474. setup='OBJECTID=<TEST_SYSL>;',
  475.       'EXENAME=\OS2\SYSLEVEL.EXE;',
  476.       'PROGTYPE=FULLSCREEN;'
  477. Call BldObj
  478.  
  479. classname='WPProgram'
  480. title='CHKDSK-PM'
  481. location='<TEST_FOLDER>'
  482. setup='OBJECTID=<TEST_PMCK>;',
  483.       'EXENAME=\OS2\PMCHKDSK.EXE;',
  484.       'MINIMIZED=YES;',
  485.       'PROGTYPE=PM;'
  486. Call BldObj
  487.  
  488. classname='WPProgram'
  489. title='SYSLEVEL-VIO'
  490. location='<TEST_FOLDER>'
  491. setup='OBJECTID=<TEST_SYSLVIO>;',
  492.       'EXENAME=\OS2\SYSLEVEL.EXE;',
  493.       'PROGTYPE=WINDOWABLEVIO;'
  494. Call BldObj
  495.  
  496. classname='WPProgram'
  497. title='MEM-Fullscreen'
  498. location='<TEST_FOLDER>'
  499. setup='OBJECTID=<TEST_MEMFUL>;',
  500.       'EXENAME=\OS2\MDOS\MEM.EXE;',
  501.       'PROGTYPE=VDM;',
  502.       'PARAMETERS=/?;',
  503.       'NOAUTOCLOSE=YES;'
  504. Call BldObj
  505.  
  506. classname='WPProgram'
  507. title='MEM-WindowVDM'
  508. location='<TEST_FOLDER>'
  509. setup='OBJECTID=<TEST_MEMWIN>;',
  510.       'EXENAME=\OS2\MDOS\MEM.EXE;',
  511.       'PROGTYPE=WINDOWEDVDM;',
  512.       'PARAMETERS=/?;',
  513.       'NOAUTOCLOSE=YES;'
  514. Call BldObj
  515. Say '';Say 'All done, to remove objects drag to shredder...'
  516.  
  517. Exit
  518.  
  519. /* Build Object */
  520. BldObj:
  521. call charout ,'Building: 'title
  522.  
  523. /* Build object using REPLACE as duplicateflag */
  524. result = SysCreateObject(classname, title, location, setup, 'R')
  525.  
  526. If result=1 Then call charout ,'...   Object created!'
  527. Else             call charout ,'...   Not created! Return code='result
  528.  
  529. Say '';
  530. Return
  531.  
  532. - (SHADOW.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  533.  
  534. /* SHADOW.CMD: Sample code using REXXUTIL's SysCreateObject function    */
  535. /* Builds shadows on the DeskTop and Startup Folder                     */
  536. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  537. /* Load REXXUTIL */
  538. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  539. call sysloadfuncs
  540.  
  541. Call SysCls
  542. Say '';Say 'Using REXXUTILs to Add Shadow Objects...'
  543.  
  544. /* The titles and objectid's are found from the \OS2\INI.RC file */
  545.  
  546. Say '';Say 'First lets place some items on the Desktop...'
  547. title='Enhanced Editor'; objid='<WP_EPM>'   ; loc='<WP_DESKTOP>'; call AddShad
  548. title='OS/2 Window'    ; objid='<WP_OS2WIN>'; loc='<WP_DESKTOP>'; call AddShad
  549. title='System Clock'   ; objid='<WP_CLOCK>' ; loc='<WP_DESKTOP>'; call AddShad
  550.  
  551. Say '';Say 'You can even make shadow objects of files...'
  552. title='CONFIG.SYS'; objid='C:\CONFIG.SYS' ; loc='<WP_DESKTOP>'; call AddShad
  553.  
  554. Say '';Say 'Now lets place an item in the Startup Folder...'
  555. title='System Clock'   ; objid='<WP_CLOCK>' ; loc='<WP_START>'  ; call AddShad
  556.  
  557. Say '';Say 'All done, to remove objects drag to shredder...'
  558.  
  559. Exit
  560.  
  561. AddShad:
  562. Say '';Say 'Press Y to add shadow object: 'title' to 'loc
  563. parse upper value SysGetKey('NOECHO') with key
  564. If key='Y' Then Do
  565.  
  566.    /* Build object using FAIL as duplicateflag */
  567.    result=SysCreateObject('WPShadow', title, loc, 'SHADOWID='objid, 'F')
  568.  
  569.    If result=1 Then Say 'Object created'
  570.    Else             Say 'Not created, return code='result
  571. End
  572. Return
  573.  
  574. - (FLDSHAD.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  575.  
  576. /* FLDSHAD.CMD: Sample code using REXXUTIL's SysCreateObject function   */
  577. /* Builds a folder on the DeskTop places a program object in it then    */
  578. /* places a shadow of the program object on the DeskTop.                */
  579. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  580. /* Load REXXUTIL */
  581. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  582. call sysloadfuncs
  583.  
  584. /*The basic call is listed next.                                           */
  585. /*rc=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)*/
  586.  
  587. call SysCls
  588. Say '';Say 'Using REXXUTILs to Add Folder/Program/Shadow Objects...'
  589.  
  590. Say '';Say 'Press Y to add Test Folder to Desktop...';Say '';
  591. parse upper value SysGetKey('NOECHO') with key
  592. If key<>'Y' Then Exit
  593.  
  594. classname='WPFolder'
  595. title='Test Folder'
  596. location='<WP_DESKTOP>'
  597. setup='OBJECTID=<TEST2_FOLDER>'
  598. Call BldObj
  599.  
  600. Say '';Say 'Press Y to place a program object into the folder...';Say '';
  601. parse upper value SysGetKey('NOECHO') with key
  602. If key<>'Y' Then Exit
  603.  
  604. classname='WPProgram'
  605. title='SYSLEVEL-VIO'
  606. location='<TEST2_FOLDER>'
  607. setup='OBJECTID=<TEST2_SYSLVIO>;',
  608.       'EXENAME=\OS2\SYSLEVEL.EXE;',
  609.       'PROGTYPE=WINDOWABLEVIO;'
  610. Call BldObj
  611.  
  612. Say '';
  613. Say 'Press Y to place a shadow of the program object on the Desktop...';
  614. Say '';
  615. parse upper value SysGetKey('NOECHO') with key
  616. If key<>'Y' Then Exit
  617.  
  618. classname='WPShadow'
  619. title='SYSLEVEL-VIO'
  620. location='<WP_DESKTOP>'
  621. setup='SHADOWID=<TEST2_SYSLVIO>'
  622. Call BldObj
  623.  
  624. Say '';Say 'All done, to remove objects drag to shredder...'
  625.  
  626. Exit
  627.  
  628. /* Build Object */
  629. BldObj:
  630. call charout ,'Building: 'title
  631.  
  632. /* Build object using REPLACE as duplicateflag */
  633. result = SysCreateObject(classname, title, location, setup, 'R')
  634.  
  635. If result=1 Then call charout ,'...   Object created!'
  636. Else             call charout ,'...   Not created! Return code='result
  637.  
  638. Say '';
  639. Return
  640.  
  641. - (STARTDOS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  642.  
  643. /* STARTDOS.CMD: Sample code using REXXUTIL's SysCreateObject function  */
  644. /* Starts a DOS program using specific DOS VDM settings.  This is       */
  645. /* particularly useful for LAN execution that requires NET USE commands.*/
  646. /* The example invokes the PKZIP.EXE program using files setting of 45  */
  647. /* Rick McGuire:  MCGUIRE/GDLVM7                                        */
  648. /* Load REXXUTIL */
  649. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  650. call sysloadfuncs
  651.  
  652. /* The basic call is listed next.                                          */
  653. /* result = SysCreateObject(classname, title, location, setup)             */
  654.  
  655. classname='WPProgram'
  656. title='My DOS Program'
  657. location='<WP_NOWHERE>'                  /* place in invisible folder      */
  658. program='EXENAME=C:\PKZIP.EXE;'          /* DOS program name               */
  659. type='PROGTYPE=WINDOWEDVDM;'             /* type of DOS session (windowed) */
  660. startup='STARTUPDIR=C:\;'                /* startup directory              */
  661. settings='SET DOS_FILES=45;'             /* required DOS settings          */
  662. open='OPEN=DEFAULT;'                     /* open now                       */
  663.  
  664. call SysCreateObject classname, title, location,,
  665.     program||type||startup||settings||open, 'REPLACE'
  666. Return
  667.  
  668. - (BOOTDOS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  669.  
  670. /* BOOTDOS.CMD: Sample code using REXXUTIL's SysCreateObject function   */
  671. /* Starts a DOS session, booting from a specific DOS image with         */
  672. /* specific DOS VDM settings.                                           */
  673. /* Rick McGuire:  MCGUIRE/GDLVM7                                        */
  674. /* Load REXXUTIL */
  675. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  676. call sysloadfuncs
  677.  
  678. /* The basic call is listed next.                                          */
  679. /* result = SysCreateObject(classname, title, location, setup)             */
  680.  
  681. classname='WPProgram'
  682. title='Booted DR DOS'
  683. location='<WP_NOWHERE>'                  /* place in invisible folder      */
  684. program='EXENAME=*;'                     /* DOS program name (use shell)   */
  685. type='PROGTYPE=WINDOWEDVDM;'             /* type of DOS session (windowed) */
  686. image='C:\DRDOS.VM;'                     /* DOS image file                 */
  687.                                          /* required DOS settings          */
  688. settings='SET DOS_BACKGROUND_EXECUTION=ON;'
  689. open='OPEN=DEFAULT;'                     /* open now                       */
  690.  
  691. call SysCreateObject classname, title, location,,
  692.     program||type||image||settings||open, 'REPLACE'
  693. Return
  694.  
  695. - (REBUILD.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  696.  
  697. /* REBUILD.CMD: Sample code using REXXUTIL's SysCreateObject function   */
  698. /* Can be used to rebuild objects created during the installation of    */
  699. /* your OS/2 system. The \OS2\INSTALL\INI.RC file contains information  */
  700. /* that can be used by the SysCreateObject function.                    */
  701. /* The INI.RC file is used by MAKEINI.EXE to create your OS2.INI file   */
  702. /* Syntax:  Enter  "REBUILD ?" for complete syntax                      */
  703. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  704. '@ECHO OFF'
  705. /* Load REXXUTIL */
  706. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  707. call sysloadfuncs
  708.  
  709. Arg parms
  710. cmdparms=parms /* Save command line parms for later processing */
  711.  
  712. /* Until REXXUTIL offers a function call to retrieve the OS2 boot drive  */
  713. /* we assume the enviroment variable COMSPEC has location of boot drive. */
  714. BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))
  715.  
  716. parse upper var cmdparms type '(' inifile .
  717. /* If user does not enter location of *.RC file then try to find it */
  718. If inifile='' Then inifile=BtDrv||'\OS2\INI.RC'
  719. rcx=stream(inifile,'C','Q EXISTS')
  720. If rcx='' Then Do
  721.    Say '';Say '';Say inifile 'not found'
  722.    Return
  723. End
  724. type=left(type,1)
  725. If verify(type,'FPOA') Then Signal Helper
  726.  
  727. /* Initialize tables and table counters */
  728. iniftab.=''; iniptab.='' iniotab.=''; /*Folders, Programs, Others */
  729. iniflns=0;   iniplns=0;  iniolns=0;
  730. initab.='';  inilns=0;
  731. Call stream inifile,'C','CLOSE'
  732. Do while lines(inifile)>0  /* Read RC file into tables */
  733.    lne=linein(inifile)
  734.    parse var lne '"PM_InstallObject"' lne
  735.    If lne\='' Then Do
  736.       parse var lne '"'rest1'" 'lne
  737.       parse var lne '"'setup'"'
  738.       parse var rest1 title';'object';'location
  739.       If object='WPFolder' Then Do
  740.          iniflns=iniflns+1
  741.          iniftab.1.iniflns=object;   iniftab.2.iniflns=title;
  742.          iniftab.3.iniflns=location; iniftab.4.iniflns=setup;
  743.       End
  744.       Else If object='WPProgram' Then Do
  745.          iniplns=iniplns+1
  746.          iniptab.1.iniplns=object;   iniptab.2.iniplns=title;
  747.          iniptab.3.iniplns=location; iniptab.4.iniplns=setup;
  748.       End
  749.       Else Do
  750.          iniolns=iniolns+1
  751.          iniotab.1.iniolns=object;   iniotab.2.iniolns=title;
  752.          iniotab.3.iniolns=location; iniotab.4.iniolns=setup;
  753.       End
  754.    End
  755. End
  756. Call stream inifile,'C','CLOSE'
  757.  
  758. /* Calculation for screen loop */
  759. parse value SysTextScreenSize() with row col
  760. scrsz=row-12
  761.  
  762. If type='F' | type='A' Then Do; /* Folder routine */
  763.    objt='Folder'; inilns=iniflns;
  764.    Do i=1 to inilns; Do j=1 to 4;
  765.       initab.j.i=iniftab.j.i
  766.    End; End;
  767.    Call DispSel
  768. End;
  769. If type='P' | type='A' Then Do; /* Program routine */
  770.    objt='Program'; inilns=iniplns;
  771.    Do i=1 to inilns; Do j=1 to 4;
  772.       initab.j.i=iniptab.j.i
  773.    End; End;
  774.    Call DispSel
  775. End;
  776. If type='O' | type='A' Then Do; /* Other routine */
  777.    objt='Other'; inilns=iniolns;
  778.    Do i=1 to inilns; Do j=1 to 4;
  779.       initab.j.i=iniotab.j.i
  780.    End; End;
  781.    Call DispSel
  782. End;
  783. Return; /* When get here done with processing */
  784.  
  785. /* Routine to display objects and allow selection */
  786. DispSel:
  787. key=''
  788. Do while key\='Q'
  789.    Call SysCls; Say '';Say objt' objects found in: 'inifile;Say '';
  790.    Do i=1 to inilns
  791.       If trunc(i/scrsz)==i/scrsz Then Call Promptx 1
  792.       If key='Q' Then leave
  793.       n=right('  '||i,3)||') '||left(initab.2.i||copies(' ',30),30)
  794.       n=n||left(initab.3.i||copies(' ',20),20)
  795.       Say n
  796.    End
  797.    If key\='Q' Then Call Promptx 0
  798. End
  799. Return
  800.  
  801. /* Screen loop routine also calls object build routine */
  802. Promptx: Arg scr
  803. Say '';Say 'To attempt to rebuild an object enter the number of the object'
  804. If scr=0 Then Say 'or enter Q to quit...'
  805. Else Say 'or press enter to show next screen...  Or enter Q to Quit...'
  806. pull key .
  807. If (key>=1) & (key <=inilns) then,
  808.     rcx=BldIt(initab.1.key,initab.2.key,initab.3.key,initab.4.key)
  809. If scr=1 Then Do;
  810.    Call SysCls;Say '';Say objt' objects found in: 'inifile;Say '';
  811. End;
  812. Return
  813.  
  814. /* Routine to build object */
  815. BldIt: Parse Arg object,title,location,setup
  816. Say 'SysCreateObject('object', 'title', 'location', 'setup', R)'
  817. /* Build object using REPLACE as duplicateflag */
  818. result = SysCreateObject(object, title, location, setup, 'R')
  819. If result=1 Then Say '...   Object created!'
  820. Else             Say '...   Not created! Return code='result
  821. Say '';Say 'Press ENTER to continue...'
  822. Pull ans
  823. Return result
  824.  
  825. /* Syntax help */
  826. Helper:
  827. call SysCls
  828. Say '';Say ''; Say 'REBUILD:'
  829. Say 'Routine to rebuild system installed objects listed in *.RC files.'
  830. Say 'Can be used as an alternative to using the MAKEINI command.'
  831. Say 'Your INI.RC file is used by MAKEINI.EXE during installation to'
  832. Say 'create your OS2.INI file.'
  833. Say ''; Say 'Syntax:';Say '';
  834. Say 'REBUILD object [(filespec]'
  835. Say '';Say 'Valid objects A(ll), F(olders), P(rograms), O(ther)'
  836. Say 'Can also can use (filespec for name of *.RC file, default is \OS2\INI.RC'
  837. Exit
  838.  
  839. - (LPTADD.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  840.  
  841. /* LPTADD.CMD: Sample code using REXXUTIL's SysIni function.            */
  842. /* Routine will expand the number of LPT ports the WorkPlace Shell      */
  843. /* recognizes from LPT1-3 to LPT1-9. Also a routine to add LPT3-9 to    */
  844. /* the WIN-OS2 WIN.INI file.                                            */
  845. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  846. '@ECHO OFF'
  847. /* Load REXXUTIL */
  848. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  849. call sysloadfuncs
  850.  
  851. /* The basic call for setting a single key value is listed next.        */
  852. /* result = SysIni([inifile], app, key, val)                            */
  853.  
  854. call SysCls; Say '';
  855. Say 'Using REXXUTILs SysIni call to add LPT4-9 to the WorkPlace Shell'
  856. Say '';Say 'Press Y to add/initialize LPT4-9 ports...';Say '';
  857. parse upper value SysGetKey('NOECHO') with key
  858. If key='Y' Then Do
  859.    Say 'LPT Ports: setting up for LPT4-9 ports...'
  860.    Do n=4 to 9
  861.       Say ' Setting up PM_LPT'n'...'
  862.       rx=SysIni('SYSTEM', 'PM_SPOOLER_PORT', 'LPT'n, ';'||'00'x)
  863.       If rx\='' Then Say 'LPT'n' Bad result='result
  864.       rx=SysIni('SYSTEM', 'PM_LPT'n,         'DESCRIPTION', 'LPT'||n||'00'x)
  865.       If rx\='' Then Say 'LPT'n' Bad result='result
  866.       rx=SysIni('SYSTEM', 'PM_LPT'n,         'INITIALIZATION', ';'||'00'x)
  867.       If rx\='' Then Say 'LPT'n' Bad result='result
  868.       rx=SysIni('SYSTEM', 'PM_LPT'n,         'PORTDRIVER', 'PARALLEL;'||'00'x)
  869.       If rx\='' Then Say 'LPT'n' Bad result='result
  870.       rx=SysIni('SYSTEM', 'PM_LPT'n,         'TERMINATION', ';'||'00'x)
  871.       If rx\='' Then Say 'LPT'n' Bad result='result
  872.       rx=SysIni('SYSTEM', 'PM_LPT'n,         'TIMEOUT', '45;'||'00'x)
  873.       If rx\='' Then Say 'LPT'n' Bad result='result
  874.    End
  875.    Say 'LPT4-9 added... Press any key to continue...'
  876.    SysGetKey('NOECHO')
  877. End
  878.  
  879. call SysCls; Say '';
  880. Say 'Can now attempt to add LPT3-9 to your WIN-OS2 WIN.INI file.'
  881. Say '';Say 'Press Y to attempt to add LPT3-9 ports to WIN-OS2...';Say '';
  882. parse upper value SysGetKey('NOECHO') with key
  883. If key='Y' Then Do
  884.   /* Change \OS2\MDOS\WINOS2\WIN.INI to add more ports LPT3-LPT9 */
  885.   win.='';winnew.='';
  886.   /* Until REXXUTIL offers a function call to retrieve the OS2 boot drive  */
  887.   /* we assume the enviroment variable COMSPEC has location of boot drive. */
  888.   BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))
  889.   fn=BtDrv'\OS2\MDOS\WINOS2\WIN.INI';
  890.   fnx=stream(fn,'C','QUERY EXISTS')
  891.   fn=fnx;
  892.   If fn\='' Then Do /* If file exists then process adding extra ports */
  893.      Call stream fn,'C','CLOSE'
  894.      Do i=1 to 10000 while LINES(fn)>0
  895.         parse value linein(fn) with win.i
  896.      End
  897.      Call stream fn,'C','CLOSE'
  898.      i=i-1; k=0;
  899.      Do j=1 to i /* Look for FILE:= then if line before = LPT2.OS2= add 3-9 */
  900.         If win.j='FILE:=' Then Do
  901.            m=j-1; winchg=no;
  902.            If win.m='LPT2.OS2=' Then Do
  903.               Say 'LPT Ports: setting up for Windows LPT3-9 ports...'
  904.               winchg=yes;
  905.               Do n=3 to 9
  906.                  Say ' Setting up: LPT'n'.OS2='
  907.                  k=k+1; winnew.k='LPT'n'.OS2='
  908.               End;
  909.            End;
  910.         End;
  911.         k=k+1;
  912.         winnew.k=win.j;
  913.      End;
  914.      If winchg=yes Then Do;
  915.         parse var fnx fnx'.' .
  916.         ifn=fnx||'.???';
  917.         ifn=SysTempFileName(ifn)
  918.         '@COPY' fn ifn '1>NUL 2>NUL' /* Copy original to backup name */
  919.         Say 'Copy of' fn 'saved as' ifn
  920.         Say 'Writing' fn 'with added lines.'
  921.         call lineout fn,,1 /* Start writing at first character */
  922.         Do i=1 to k /* write file back out */
  923.            call lineout fn,winnew.i
  924.         End
  925.         Call stream fn,'C','CLOSE'
  926.      End;
  927.      Else Say 'Lines not added, either already done or not what we expect.'
  928.   End;
  929.   Else Say 'Could not locate' fn 'program ending...'
  930. End;
  931. Say 'LPTADD ending...'
  932. Exit
  933.  
  934. - (OBJECTID.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  935.  
  936. /* OBJECTID.CMD: Sample code using REXXUTIL's SysIni function.          */
  937. /* Routine will display the OBJECTIDs known to the WorkPlace Shell      */
  938. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  939. '@ECHO OFF'
  940. /* Load REXXUTIL */
  941. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  942. call sysloadfuncs
  943.  
  944. /* List ObjectIds */
  945. App='PM_Workplace:Location'
  946. call SysIni 'USER', App, 'All:', 'Keys'
  947. if Result \= 'ERROR:' then do
  948.    Call SysCls
  949.    Say '';Say '';Say 'Listing ObjectId information';Say '';
  950.    parse value SysTextScreenSize() with row col
  951.    j=row-10
  952.    Do i=1 to Keys.0
  953.       If trunc(i/j)==i/j Then Do
  954.          Say '';Say 'Press any key to show next screen...'
  955.          key=SysGetKey()
  956.          Call SysCls
  957.          Say '';Say '';Say 'Listing ObjectId information';Say '';
  958.       End
  959.       Say Keys.i
  960.    End
  961. End
  962. Else Say 'Error querying for' App
  963. Return
  964.  
  965. - (FONTS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  966.  
  967. /* FONTS.CMD: Sample code using REXXUTIL's SysIni function.             */
  968. /* Routine will display the FONTS known to the WorkPlace Shell          */
  969. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  970. '@ECHO OFF'
  971. /* Load REXXUTIL */
  972. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  973. call sysloadfuncs
  974.  
  975. /* List installed Fonts */
  976. App='PM_Fonts'
  977. call SysIni 'USER', App, 'All:', 'Keys'
  978. If Result \= 'ERROR:' then do
  979.    Do j=1 to Keys.0
  980.       Keys.j=Keys.j 'Installed as:' SysIni('USER', App, Keys.j)
  981.    End
  982.    Call SysCls
  983.    Say '';Say '';Say 'Listing Installed Fonts';Say '';
  984.    parse value SysTextScreenSize() with row col
  985.    j=row-10
  986.    Do i=1 to Keys.0
  987.       If trunc(i/j)==i/j Then Do
  988.          Say '';Say 'Press any key to show next screen...'
  989.          key=SysGetKey()
  990.          Call SysCls
  991.          Say '';Say '';Say 'Listing Installed Fonts';Say '';
  992.       End
  993.       Say Keys.i
  994.    End
  995. End
  996. Else Say 'Error querying for' App
  997. Return
  998.  
  999. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1000. ((END REXX CMD SAMPLES))
  1001.