home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / DESKUTIL.ZIP / wpsrexx.txt < prev   
Text File  |  1992-04-28  |  20KB  |  492 lines

  1. This file contains 4 pieces of information:
  2.  
  3. 1) Large block of text containing information that pertains to the subject.
  4.    (TEXT INFORMATION)
  5. 2) Sample Rexx code to create a folder and program objects in the folder
  6.    (FOLDER.CMD)
  7. 3) Sample Rexx code to create shadows of objects
  8.    (SHADOW.CMD)
  9. 4) Sample Rexx code to create a folder, then program object in the folder,
  10.    then place a shadow of the program object on the desktop.
  11.    (FLDSHAD.CMD)
  12.  
  13. ((BEGIN TEXT INFORMATION))
  14. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  15. Using the REXXUTIL SysCreateObject function
  16.  
  17. Using V2's REXXUTIL SysCreateObject function one can create various objects;
  18. like folders, programs, and shadow objects using Rexx. This section for the
  19. most part includes parameter information which was gathered together from
  20. various sources of information.
  21.  
  22. Michael Lamb MIKELAMB(KGNVMC)
  23. Workstation Technical Support
  24. Kingston NY
  25.  
  26. -- Help information regarding the SysCreateObject function of REXXUTIL --
  27.  
  28. Function: SysCreateObject
  29. Syntax:  result = SysCreateObject(classname, title, location <,setup>)
  30.  classname The name of the object class.
  31.  title     The object title.
  32.  location  The object location.  This can be specified as either a
  33.            descriptive path (for example, OS/2 System Folder\System
  34.            Configuration) or a file system path (for example,
  35.            C:\bin\mytools).
  36.  setup     A WinCreateObject setup string.
  37.  result    The return code from WinCreateObject. This returns 1 (TRUE) if
  38.            the object was created and 0 (FALSE) if the object was
  39.            not created.
  40.  Purpose:  Create a new instance of an object class.
  41.  
  42. --Interesting INI information:-----------------------------------------------
  43.  
  44. If one views the *.RC files located in your bootdrive:\OS2 directory you
  45. can learn a lot about the various INI settings and folder structure.
  46. Review INI.RC and INISYS.RC files, they are used to create your OS2.INI
  47. and OS2SYS.INI files.
  48.  
  49. --SysCreateObject / WinCreateObject------------------------------------------
  50.  
  51. The various fields of the SysCreateObject call map closely with the
  52. WinCreateObject call.
  53.  /***************************************************************************/
  54.  /* This WinCreateObject function creates an instance of object class       */
  55.  /* pszClassName, with title pszTitle, and places the icon and title in the */
  56.  /* location referred to by pszLocation.                                    */
  57.  /***************************************************************************/
  58.  #define INCL_WINWORKPLACE
  59.  #include <os2.h>
  60.  
  61.  PSZ      pszClassName;
  62.  PSZ      pszTitle;
  63.  PSZ      pszSetupString;
  64.  PSZ      pszLocation;       /* Folder location */
  65.  ULONG    ulFlags;           /* Creation flags */
  66.  HOBJECT  Success;           /* Success indicator */
  67.  
  68.  Success = WinCreateObject(pszClassName,
  69.              pszTitle, pszSetupString,
  70.              pszLocation, ulFlags);
  71.  
  72. --Putting it all together----------------------------------------------------
  73.  
  74. The SysCreateObject parameters are now explained in more detail. (As I
  75. understand them...)
  76. Remember Syntax: result = SysCreateObject(classname, title, location <,setup>)
  77.  
  78. classname:
  79.   A registered object class defined to the system. Of particular interest are
  80.   the WPFolder/WPProgram/WPShadow classes. Note using the sample Rexx code
  81.   included in the SysQueryClassList function help screen one can list all
  82.   of the registered classes:
  83.  
  84.   call SysQueryClassList "list."
  85.   do i = 1 to list.0
  86.      say 'Class' i 'is' list.i
  87.   end
  88.  
  89. title:
  90.   Easy one, the objects title you want to use.
  91.  
  92. location:
  93.   You can see above what the online Help information has in regards to this
  94.   field. However by looking at the INI.RC file one can see a use of
  95.   other "locations", such as <WP_DESKTOP>. If this is used as a location
  96.   then your object will reside on the WorkPlace Shell desktop. If you are
  97.   creating a folder or program object you should make sure you use the setup
  98.   string option and give that folder a unique OBJECTID. We'll see how this
  99.   works later.
  100.  
  101.   HINTS: Here are some predefined object ids of system folders. Also if you
  102.          are thinking of placing an object in the Startup Folder <WP_START>,
  103.          make it a shadow of the object.
  104.          <WP_DESKTOP>   The Desktop.
  105.          <WP_START>     The Startup folder.
  106.          <WP_OS2SYS>    The System folder.
  107.          <WP_TEMPS>     The Templates folder.
  108.          <WP_CONFIG>    The System Setup folder.
  109.          <WP_INFO>      The Information folder.
  110.          <WP_DRIVES>    The Drives folder.
  111.          <WP_NOWHERE>   The hidden folder.
  112.  
  113. setup:
  114.   This field needs the most explaining, and required the most "snooping".
  115.   The setupstring field contains a series of "keyname=value" pairs separated
  116.   by semi-colons that change the behavior of an object. Each object class
  117.   documents its keynames and the parameters it expects to see.
  118.  
  119.   ALL parameters have safe defaults, so it is never necessary to pass
  120.   unnecessary parameters to an object.
  121.  
  122.   Below are both WPFolder and WPProgram setup string parameters.
  123.   Their various key names, values and a short description follow
  124.   each item. The <<xxx>> item is there to give you an idea of what
  125.   settings "page" you would find this information on.
  126.  
  127. *********************************
  128. ***WPFolder setup string parms***
  129. *********************************
  130. KEYNAME      VALUE           Description
  131. -----------------------------------------------------------------------------
  132. <<View>>
  133. ICONVIEW     NONFLOWED       Set icon view to non-flowed
  134.              FLOWED          Set icon view to flowed
  135.              NOLINES         Set icon view to non-grid
  136. <<File>>
  137. WORKAREA     YES             Make the folder a Workarea folder
  138. <<Window>>
  139. VIEWBUTTON   HIDE            Views of this object will have a hide button
  140.                              as opposed to a minimize button.
  141.              MINIMIZE        Views of this object will have a minimize
  142.                              button as opposed to a hide button.
  143. MINWIN       HIDE            Views of this object will hide when their
  144.                              minimize button is selected.
  145.              VIEWER          Views of this object will minimize to the
  146.                              minimized window viewer when their minimize
  147.                              button is selected.
  148.              DESKTOP         Views of this object will minimize to the
  149.                              Desktop when their minimize button is selected.
  150. CONCURRENTVIEW YES           New views of this object will be created every
  151.                              time the user selects open.
  152.              NO              Open views of this object will resurface when
  153.                              the user selects open.
  154. <<General>>
  155. ICONFILE     filename        This sets the object's icon.
  156. ICONRESOURCE id,module       This sets the object's icon. 'id' is the
  157.                              identity of an icon resource in the 'module'
  158.                              dynamic link library (DLL).
  159. ICONPOS      x,y             This sets the object's initial icon position.
  160.                              The x and y values represent the position in
  161.                              the object's folder in percentage coordinates.
  162. TEMPLATE     YES             Creates object as a template.
  163.              NO              Resets objects template property.
  164. -----------------------------------------------------------------------------
  165.  
  166. **********************************
  167. ***WPProgram setup string parms***
  168. **********************************
  169. KEYNAME      VALUE           Description
  170. -----------------------------------------------------------------------------
  171. <<Program>>
  172. EXENAME      filename        Sets the name of the program
  173. PARAMETERS   params          Sets the parameters list, which may
  174.                              include substitution characters
  175. STARTUPDIR   pathname        Sets the working directory
  176. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  177. <<Sessions>>
  178. PROGTYPE     FULLSCREEN      Sets the session type to OS/2 full screen
  179.              WINDOWABLEVIO   Sets the session type to OS/2 windowed
  180.              VDM             Sets the session type to DOS full screen
  181.              WINDOWEDVDM     Sets the session type to DOS windowed
  182.              PM              Sets the session type to PM
  183.              WIN             Sets the session type to WIN-OS2 Fullscreen
  184.              WINDOWEDWIN     Sets the session type to WIN-OS2 windowed
  185.              SEPARATEWIN     Sets the session type to WIN-OS2 windowed,
  186.                              separate session.
  187. MINIMIZED    YES             Start program minimized
  188. MAXIMIZED    YES             Start program maximized
  189. NOAUTOCLOSE  YES             Leaves the window open upon program termination.
  190.              NO              Closes the window when the program terminates.
  191. -DOS Settings-
  192. (To change these values you use SET keyname=)
  193. (Example:   SET DOS_FILES=45;
  194. (Also for some use values of 1 for ON, 0 for off)
  195. (Example:   SET COM_HOLD=1;     (on, default is off)
  196. List of DOS Setting fields
  197. COM_HOLD
  198. DOS_BACKGROUND_EXECUTION
  199. DOS_BREAK
  200. DOS_DEVICE
  201. DOS_FCBS
  202. DOS_FCBS_KEEP
  203. DOS_FILES
  204. DOS_HIGH
  205. DOS_LASTDRIVE
  206. DOS_RMSIZE
  207. DOS_SHELL
  208. DOS_STARTUP_DRIVE
  209. DOS_UMB
  210. DOS_VERSION
  211. DPMI_DOS_API
  212. DPMI_MEMORY_LIMIT
  213. DPMI_NETWORK_BUFF_SIZE
  214. DPMI_DOS_API
  215. EMS_FRAME_LOCATION
  216. EMS_HIGH_OS_MAP_REGION
  217. EMS_LOW_OS_MAP_REGION
  218. EMS_MEMORY_LIMIT
  219. HW_NOSOUND
  220. HW_ROM_TO_RAM
  221. HW_TIMER
  222. IDLE_SECONDS
  223. IDLE_SENSITIVITY
  224. KBD_ALTHOME_BYPASS
  225. KBD_BUFFER_EXTEND
  226. KBD_RATE_LOCK
  227. MEM_INCLUDE_REGIONS
  228. MEM_EXCLUDE_REGIONS
  229. MOUSE_EXCLUSIVE_ACCESS
  230. PRINT_TIMEOUT
  231. VIDEO_FASTPASTE
  232. VIDEO_MODE_RESTRICTION
  233. VIDEO_ONDEMAND_MEMORY
  234. VIDEO_RETRACE_EMULATION
  235. VIDEO_ROM_EMULATION
  236. VIDEO_SWITCH_NOTIFICATION
  237. VIDEO_WINDOW_REFRESH
  238. VIDEO_8514A_XGA_IOTRAP
  239. XMS_HANDLES
  240. XMS_MEMORY_LIMIT
  241. XMS_MINIMUM_HMA
  242. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  243. <<Association>>
  244. ASSOCFILTER  filters         Sets the filename filter for files
  245.                              associated to this program.
  246.                              Multiple filters are separated by commas.
  247. ASSOCTYPE    type            Sets the type of files associated to this
  248.                              program. Multiple filters are separated
  249.                              by commas.
  250. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  251. <<Window>>
  252. MINWIN       HIDE            Views of this object will hide when their
  253.                              minimize button is selected.
  254.              VIEWER          Views of this object will minimize to the
  255.                              minimized window viewer when their minimize
  256.                              button is selected.
  257.              DESKTOP         Views of this object will minimize to the
  258.                              Desktop when their minimize button is selected.
  259. CONCURRENTVIEW YES           New views of this object will be created every
  260.                              time the user selects open.
  261.              NO              Open views of this object will resurface when
  262.                              the user selects open.
  263. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  264. <<General>>
  265. ICONFILE     filename        This sets the object's icon.
  266. ICONRESOURCE id,module       This sets the object's icon. 'id' is the
  267.                              identity of an icon resource in the 'module'
  268.                              dynamic link library (DLL).
  269. ICONPOS      x,y             This sets the object's initial icon position.
  270.                              The x and y values represent the position in
  271.                              the object's folder in percentage coordinates.
  272. TEMPLATE     YES             Creates object as a template.
  273.              NO              Resets objects template property.
  274. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  275. <<Misc>>
  276. OBJECTID     <name>          This sets the object's identity. The object
  277.                              id will stay with the object even if it is
  278.                              moved or renamed. An object id is any unique
  279.                              string preceded with a '<' and terminated
  280.                              with a '>'.
  281. HELPPANEL    id              This sets the object's default help panel.
  282. HELPLIBRARY  filename        This sets the help library.
  283. OPEN         SETTINGS        Open settings view when object is created.
  284.              DEFAULT         Open default view when object is created.
  285. NODELETE     YES             Will not allow you to delete the object.
  286. NOCOPY       YES             Will not allow you to make a copy.
  287. NOMOVE       YES             Will not allow you to move the object to another
  288.                              folder, will create shadow on a move.
  289. NODRAG       YES             Will not allow you to drag the object.
  290. NOLINK       YES             Will not allow you to create a shadow link.
  291. NOSHADOW     YES             Will not allow you to create a shadow link.
  292. NORENAME     YES             Will not allow you to rename the object.
  293. NOPRINT      YES             Will not allow you to print it.
  294. NOTVISIBLE   YES             Will not display the object.
  295. -----------------------------------------------------------------------------
  296.  
  297. ===============
  298. IMPORTANT NOTE: Always make sure your setup string ends with a semi-colon!
  299. ===============
  300.  
  301. Good Luck....
  302.  
  303. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  304. ((END TEXT INFORMATION))
  305.  
  306. ((BEGIN REXX CMD SAMPLES))
  307.  
  308. - (FOLDER.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  309.  
  310. /* FOLDER.CMD: Sample code using REXXUTIL's SysCreateObject function    */
  311. /* Builds a folder on the DeskTop and places some program objects in it.*/
  312.  
  313. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  314.  
  315. /* Load REXXUTIL */
  316. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  317. call sysloadfuncs
  318.  
  319. /* The basic call is listed next.                                          */
  320. /* result = SysCreateObject(classname, title, location, setup)             */
  321.  
  322. call SysCls
  323. Say '';Say 'Using REXXUTILs to Add a Folder and Program Objects...'
  324.  
  325. Say '';Say 'Press Y to add Test Folder to Desktop...';Say '';
  326. parse upper value SysGetKey('NOECHO') with key
  327. If key<>'Y' Then Exit
  328.  
  329. /* All of the routines pass parameters to a subroutine to perform the call */
  330. classname='WPFolder'
  331. title='Test Folder'
  332. location='<WP_DESKTOP>'
  333. setup='OBJECTID=<TEST_FOLDER>;'
  334. Call BldObj
  335.  
  336. Say '';Say 'Now go and open up the folder, currently no items are there.'
  337. Say 'Press ENTER and we will add a few program objects...'
  338. key=SysGetKey()
  339.  
  340. Say 'Place a program object into the folder...';Say '';
  341. classname='WPProgram'
  342. title='SYSLEVEL-FULLSCR'
  343. location='<TEST_FOLDER>'
  344. setup='PROGTYPE=FULLSCREEN;EXENAME=\OS2\SYSLEVEL.EXE;OBJECTID=<TEST_SYSL>;'
  345. Call BldObj
  346.  
  347. classname='WPProgram'
  348. title='CHKDSK-PM'
  349. location='<TEST_FOLDER>'
  350. setup='MINIMIZED=YES;PROGTYPE=PM;EXENAME=\OS2\PMCHKDSK.EXE;OBJECTID=<TEST_PMCK>;'
  351. Call BldObj
  352.  
  353. classname='WPProgram'
  354. title='SYSLEVEL-VIO'
  355. location='<TEST_FOLDER>'
  356. setup='PROGTYPE=WINDOWABLEVIO;EXENAME=\OS2\SYSLEVEL.EXE;OBJECTID=<TEST_SYSLVIO>;'
  357. Call BldObj
  358.  
  359. classname='WPProgram'
  360. title='MEM-Fullscreen'
  361. location='<TEST_FOLDER>'
  362. setup='PROGTYPE=VDM;EXENAME=\OS2\MDOS\MEM.EXE;PARAMETERS=/?;NOAUTOCLOSE=YES;OBJECTID=<TEST_MEMFUL>;'
  363. Call BldObj
  364.  
  365. classname='WPProgram'
  366. title='MEM-WindowVDM'
  367. location='<TEST_FOLDER>'
  368. setup='PROGTYPE=WINDOWEDVDM;EXENAME=\OS2\MDOS\MEM.EXE;PARAMETERS=/?;NOAUTOCLOSE=YES;OBJECTID=<TEST_MEMWIN>;'
  369. Call BldObj
  370.  
  371. Say '';Say 'All done, to remove objects drag to shredder...'
  372.  
  373. Exit
  374.  
  375. /* Build Object */
  376. BldObj:
  377. call charout ,'Building: 'title
  378.  
  379. result = SysCreateObject(classname, title, location, setup)
  380.  
  381. If result=1 Then call charout ,'...   Object created!'
  382. Else             call charout ,'...   Not created! Return code='result
  383.  
  384. Say '';
  385. Return
  386.  
  387. - (SHADOW.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  388.  
  389. /* SHADOW.CMD: Sample code using REXXUTIL's SysCreateObject function    */
  390. /* Builds shadows on the DeskTop and Startup Folder                     */
  391.  
  392. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  393.  
  394. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  395. call sysloadfuncs
  396.  
  397. Call SysCls
  398. Say '';Say 'Using REXXUTILs to Add Shadow Objects...'
  399.  
  400. /* The titles and objectid's are found from the \OS2\INI.RC file */
  401.  
  402. Say '';Say 'First lets place some items on the Desktop...'
  403. title='Enhanced Editor'; objid='<WP_EPM>'   ; loc='<WP_DESKTOP>'; call AddShad
  404. title='OS/2 Window'    ; objid='<WP_OS2WIN>'; loc='<WP_DESKTOP>'; call AddShad
  405. title='System Clock'   ; objid='<WP_CLOCK>' ; loc='<WP_DESKTOP>'; call AddShad
  406.  
  407. Say '';Say 'Now lets place an item in the Startup Folder...'
  408. title='System Clock'   ; objid='<WP_CLOCK>' ; loc='<WP_START>'  ; call AddShad
  409.  
  410. Say '';Say 'All done, to remove objects drag to shredder...'
  411.  
  412. Exit
  413.  
  414. AddShad:
  415. Say '';Say 'Press Y to add shadow object: 'title' to 'loc
  416. parse upper value SysGetKey('NOECHO') with key
  417. If key='Y' Then Do
  418.  
  419.    result=SysCreateObject('WPShadow', title, loc, 'SHADOWID='objid)
  420.  
  421.    If result=1 Then Say 'Object created'
  422.    Else             Say 'Not created, return code='result
  423. End
  424. Return
  425.  
  426. - (FLDSHAD.CMD)  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  427.  
  428. /* FLDSHAD.CMD: Sample code using REXXUTIL's SysCreateObject function   */
  429. /* Builds a folder on the DeskTop places a program object in it then    */
  430. /* places a shadow of the program object on the DeskTop.                */
  431.  
  432. /* Mike Lamb: MIKELAMB/KGNVMC                                           */
  433.  
  434. /* Load REXXUTIL */
  435. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  436. call sysloadfuncs
  437.  
  438. /* The basic call is listed next.                                          */
  439. /* result = SysCreateObject(classname, title, location, setup)             */
  440.  
  441. call SysCls
  442. Say '';Say 'Using REXXUTILs to Add Folder/Program/Shadow Objects...'
  443.  
  444. Say '';Say 'Press Y to add Test Folder to Desktop...';Say '';
  445. parse upper value SysGetKey('NOECHO') with key
  446. If key<>'Y' Then Exit
  447.  
  448. classname='WPFolder'
  449. title='Test Folder'
  450. location='<WP_DESKTOP>'
  451. setup='OBJECTID=<TEST2_FOLDER>;'
  452. Call BldObj
  453.  
  454. Say '';Say 'Press Y to place a program object into the folder...';Say '';
  455. parse upper value SysGetKey('NOECHO') with key
  456. If key<>'Y' Then Exit
  457.  
  458. classname='WPProgram'
  459. title='SYSLEVEL-VIO'
  460. location='<TEST2_FOLDER>'
  461. setup='PROGTYPE=WINDOWABLEVIO;EXENAME=\OS2\SYSLEVEL.EXE;OBJECTID=<TEST2_SYSLVIO>;'
  462. Call BldObj
  463.  
  464. Say '';Say 'Press Y to place a shadow of the program object on the Desktop...';Say '';
  465. parse upper value SysGetKey('NOECHO') with key
  466. If key<>'Y' Then Exit
  467.  
  468. classname='WPShadow'
  469. title='SYSLEVEL-VIO'
  470. location='<WP_DESKTOP>'
  471. setup='SHADOWID=<TEST2_SYSLVIO>;'
  472. Call BldObj
  473.  
  474. Say '';Say 'All done, to remove objects drag to shredder...'
  475.  
  476. Exit
  477.  
  478. /* Build Object */
  479. BldObj:
  480. call charout ,'Building: 'title
  481.  
  482. result = SysCreateObject(classname, title, location, setup)
  483.  
  484. If result=1 Then call charout ,'...   Object created!'
  485. Else             call charout ,'...   Not created! Return code='result
  486.  
  487. Say '';
  488. Return
  489.  
  490. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  491. ((END REXX CMD SAMPLES))
  492.