home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxhll.zip
/
WPS.REX
< prev
Wrap
OS/2 REXX Batch file
|
1993-08-20
|
3KB
|
120 lines
/* #include <wps.rex> */
/**
*** ┌───────────────────────────────────────────────────────────────────────┐
*** │ This code will manipulate WPS objects │
*** └───────────────────────────────────────────────────────────────────────┘
**/
InitObjectProcedures: procedure expose Obj.
/**
*** This will initialize the global 'Obj.' variable
**/
Obj. = ''
Obj.Location = "<WP_DESKTOP>"
return 0
RunObject: procedure
/* This will open (run) a Workplace Shell object */
arg Object
call SysSetObjectData '<'Object'>', 'OPEN=DEFAULT';
return result
CreateProgramObject: procedure expose Obj.
/**
*** This will create a program in 'Obj.Location'.
**/
parse arg Title, Icon, Pgm, Parameter, WorkDir, SetupParms, ObjectId
if Title = '' then
Title = 'Program'
Setup = ''
if Icon <> '' then
Setup = Setup';ICONFILE='Icon
if Pgm = '' then
Setup = Setup';EXENAME=*'
else
Setup = Setup';EXENAME='Pgm
if Parameter <> '' then
Setup = Setup';PARAMETERS='Parameter
if WorkDir <> '' then
Setup = Setup';STARTUPDIR='WorkDir
if SetupParms <> '' then
Setup = Setup';'SetupParms
if ObjectId = '' then
do
/* Generate an object ID */
ObjectId = "UWP_PROGRAM"right(Obj.Id, 4, '0')
Obj.Id = Obj.Id + 1
end
else
do
ObjectId = strip(ObjectId, 'Trailing','>')
ObjectId = strip(ObjectId, 'Leading' ,'<')
end
Setup = Setup';OBJECTID=<'ObjectId'>'
Setup = strip(Setup, 'Leading', ';')
Code = SysCreateObject("WPProgram",Title,Obj.Location,Setup,"FailIfExists")
return Code
CreateFolderObject: procedure expose Obj.
/**
*** This will create a folder in 'Obj.Location' and will change the
*** current object's location to this folder.
**/
parse arg Title, Icon, SetupParms, ObjectId
/* Convert the parameters into a format compatible with SysCreateObject */
if Title = '' then
Title = 'Folder'
Setup = ''
if Icon <> '' then
Setup = Setup';ICONFILE='Icon
if SetupParms <> '' then
Setup = Setup';'SetupParms
if ObjectId = '' then
do
/* Generate an object ID */
ObjectId = "UWP_FOLDER"right(Obj.Id, 4, '0')
Obj.Id = Obj.Id + 1
end
else
do
ObjectId = strip(ObjectId, 'Trailing','>')
ObjectId = strip(ObjectId, 'Leading' ,'<')
end
Setup = Setup';OBJECTID=<'ObjectId'>'
Setup = strip(Setup, 'Leading', ';')
Code = SysCreateObject("WPFolder",Title,Obj.Location,Setup,"FailIfExists")
if Code = 0 then
say "Error: Create of '"Title"' failed."
Obj.Location = '<'ObjectId'>'
return Code