home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
REXUTIL.ZIP
/
REXUTIL.CMD
Wrap
OS/2 REXX Batch file
|
1992-11-10
|
34KB
|
1,117 lines
/*
* Filename: REXUTIL.CMD
*
* Author: Steve Cersosimo
*
* Date: 11-4-92
*
* Purpose: To allow some of the
* REXX functions to be
* controled from the WPS.
*/
/*
* This section will load all of the
* available REXXUTIL functions
*/
Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SYSLOADFUNCS'
ret=SysLoadFuncs()
/*
* This section is necessary in all scripts
* that will be calling any VREXX functions.
* If there are any errors in the REXX script the
* CLEANUP function will close all VREXX libraries.
*/
call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
initcode = VInit()
if initcode = 'ERROR' then signal CLEANUP
signal on failure name CLEANUP
signal on halt name CLEANUP
signal on syntax name CLEANUP
/*
* This is the list of items that will be passed
* to the VRadioBox function. It could also be
* passed to many other VREXX functions.
*/
desc.0 = 10
desc.1 = 'Set icon for a WPS Object '
desc.2 = 'Create a new Association Type '
desc.3 = 'Delete existing Association Type '
desc.4 = 'List existing Association types '
desc.5 = 'List System Supplied Objects '
desc.6 = 'Recreate System Supplied Objects '
desc.7 = 'List installed Fonts '
desc.8 = 'Display Bitmap '
desc.9 = 'Set files to a certain Association Type '
desc.10 = 'Set icon for a group of files '
/*
* Now we initiate a variable to be passed to the VRadioBox
* function. The value 3 will force an OK and CANCEL button
* to appear. The value of the variable after the function
* call will be that of the button pressed.
*/
main:
/*
* This will force all Message Box windows created in this
* script to be centered in the screen
*/
call VDialogPos 50, 50
button = 3
button = VRadioBox('Select function', desc, button)
/*
* Now lets check the results
* of the button and either
* continue or quit.
*/
if button = 'OK' then do
if desc.vstring = desc.1 then
call SetObj
else if desc.vstring = desc.2 then
call NewAss
else if desc.vstring = desc.3 then
call DelAss
else if desc.vstring = desc.4 then
call LisTAss
else if desc.vstring = desc.5 then
call ListSso
else if desc.vstring = desc.6 then
call RecSso
else if desc.vstring = desc.7 then
call ListFon
else if desc.vstring = desc.8 then
call DispBit
else if desc.vstring = desc.9 then
call SetAss
else if desc.vstring = desc.10 then
call SetIco
signal main
end
/*
* Now we are finished. We can close all VREXX functions
* and exit the REXX script.
*/
CLEANUP:
call VExit
exit
/*
*SUBROUTINES
*/
SetObjList:
objk.1 ='ACTLST'; objd.1 ='Activities List'
objk.2 ='ALARMS'; objd.2 ='Alarms'
objk.3 ='CALC'; objd.3 ='Calculator'
objk.4 ='CALEN'; objd.4 ='Calendar'
objk.5 ='CAT'; objd.5 ='Cat and Mouse'
objk.6 ='CLIPV'; objd.6 ='Clipboard Viewer'
objk.7 ='COLOR'; objd.7 ='Color Palette'
objk.8 ='CMD'; objd.8 ='Command Prompts'
objk.9 ='CMDREF'; objd.9 ='Command Reference'
objk.10='CNTRY'; objd.10='Country'
objk.11='DAILY'; objd.11='Daily Planner'
objk.12='DATAUP'; objd.12='Data Update'
objk.13='DBASE'; objd.13='Database'
objk.14='DDINST'; objd.14='Device Driver Install'
objk.15='DOSA'; objd.15='DOS from Drive A:'
objk.16='DOSFS'; objd.16='DOS Full Screen'
objk.17='DOSWIN'; objd.17='DOS Window'
objk.18='DRIVES'; objd.18='Drives'
objk.19='DUAL'; objd.19='Dual Boot'
objk.20='EEDIT'; objd.20='Enhanced Editor'
objk.21='FONT'; objd.21='Font Palette'
objk.22='GAMES'; objd.22='Games'
objk.23='GLOSS'; objd.23='Glossary'
objk.24='ICONED'; objd.24='Icon Editor'
objk.25='INFO'; objd.25='Information'
objk.26='JIGSAW'; objd.26='Jigsaw'
objk.27='KEYB'; objd.27='Keyboard'
objk.28='MASTER'; objd.28='Master Help Index'
objk.29='MIG'; objd.29='Migrate Applications'
objk.30='MINWIN'; objd.30='Minimized^Window Viewer'
objk.31='MONTHL'; objd.31='Monthly Planner'
objk.32='MOUSE'; objd.32='Mouse'
objk.33='NOTEPD'; objd.33='Notepad'
objk.34='CHESS'; objd.34='OS/2 Chess'
objk.35='OS2FS'; objd.35='OS/2 Full Screen'
objk.36='SYSED'; objd.36='OS/2 System Editor'
objk.37='OS2SYS'; objd.37='OS/2 System'
objk.38='OS2WIN'; objd.38='OS/2 Window'
objk.39='PICV'; objd.39='Picture Viewer'
objk.40='PLANAR'; objd.40='Planner Archive'
objk.41='PMCHRT'; objd.41='PM Chart'
objk.42='PMTERM'; objd.42='PM Terminal'
objk.43='PROD'; objd.43='Productivity'
objk.44='PULSE'; objd.44='Pulse'
objk.45='README'; objd.45='ReadMe File'
objk.46='REVERS'; objd.46='Reversi'
objk.47='REXX'; objd.47='REXX Information'
objk.48='SCHEME'; objd.48='Scheme Palette'
objk.49='SCRAMB'; objd.49='Scramble'
objk.50='SEEK'; objd.50='Seek and Scan Files'
objk.51='SELINS'; objd.51='Selective Install'
objk.52='SOLIT'; objd.52='Solitaire'
objk.53='SOUND'; objd.53='Sound'
objk.54='SPOOL'; objd.54='Spooler'
objk.55='SPREAD'; objd.55='Spreadsheet'
objk.56='SHERE'; objd.56='Start Here'
objk.57='SUP'; objd.57='Startup'
objk.58='STICKY'; objd.58='Sticky Pad'
objk.59='CLOCK'; objd.59='System Clock'
objk.60='SYSSET'; objd.60='System Setup'
objk.61='SYSTEM'; objd.61='System'
objk.62='TEMPLA'; objd.62='Templates'
objk.63='TODOAR'; objd.63='To-Do List Archive'
objk.64='TODO'; objd.64='To-Do List'
objk.65='TUNEED'; objd.65='Tune Editor'
objk.66='TUTOR'; objd.66='Tutorial'
objk.67='WINFS'; objd.67='Win-OS/2 Full Screen'
objk.0=67; objd.0=67
Return
/*
* Set icon for a WPS Object
*/
SetObj:
prompt.0 = 2 /* 2 prompt lines */
prompt.1 = 'Object'
prompt.2 = 'Icon File'
width.0 = 2
width.1 = 30 /* widths in character units */
width.2 = 30 /* for both entryfields */
hide.0 = 2
hide.1 = 0 /* echo input */
hide.2 = 0 /* echo input */
answer.0 = 2
answer.1 = '' /* these are the default strings */
answer.2 = '' /* which will contain the input */
button = VMultBox('Set icon for a WPS Object', prompt, width, hide, answer, 3)
do i = 1 to answer.0
call strip(answer.i)
end
if button = 'OK' then do
If answer.1='' | answer.2='' Then Do
msg.0 = 3
msg.1 = 'You must supply both the Object and the Icon file.'
msg.2 = 'One or both of the parameters was missing.'
msg.3 = 'Press OK to continue...'
call VMsgBox 'Set icon for a WPS Object', msg, 1
end
else do
answer.1=Translate(answer.1) /* upper case */
object='<'||answer.1||'>'
retc=SysSetObjectData(object,'ICONFILE='answer.2)
msg.0 = 4
msg.1 = 'Associating the WPS object 'object
msg.2 = 'with the icon file 'answer.2'...'
If retc=1 Then
msg.3 = ' SUCCESS.'
Else
msg.3 = ' FAILURE.'
msg.4 = 'Press OK to continue...'
call VMsgBox 'Set icon for a WPS Object...', msg, 1
end
end
return
/*
* Create a new Association Type
*/
NewAss:
prompt.0 = 1 /* 1 prompt line */
prompt.1 = 'Add Association Type'
width.0 = 1
width.1 = 30 /* widths in character units */
hide.0 = 1
hide.1 = 0 /* echo input */
answer.0 = 1
answer.1 = '' /* default string */
button = VMultBox('Add Association Type...', prompt, width, hide, answer, 3)
if button = 'OK' then do
call strip(answer.i)
If answer.1='' Then Do
msg.0 = 2
msg.1 = 'No Association Type specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Add Association Type...', msg, 1
end
else do
retc=SysIni('USER', 'PMWP_ASSOC_TYPE' ,answer.1,' ')
msg.0 = 3
msg.1 = 'Adding the Association Type 'answer.1'...'
If LEFT(retc,6)\='ERROR:' Then
msg.2 = ' SUCCESS.'
Else
msg.2 = ' FAILURE.'
msg.3 = 'Press OK to continue...'
call VMsgBox 'Add Association Type...', msg, 1
end
end
return
/*
* Delete existing Association Type
*/
DelAss:
Call SysIni 'USER', 'PMWP_ASSOC_TYPE', 'ALL:', 'ikeys'
inc = 0
deleted = 0
ass_tot = ikeys.0
del_tot = 0
go:
if ass_tot > 10 then do
temp.0 = 10
a = inc + 1; temp.1 = ikeys.a
b = inc + 2; temp.2 = ikeys.b
c = inc + 3; temp.3 = ikeys.c
d = inc + 4; temp.4 = ikeys.d
e = inc + 5; temp.5 = ikeys.e
f = inc + 6; temp.6 = ikeys.f
g = inc + 7; temp.7 = ikeys.g
h = inc + 8; temp.8 = ikeys.h
i = inc + 9; temp.9 = ikeys.i
j = inc + 10; temp.10 = ikeys.j
call VCheckBox 'Select Associaion type(s) to delete...', temp, sel, 1
ass_tot = ass_tot - 10
inc = inc + 10
del_tot = del_tot + sel.0
if sel.0 > 0 then do
do i = 1 to sel.0
z = (del_tot + 1) - i
delem.z = sel.i
end
end
signal go
end
if ass_tot > 0 then do
temp.0 = ass_tot
a = inc + 1; temp.1 = ikeys.a
b = inc + 2; temp.2 = ikeys.b
c = inc + 3; temp.3 = ikeys.c
d = inc + 4; temp.4 = ikeys.d
e = inc + 5; temp.5 = ikeys.e
f = inc + 6; temp.6 = ikeys.f
g = inc + 7; temp.7 = ikeys.g
h = inc + 8; temp.8 = ikeys.h
i = inc + 9; temp.9 = ikeys.i
j = inc + 10; temp.10 = ikeys.j
call VCheckBox 'Select Associaion type(s) to delete...', temp, sel, 1
del_tot = del_tot + sel.0
if sel.0 > 0 then do
do i = 1 to sel.0
z = (del_tot + 1) - i
delem.z = sel.i
end
end
end
delem.0 = del_tot
if delem.0 > 0 then do
if delem.0 > 10 then do
msg.0 = 4
msg.1 = 'You have selected 'delem.0' associations to delete.'
msg.2 = 'The maximum number to delete at one time is 10.'
msg.3 = 'Operation canceled.'
msg.4 = 'Press OK to continue...'
call VMsgBox 'Delete Association Type...', msg, 1
return
end
else do
button = 3
button = VMsgBox('Selected Association(s) to DELETE...', delem, button)
if button = 'OK' then do
do i = 1 to delem.0
retc=SysIni('USER', 'PMWP_ASSOC_TYPE' ,delem.i,'DELETE:')
If LEFT(retc,6) = 'ERROR:' Then do
msg.0 = 3
msg.1 = 'ERROR Deleteing the Association Type 'delem.i'...'
msg.2 = delem.i' has NOT been deleted.'
msg.3 = 'Press OK to continue...'
call VMsgBox 'Deleted Association Type(s)...', msg, 1
return
end
else do
deleted = deleted + 1
suc_del.deleted = delem.i
end
end
suc_del.0 = deleted
call VMsgBox 'Deleted Association Type(s)...', suc_del, 1
return
end
else do
msg.0 = 2
msg.1 = 'Delete Association Type Cancelled.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Delete Association Type...', msg, 1
return
end
end
end
else do
msg.0 = 2
msg.1 = 'No Association Type specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Delete Association Type...', msg, 1
return
end
/*
* List existing Association types
*/
LisTAss:
Call SysIni 'USER', 'PMWP_ASSOC_TYPE', 'ALL:', 'ikeys'
inc = 0
ass_tot = ikeys.0
list_types_go:
if ass_tot > 10 then do
temp.0 = 10
a = inc + 1; temp.1 = ikeys.a
b = inc + 2; temp.2 = ikeys.b
c = inc + 3; temp.3 = ikeys.c
d = inc + 4; temp.4 = ikeys.d
e = inc + 5; temp.5 = ikeys.e
f = inc + 6; temp.6 = ikeys.f
g = inc + 7; temp.7 = ikeys.g
h = inc + 8; temp.8 = ikeys.h
i = inc + 9; temp.9 = ikeys.i
j = inc + 10; temp.10 = ikeys.j
call VMsgBox 'Associaion types... ( OK for MORE)', temp, 1
ass_tot = ass_tot - 10
inc = inc + 10
signal list_types_go
end
if ass_tot > 0 then do
temp.0 = ass_tot
a = inc + 1; temp.1 = ikeys.a
b = inc + 2; temp.2 = ikeys.b
c = inc + 3; temp.3 = ikeys.c
d = inc + 4; temp.4 = ikeys.d
e = inc + 5; temp.5 = ikeys.e
f = inc + 6; temp.6 = ikeys.f
g = inc + 7; temp.7 = ikeys.g
h = inc + 8; temp.8 = ikeys.h
i = inc + 9; temp.9 = ikeys.i
j = inc + 10; temp.10 = ikeys.j
call VMsgBox 'Associaion types...', temp, 1
end
return
/*
* List System Supplied Objects
*/
ListSso:
pos.top = 85
pos.bottom = 25
pos.left = 20
pos.right = 80
color = 'WHITE'
x = 50
y = 950
Call SetObjList
lso_id = VOpenWindow('System Supplied Objects...', color, pos)
call VSay lso_id, 37, y, ' KeyWord Object Title KeyWord Object Title'
y = y - 25
Do i=1 to (objk.0 /2)
k=i*2
n=i*2-1
call VSay lso_id, x, y, substr(objk.n,1,7)'- 'substr(objd.n,1,25) substr(objk.k,1,6) '- 'objd.k
y = y - 25
end
n=objk.0
If ((objk.0/2)-TRUNC(objk.0/2))\=0 Then
call VSay lso_id, x, y, substr(objk.n,1,6) '- 'substr(objd.n,1,25)
call VDialogPos 50, 10
msg.0 = 2
msg.1 = 'Press OK to close the'
msg.2 = 'System Supplied Objects window.'
call VMsgBox 'System Supplied Objects...', msg, 1
call VCloseWindow lso_id
return
/*
* Recreate System Supplied Objects
*/
RecSso:
prompt.0 = 1 /* 1 prompt line */
prompt.1 = 'System Object to Recreate '
width.0 = 1
width.1 = 10 /* widths in character units */
hide.0 = 1
hide.1 = 0 /* echo input */
answer.0 = 1
answer.1 = '' /* default string */
button = VMultBox('Create a System Supplied Object...', prompt, width, hide, answer, 3)
if button = 'OK' then do
call strip(answer.i)
If answer.1='' Then Do
msg.0 = 2
msg.1 = 'No System Object specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Create a System Supplied Object...', msg, 1
end
else do
pos.top = 60
pos.bottom = 40
pos.left = 9
pos.right = 35
color = 'WHITE'
cso_id = VOpenWindow('Create System Object...', color, pos)
call VSay cso_id, 35, 800, 'creating Object List...'
Call SetObjList
call VSay cso_id, 35, 600, 'Now searching Object List...'
/* find keyword specified by answer.1 in the objlist */
targttl=''
answer.1=Translate(answer.1) /* upper case */
Do i=1 to objk.0
If answer.1=objk.i Then Do
targttl=objd.i
Leave
End /* match */
End /* search */
If targttl='' Then Do
call VCloseWindow cso_id
msg.0 = 3
msg.1 = answer.1' is an invalid keyword.'
msg.2 = 'Issue "List System Supplied Objects" for valid keywords.'
msg.3 = 'Press OK to continue.'
call VMsgBox 'Create a System Supplied Object...', msg, 1
return
End
/* Find title specified in INI.RC */
call VSay cso_id, 35, 400, 'Now parsing INI.RC file...'
BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))
rcfile=BtDrv'\OS2\INI.RC'
objnam=''
Do While lines(rcfile)
rcline=linein(rcfile)
parse var rcline '"'iv1'"' '"'iv2'"' '"'objset'"'
If iv1='PM_InstallObject' Then Do
parse var iv2 sss';'ttt';'yyy
If sss=targttl Then Do
objnam=sss; objcls=ttt; objloc=yyy
Leave
End /* match */
End /* installobject */
End /* do while */
call stream rcfile, 'c', 'close'
If objnam='' Then Do
call VCloseWindow cso_id
msg.0 = 4
msg.1 = 'Internal program error. The object title:'targttl' could not be found'
msg.2 = 'in the INI.RC file. Please contact the author so that the program''s internal'
msg.3 = 'table can be corrected. Thank you.'
msg.4 = 'Press OK to continue.'
call VMsgBox 'Create a System Supplied Object...', msg, 1
return
End
call VCloseWindow cso_id
opt.0 = 2
opt.1 = 'Create the object in it''s ORIGINAL location '
opt.2 = 'Create the object on the DESKTOP '
button = 3
button = VRadioBox('Select function', opt, button)
if button = 'OK' then do
If opt.vstring = 'Create the object on the DESKTOP ' Then
objloc='<WP_DESKTOP>'
msg.0 = 3
msg.1 = 'Creating the ['answer.1'] System Supplied Object...'
retc = SysCreateObject(objcls,objnam,objloc,objset,'U')
If retc=1 Then
msg.2 = ' SUCCESS.'
Else
msg.2 = ' FAILURE.'
msg.3 = 'Press OK to continue...'
call VMsgBox 'Create a System Supplied Object...', msg, 1
end
end
end
else
call Canceled
return
/*
* List installed Fonts
*/
ListFon:
Call SysIni 'USER', 'PM_Fonts', 'ALL:', 'ikeys'
font_inc = 0
font_total = ikeys.0
adobe = ' (Adobe Type 1)'
Fonts_go:
if font_total > 10 then do
temp.0 = 10
a = font_inc + 1
If pos('.AFM',ikeys.a) > 0 Then do
aa = ikeys.a
bb = adobe
temp.1 = aa||bb
end
else
temp.1 = ikeys.a
b = font_inc + 2
If pos('.AFM',ikeys.b) > 0 Then do
aa = ikeys.b
bb = adobe
temp.2 = aa||bb
end
else
temp.2 = ikeys.b
c = font_inc + 3
If pos('.AFM',ikeys.c) > 0 Then do
aa = ikeys.b
bb = adobe
temp.3 = aa||bb
end
else
temp.3 = ikeys.c
d = font_inc + 4
If pos('.AFM',ikeys.d) > 0 Then do
aa = ikeys.d
bb = adobe
temp.4 = aa||bb
end
else
temp.4 = ikeys.d
e = font_inc + 5
If pos('.AFM',ikeys.e) > 0 Then do
aa = ikeys.e
bb = adobe
temp.5 = aa||bb
end
else
temp.5 = ikeys.e
f = font_inc + 6
If pos('.AFM',ikeys.f) > 0 Then do
aa = ikeys.f
bb = adobe
temp.6 = aa||bb
end
else
temp.6 = ikeys.f
g = font_inc + 7
If pos('.AFM',ikeys.g) > 0 Then do
aa = ikeys.g
bb = adobe
temp.7 = aa||bb
end
else
temp.7 = ikeys.g
h = font_inc + 8
If pos('.AFM',ikeys.h) > 0 Then do
aa = ikeys.h
bb = adobe
temp.8 = aa||bb
end
else
temp.8 = ikeys.h
i = font_inc + 9
If pos('.AFM',ikeys.i) > 0 Then do
aa = ikeys.i
bb = adobe
temp.9 = aa||bb
end
else
temp.9 = ikeys.i
j = font_inc + 10
If pos('.AFM',ikeys.j) > 0 Then do
aa = ikeys.j
bb = adobe
temp.10 = aa||bb
end
else
temp.10 = ikeys.j
call VMsgBox 'Installed Fonts... ( OK for MORE)', temp, 1
font_total = font_total - 10
font_inc = font_inc + 10
signal Fonts_go
end
if font_total > 0 then do
temp.0 = font_total
a = font_inc + 1
If pos('.AFM',ikeys.a) > 0 Then do
aa = ikeys.a
bb = adobe
temp.1 = aa||bb
end
else
temp.1 = ikeys.a
b = font_inc + 2
If pos('.AFM',ikeys.b) > 0 Then do
aa = ikeys.b
bb = adobe
temp.2 = aa||bb
end
else
temp.2 = ikeys.b
c = font_inc + 3
If pos('.AFM',ikeys.c) > 0 Then do
aa = ikeys.b
bb = adobe
temp.3 = aa||bb
end
else
temp.3 = ikeys.c
d = font_inc + 4
If pos('.AFM',ikeys.d) > 0 Then do
aa = ikeys.d
bb = adobe
temp.4 = aa||bb
end
else
temp.4 = ikeys.d
e = font_inc + 5
If pos('.AFM',ikeys.e) > 0 Then do
aa = ikeys.e
bb = adobe
temp.5 = aa||bb
end
else
temp.5 = ikeys.e
f = font_inc + 6
If pos('.AFM',ikeys.f) > 0 Then do
aa = ikeys.f
bb = adobe
temp.6 = aa||bb
end
else
temp.6 = ikeys.f
g = font_inc + 7
If pos('.AFM',ikeys.g) > 0 Then do
aa = ikeys.g
bb = adobe
temp.7 = aa||bb
end
else
temp.7 = ikeys.g
h = font_inc + 8
If pos('.AFM',ikeys.h) > 0 Then do
aa = ikeys.h
bb = adobe
temp.8 = aa||bb
end
else
temp.8 = ikeys.h
i = font_inc + 9
If pos('.AFM',ikeys.i) > 0 Then do
aa = ikeys.i
bb = adobe
temp.9 = aa||bb
end
else
temp.9 = ikeys.i
j = font_inc + 10
If pos('.AFM',ikeys.j) > 0 Then do
aa = ikeys.j
bb = adobe
temp.10 = aa||bb
end
else
temp.10 = ikeys.j
call VMsgBox 'Installed Fonts... (total 'ikeys.0')', temp, 1
end
return
/*
* Display Bitmap
*/
DispBit:
prompt.0 = 1 /* 1 prompt line */
prompt.1 = 'Bitmap file to view '
width.0 = 1
width.1 = 35 /* widths in character units */
hide.0 = 1
hide.1 = 0 /* echo input */
answer.0 = 1
answer.1 = '' /* default string */
button = VMultBox('Bitmap Viewer...', prompt, width, hide, answer, 3)
if button = 'OK' then do
call strip(answer.i)
If answer.1='' Then Do
msg.0 = 2
msg.1 = 'No file specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Bitmap Viewer...', msg, 1
end
drvspec=DIRECTORY() /* Get current drive and subdir */
Parse value drvspec with wdrv':'wdir
wdrv=wdrv':' /* add trailing colon */
tdrv=FILESPEC("drive",answer.1) /* Get drive specified */
tdir=FILESPEC("path",answer.1) /* Get path specified */
tnam=FILESPEC("name",answer.1) /* Get name specified */
If tdrv='' Then tdrv=wdrv /* if no drive, assume current */
If tdir='' Then tdir=wdir /* if no subdir, assume current */
If RIGHT(tdir,1)\='\' Then tdir=tdir'\' /* ensure trailing backslash */
wbmp=tdrv||tdir||tnam /* compose filespec */
If STREAM(wbmp,'C','QUERY EXISTS')='' Then Do
msg.0 = 2
msg.1 = 'The file 'wbmp' could not be found.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Bitmap Viewer...', msg, 1
return
End
wpclassname='WPFolder'
wptitle='Bitmap Viewer'
wplocation='<WP_DESKTOP>'
wpobject='<BMP_VIEWER>'
wpsetup='OBJECTID='wpobject';BACKGROUND='wbmp
opt.0 = 2
opt.1 = 'View the file in a folder called Bitmap Viewer '
opt.2 = 'View the file on the DESKTOP '
button = 3
button = VRadioBox('Select function', opt, button)
if button = 'OK' then
If opt.vstring = 'View the file on the DESKTOP ' Then do
wpobject=wplocation
dest = 'on the desktop.'
end
else
dest='in a folder called Bitmap Viewer.'
else do
call Canceled
return
end
retc=SysSetObjectData(wpobject,'BACKGROUND='wbmp)
If retc=0 Then Do
retc=SysCreateObject(wpclassname,wptitle,wplocation,wpsetup,'U')
retc=SysSetObjectData(wpobject,'BACKGROUND='wbmp)
End /* if /d */
If retc=1 then do
msg.0 = 3
msg.1 = 'The file 'wbmp
msg.2 = 'Has been sucessfully displayed 'dest
msg.4 = 'Press OK to continue...'
call VMsgBox 'Bitmap Viewer...', msg, 1
end
Else do
msg.0 = 2
msg.1 = 'The file 'wbmp' has NOT been sucessfully displayed.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Bitmap Viewer...', msg, 1
end
end
return
/*
* Set files to a certain Association Type
*/
SetAss:
go_ahead = 0
success = 0
failure = 0
Call SysIni 'USER', 'PMWP_ASSOC_TYPE', 'ALL:', 'ikeys'
prompt.0 = 2
prompt.1 = 'Files to set (full pathname) '
prompt.2 = 'Association '
width.0 = 2
width.1 = 35
width.2 = 35
hide.0 = 2
hide.1 = 0
hide.1 = 0
answer.0 = 2
answer.1 = ''
answer.2 = ''
button = 3
button = VMultBox('Set Association (WILDCARDS OK)...', prompt, width, hide, answer, 3)
if button = 'OK' then do
do i = 1 to answer.0
call strip(answer.i)
end
If answer.1='' Then Do
msg.0 = 2
msg.1 = 'No files specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Set Association...', msg, 1
return
end
If answer.2 = '' Then Do
msg.0 = 2
msg.1 = 'No Association specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Set Association...', msg, 1
return
end
do i = 1 to ikeys.0
if answer.2 = ikeys.i then
go_ahead = 1
end
if go_ahead \= 1 then do
msg.0 = 4
msg.1 = 'The Assosiation type you selected "'answer.2'"'
msg.2 = 'does NOT exist. The requested operation'
msg.3 = 'HAS BEEN CANCELED.'
msg.4 = 'Press OK to continue...'
call VMsgBox 'Set Association...', msg, 1
return
end
do_tree.0 = 2
do_tree.1 = 'ALL SUBDIRECTORIES '
do_tree.2 = 'SELECTED DIRECTORY ONLY '
button = 3
button = VRadioBox('Select function', do_tree, button)
if button = 'OK' then do
if do_tree.vstring = do_tree.1 then
asscopt='FS'
else
asscopt='F'
call Working
If ifspec.0 > 0 Then Do
typeconst="DFFF00000100FDFF"x||d2c(length(answer.2))||'00'x||answer.2
Do i=1 TO ifspec.0
ifspec.i=WORD(ifspec.i,5)
rez=SysPutEa(ifspec.i,'.TYPE',typeconst)
If rez=0 Then do
success = success + 1
good.i = ifspec.i
end
Else do
failure = failure + 1
bad.i = ifspec.i
end
end
call VCloseWindow win_id
call Results
return
end
else do
call VCloseWindow win_id
msg.0 = 2
msg.1 = 'No files found matching 'answer.1
msg.2 = 'Press OK to continue...'
call VMsgBox 'Set Association...', msg, 1
return
end
end
else
call Canceled
end
else
call Canceled
Return
/*
*Set icon for a group of files
*/
SetIco:
success = 0
failure = 0
prompt.0 = 2
prompt.1 = 'Files to set (full pathname) '
prompt.2 = 'Icon '
width.0 = 2
width.1 = 35
width.2 = 35
hide.0 = 2
hide.1 = 0
hide.1 = 0
answer.0 = 2
answer.1 = ''
answer.2 = ''
button = 3
button = VMultBox('Set Icon (WILDCARDS OK)...', prompt, width, hide, answer, 3)
if button = 'OK' then do
do i = 1 to answer.0
call strip(answer.i)
end
If answer.1='' Then Do
msg.0 = 2
msg.1 = 'No files specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Set Icon...', msg, 1
return
end
If answer.2 = '' Then Do
msg.0 = 2
msg.1 = 'No Icon specified.'
msg.2 = 'Press OK to continue...'
call VMsgBox 'Set Icon...', msg, 1
return
end
do_tree.0 = 2
do_tree.1 = 'ALL SUBDIRECTORIES '
do_tree.2 = 'SELECTED DIRECTORY ONLY '
button = 3
button = VRadioBox('Select function', do_tree, button)
if button = 'OK' then do
if do_tree.vstring = do_tree.1 then
asscopt='FS'
else
asscopt='F'
If stream(answer.2,'c','query exists')='' Then Do
msg.0 = 3
msg.1 = 'The Icon file "'answer.2'"'
msg.2 = 'Does not exist.'
msg.3 = 'Press OK to continue...'
call VMsgBox 'Set Icon...', msg, 1
return
end
call Working
Call SysFileTree answer.1,'ifspec',asscopt
If ifspec.0 > 0 Then Do
do i = 1 TO ifspec.0
ifspec.i = WORD(ifspec.i,5)
rez = SysSetIcon(ifspec.i,answer.2)
If rez = 1 Then do
success = success + 1
good.i = ifspec.i
end
Else do
failure = failure + 1
bad.i = ifspec.i
end
end
call VCloseWindow win_id
call Results
return
end
else do
call VCloseWindow win_id
msg.0 = 2
msg.1 = 'No files found matching 'answer.1
msg.2 = 'Press OK to continue...'
call VMsgBox 'Set Association...', msg, 1
return
end
end
else
call Canceled
end
else
call Canceled
Return
/*
* Working Window
*/
Working:
pos.top = 55
pos.bottom = 45
pos.left = 40
pos.right = 60
color = 'WHITE'
x = 50
y = 700
win_id = VOpenWindow('Working...', color, pos)
call VSay win_id, x, y, 'Processing files...'
y = y - 425
call VSay win_id, x, y, 'Please Wait...'
Call SysFileTree answer.1,'ifspec',asscopt
return
/*
* Results
*/
Results:
good.0 = success
good_inc = 0
good_total = good.0
good_go:
if good_total > 10 then do
temp.0 = 10
a = good_inc + 1; temp.1 = good.a
b = good_inc + 2; temp.2 = good.b
c = good_inc + 3; temp.3 = good.c
d = good_inc + 4; temp.4 = good.d
e = good_inc + 5; temp.5 = good.e
f = good_inc + 6; temp.6 = good.f
g = good_inc + 7; temp.7 = good.g
h = good_inc + 8; temp.8 = good.h
i = good_inc + 9; temp.9 = good.i
j = good_inc + 10; temp.10 = good.j
call VMsgBox 'Successful Associations... (OK for MORE)', temp, 1
good_total = good_total - 10
good_inc = good_inc + 10
signal good_go
end
if good_total > 0 then do
temp.0 = good_total
a = good_inc + 1; temp.1 = good.a
b = good_inc + 2; temp.2 = good.b
c = good_inc + 3; temp.3 = good.c
d = good_inc + 4; temp.4 = good.d
e = good_inc + 5; temp.5 = good.e
f = good_inc + 6; temp.6 = good.f
g = good_inc + 7; temp.7 = good.g
h = good_inc + 8; temp.8 = good.h
i = good_inc + 9; temp.9 = good.i
j = good_inc + 10; temp.10 = good.j
call VMsgBox 'Successful Associations...', temp, 1
end
bad.0 = failure
bad_inc = 0
bad_total = bad.0
bad_go:
if bad_total > 10 then do
temp.0 = 10
a = bad_inc + 1; temp.1 = bad.a
b = bad_inc + 2; temp.2 = bad.b
c = bad_inc + 3; temp.3 = bad.c
d = bad_inc + 4; temp.4 = bad.d
e = bad_inc + 5; temp.5 = bad.e
f = bad_inc + 6; temp.6 = bad.f
g = bad_inc + 7; temp.7 = bad.g
h = bad_inc + 8; temp.8 = bad.h
i = bad_inc + 9; temp.9 = bad.i
j = bad_inc + 10; temp.10 = bad.j
call VMsgBox 'Failed Associations... (OK for MORE)', temp, 1
bad_total = bad_total - 10
bad_inc = bad_inc + 10
signal bad_go
end
if bad_total > 0 then do
temp.0 = bad_total
a = bad_inc + 1; temp.1 = bad.a
b = bad_inc + 2; temp.2 = bad.b
c = bad_inc + 3; temp.3 = bad.c
d = bad_inc + 4; temp.4 = bad.d
e = bad_inc + 5; temp.5 = bad.e
f = bad_inc + 6; temp.6 = bad.f
g = bad_inc + 7; temp.7 = bad.g
h = bad_inc + 8; temp.8 = bad.h
i = bad_inc + 9; temp.9 = bad.i
j = bad_inc + 10; temp.10 = bad.j
call VMsgBox 'Failed Associations...', temp, 1
end
return
/*
* Canceled
*/
Canceled:
msg.0 = 3
msg.1 = 'Operation CANCELED by user.'
msg.2 = 'No action taken.'
msg.3 = 'Press OK to continue...'
call VMsgBox 'Information...', msg, 1
return