Start a program with specific settings

[Autolink] Menu

Create a temporary object to start a program (DOS, Windows, or OS/2) with specific settings. Example:

 
/* example code to start the Program Manager as seamless windows      */
/* program in a common session                                        */

  call rxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  call SysLoadFuncs

                        /* ID for the temporary object                */
  objectID = '<MY_TEMP_OBJECT>'

  title = 'Program^Manager'
  class = 'WPProgram'
  location = '<WP_NOWHERE>'
  setup = 'EXENAME=F:\WINDOWS\PROGMAN.EXE;' || ,
          'PROGTYPE=PROG_31_ENHSEAMLESSCOMMON;' || ,
          'OBJECTID=' || objectID || ';'

                        /* create the temporary object                */
  say SysCreateObject( class, title, location, setup )

                        /* open the temporary object                  */
  say SysSetObjectData( objectID, 'OPEN=DEFAULT;' )

                        /* bring it into the foreground               */
  say SysSetObjectData( objectID, 'OPEN=DEFAULT;' )

                        /* destroy the temporary object               */
  say SysDestroyObject( objectID )
exit

This method is possible in all OS/2 versions. Beginning with OS/2 WARP 4 you can use another method to start a DOS or Windows program with specific settings:
Just set environment variables in the format DOSSetting.{dossetting} and issue a start command. {dossetting} can be any setup string that can be used in the setup string used to create or change a WPS Object for DOS sessions.
For example, to start a DOS session with a specific AUTOEXEC.BAT file use the following code:

 
REM *** OS/2 Batch (works also in REXX programs)
REM

REM The DOS sessions should use the file C:\TEST.BAT
REM as AUTOEXEC.BAT.
REM The name of the environment variables seems not to be case
REM sensitive.
REM
set DOSSetting.DOS_AUTOEXEC=C:\TEST.BAT

REM Now use the start command to start the DOS session
REM
start /dos


[Back: Closing a WPS folder]
[Next: Save the Desktop]