home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / REXUTIL.ZIP / REXUTIL.CMD
OS/2 REXX Batch file  |  1992-11-10  |  34KB  |  1,117 lines

  1. /*
  2.  * Filename: REXUTIL.CMD
  3.  *
  4.  *   Author: Steve Cersosimo
  5.  *
  6.  *     Date: 11-4-92
  7.  *
  8.  *  Purpose: To allow some of the 
  9.  *           REXX functions to be
  10.  *           controled from the WPS.
  11.  */
  12.  
  13. /*
  14.  * This section will load all of the 
  15.  * available REXXUTIL functions
  16.  */
  17.  
  18. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SYSLOADFUNCS'
  19. ret=SysLoadFuncs()
  20.  
  21. /*
  22.  * This section is necessary in all scripts
  23.  * that will be calling any VREXX functions.
  24.  * If there are any errors in the REXX script the
  25.  * CLEANUP function will close all VREXX libraries.
  26.  */
  27.  
  28. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  29. initcode = VInit()
  30. if initcode = 'ERROR' then signal CLEANUP
  31.  
  32. signal on failure name CLEANUP
  33. signal on halt name CLEANUP
  34. signal on syntax name CLEANUP
  35.  
  36. /* 
  37.  * This is the list of items that will be passed
  38.  * to the VRadioBox function.  It could also be
  39.  * passed to many other VREXX functions.
  40.  */
  41.  
  42. desc.0  = 10
  43. desc.1  = 'Set icon for a WPS Object  '
  44. desc.2  = 'Create a new Association Type  '
  45. desc.3  = 'Delete existing Association Type  '
  46. desc.4  = 'List existing Association types  '
  47. desc.5  = 'List System Supplied Objects  '
  48. desc.6  = 'Recreate System Supplied Objects  '
  49. desc.7  = 'List installed Fonts  '
  50. desc.8  = 'Display Bitmap  '
  51. desc.9 = 'Set files to a certain Association Type  '
  52. desc.10 = 'Set icon for a group of files  '
  53.  
  54. /* 
  55.  * Now we initiate a variable to be passed to the VRadioBox
  56.  * function.  The value 3 will force an OK and CANCEL button 
  57.  * to appear.  The value of the variable after the function
  58.  * call will be that of the button pressed.
  59.  */
  60.  
  61. main:
  62.  
  63. /* 
  64.  * This will force all Message Box windows created in this
  65.  * script to be centered in the screen
  66.  */
  67.  
  68. call VDialogPos 50, 50
  69.  
  70. button = 3
  71. button = VRadioBox('Select function', desc, button)
  72.  
  73. /*
  74.  * Now lets check the results
  75.  * of the button and either 
  76.  * continue or quit.
  77.  */
  78.  
  79. if button = 'OK' then do
  80.    if desc.vstring = desc.1 then
  81.       call SetObj
  82.    else if desc.vstring = desc.2 then
  83.       call NewAss
  84.    else if desc.vstring = desc.3 then
  85.       call DelAss
  86.    else if desc.vstring = desc.4 then
  87.       call LisTAss       
  88.    else if desc.vstring = desc.5 then
  89.       call ListSso
  90.    else if desc.vstring = desc.6 then
  91.       call RecSso
  92.    else if desc.vstring = desc.7 then
  93.       call ListFon
  94.    else if desc.vstring = desc.8 then
  95.       call DispBit
  96.    else if desc.vstring = desc.9 then
  97.       call SetAss
  98.    else if desc.vstring = desc.10 then
  99.       call SetIco
  100.    signal main
  101. end
  102.  
  103. /* 
  104.  * Now we are finished.  We can close all VREXX functions
  105.  * and exit the REXX script.
  106.  */
  107.  
  108. CLEANUP:
  109.    call VExit
  110.    exit
  111.  
  112. /*
  113.  *SUBROUTINES
  114.  */
  115.  
  116. SetObjList:
  117.    objk.1 ='ACTLST';  objd.1 ='Activities List'
  118.    objk.2 ='ALARMS';  objd.2 ='Alarms'
  119.    objk.3 ='CALC';    objd.3 ='Calculator'
  120.    objk.4 ='CALEN';   objd.4 ='Calendar'
  121.    objk.5 ='CAT';     objd.5 ='Cat and Mouse'
  122.    objk.6 ='CLIPV';   objd.6 ='Clipboard Viewer'
  123.    objk.7 ='COLOR';   objd.7 ='Color Palette'
  124.    objk.8 ='CMD';     objd.8 ='Command Prompts'
  125.    objk.9 ='CMDREF';  objd.9 ='Command Reference'
  126.    objk.10='CNTRY';   objd.10='Country'
  127.    objk.11='DAILY';   objd.11='Daily Planner'
  128.    objk.12='DATAUP';  objd.12='Data Update'
  129.    objk.13='DBASE';   objd.13='Database'
  130.    objk.14='DDINST';  objd.14='Device Driver Install'
  131.    objk.15='DOSA';    objd.15='DOS from Drive A:'
  132.    objk.16='DOSFS';   objd.16='DOS Full Screen'
  133.    objk.17='DOSWIN';  objd.17='DOS Window'
  134.    objk.18='DRIVES';  objd.18='Drives'
  135.    objk.19='DUAL';    objd.19='Dual Boot'
  136.    objk.20='EEDIT';   objd.20='Enhanced Editor'
  137.    objk.21='FONT';    objd.21='Font Palette'
  138.    objk.22='GAMES';   objd.22='Games'
  139.    objk.23='GLOSS';   objd.23='Glossary'
  140.    objk.24='ICONED';  objd.24='Icon Editor'
  141.    objk.25='INFO';    objd.25='Information'
  142.    objk.26='JIGSAW';  objd.26='Jigsaw'
  143.    objk.27='KEYB';    objd.27='Keyboard'
  144.    objk.28='MASTER';  objd.28='Master Help Index'
  145.    objk.29='MIG';     objd.29='Migrate Applications'
  146.    objk.30='MINWIN';  objd.30='Minimized^Window Viewer'
  147.    objk.31='MONTHL';  objd.31='Monthly Planner'
  148.    objk.32='MOUSE';   objd.32='Mouse'
  149.    objk.33='NOTEPD';  objd.33='Notepad'
  150.    objk.34='CHESS';   objd.34='OS/2 Chess'
  151.    objk.35='OS2FS';   objd.35='OS/2 Full Screen'
  152.    objk.36='SYSED';   objd.36='OS/2 System Editor'
  153.    objk.37='OS2SYS';  objd.37='OS/2 System'
  154.    objk.38='OS2WIN';  objd.38='OS/2 Window'
  155.    objk.39='PICV';    objd.39='Picture Viewer'
  156.    objk.40='PLANAR';  objd.40='Planner Archive'
  157.    objk.41='PMCHRT';  objd.41='PM Chart'
  158.    objk.42='PMTERM';  objd.42='PM Terminal'
  159.    objk.43='PROD';    objd.43='Productivity'
  160.    objk.44='PULSE';   objd.44='Pulse'
  161.    objk.45='README';  objd.45='ReadMe File'
  162.    objk.46='REVERS';  objd.46='Reversi'
  163.    objk.47='REXX';    objd.47='REXX Information'
  164.    objk.48='SCHEME';  objd.48='Scheme Palette'
  165.    objk.49='SCRAMB';  objd.49='Scramble'
  166.    objk.50='SEEK';    objd.50='Seek and Scan Files'
  167.    objk.51='SELINS';  objd.51='Selective Install'
  168.    objk.52='SOLIT';   objd.52='Solitaire'
  169.    objk.53='SOUND';   objd.53='Sound'
  170.    objk.54='SPOOL';   objd.54='Spooler'
  171.    objk.55='SPREAD';  objd.55='Spreadsheet'
  172.    objk.56='SHERE';   objd.56='Start Here'
  173.    objk.57='SUP';     objd.57='Startup'
  174.    objk.58='STICKY';  objd.58='Sticky Pad'
  175.    objk.59='CLOCK';   objd.59='System Clock'
  176.    objk.60='SYSSET';  objd.60='System Setup'
  177.    objk.61='SYSTEM';  objd.61='System'
  178.    objk.62='TEMPLA';  objd.62='Templates'
  179.    objk.63='TODOAR';  objd.63='To-Do List Archive'
  180.    objk.64='TODO';    objd.64='To-Do List'
  181.    objk.65='TUNEED';  objd.65='Tune Editor'
  182.    objk.66='TUTOR';   objd.66='Tutorial'
  183.    objk.67='WINFS';   objd.67='Win-OS/2 Full Screen'
  184.    objk.0=67;         objd.0=67
  185. Return
  186.  
  187. /*
  188.  * Set icon for a WPS Object
  189.  */
  190.  
  191. SetObj:
  192.    prompt.0 = 2   /* 2 prompt lines */
  193.    prompt.1 = 'Object'
  194.    prompt.2 = 'Icon File'
  195.    width.0 = 2
  196.    width.1 = 30   /* widths in character units */
  197.    width.2 = 30   /* for both entryfields */
  198.    hide.0 = 2
  199.    hide.1 = 0     /* echo input */
  200.    hide.2 = 0     /* echo input */
  201.    answer.0 = 2
  202.    answer.1 = ''  /* these are the default strings */
  203.    answer.2 = ''  /* which will contain the input */
  204.    button = VMultBox('Set icon for a WPS Object', prompt, width, hide, answer, 3)
  205.    do i = 1 to answer.0
  206.       call strip(answer.i)
  207.    end
  208.    if button = 'OK' then do
  209.       If answer.1='' | answer.2='' Then Do
  210.          msg.0 = 3
  211.          msg.1 = 'You must supply both the Object and the Icon file.'
  212.          msg.2 = 'One or both of the parameters was missing.'
  213.          msg.3 = 'Press OK to continue...' 
  214.          call VMsgBox 'Set icon for a WPS Object', msg, 1
  215.       end
  216.       else do
  217.          answer.1=Translate(answer.1)   /* upper case */
  218.          object='<'||answer.1||'>'
  219.          retc=SysSetObjectData(object,'ICONFILE='answer.2)
  220.          msg.0 = 4
  221.          msg.1 = 'Associating the WPS object 'object
  222.          msg.2 = 'with the icon file 'answer.2'...' 
  223.          If retc=1 Then
  224.             msg.3 = '  SUCCESS.'
  225.          Else
  226.             msg.3 = '  FAILURE.'
  227.          msg.4 = 'Press OK to continue...'
  228.          call VMsgBox 'Set icon for a WPS Object...', msg, 1
  229.       end
  230.    end   
  231. return
  232.  
  233. /* 
  234.  * Create a new Association Type
  235.  */
  236.  
  237. NewAss:
  238.    prompt.0 = 1   /* 1 prompt line */
  239.    prompt.1 = 'Add Association Type'
  240.    width.0 = 1
  241.    width.1 = 30   /* widths in character units */
  242.    hide.0 = 1
  243.    hide.1 = 0     /* echo input */
  244.    answer.0 = 1
  245.    answer.1 = ''  /* default string */
  246.    button = VMultBox('Add Association Type...', prompt, width, hide, answer, 3)
  247.    if button = 'OK' then do
  248.       call strip(answer.i)
  249.       If answer.1='' Then Do
  250.          msg.0 = 2
  251.          msg.1 = 'No Association Type specified.'
  252.          msg.2 = 'Press OK to continue...' 
  253.          call VMsgBox 'Add Association Type...', msg, 1
  254.       end
  255.       else do
  256.          retc=SysIni('USER', 'PMWP_ASSOC_TYPE' ,answer.1,' ')
  257.          msg.0 = 3
  258.          msg.1 = 'Adding the Association Type 'answer.1'...' 
  259.          If LEFT(retc,6)\='ERROR:' Then
  260.             msg.2 = '  SUCCESS.'
  261.          Else
  262.             msg.2 = '  FAILURE.'
  263.          msg.3 = 'Press OK to continue...'
  264.          call VMsgBox 'Add Association Type...', msg, 1
  265.       end
  266.    end   
  267. return
  268.  
  269. /*
  270.  * Delete existing Association Type
  271.  */
  272.  
  273. DelAss:
  274. Call SysIni 'USER', 'PMWP_ASSOC_TYPE', 'ALL:', 'ikeys'
  275.  
  276. inc = 0
  277. deleted = 0
  278. ass_tot = ikeys.0
  279. del_tot = 0
  280.  
  281. go:
  282. if ass_tot > 10 then do
  283.    temp.0  = 10
  284.    a = inc + 1;   temp.1  = ikeys.a
  285.    b = inc + 2;   temp.2  = ikeys.b
  286.    c = inc + 3;   temp.3  = ikeys.c
  287.    d = inc + 4;   temp.4  = ikeys.d
  288.    e = inc + 5;   temp.5  = ikeys.e
  289.    f = inc + 6;   temp.6  = ikeys.f
  290.    g = inc + 7;   temp.7  = ikeys.g
  291.    h = inc + 8;   temp.8  = ikeys.h
  292.    i = inc + 9;   temp.9  = ikeys.i
  293.    j = inc + 10;  temp.10 = ikeys.j
  294.    call VCheckBox 'Select Associaion type(s) to delete...', temp, sel, 1
  295.    ass_tot = ass_tot - 10
  296.    inc = inc + 10
  297.    del_tot = del_tot + sel.0
  298.    if sel.0 > 0 then do
  299.       do i = 1 to sel.0
  300.          z = (del_tot + 1) - i
  301.          delem.z = sel.i
  302.       end
  303.    end
  304.    signal go
  305. end
  306. if ass_tot > 0 then do
  307.    temp.0 = ass_tot
  308.    a = inc + 1;   temp.1  = ikeys.a
  309.    b = inc + 2;   temp.2  = ikeys.b
  310.    c = inc + 3;   temp.3  = ikeys.c
  311.    d = inc + 4;   temp.4  = ikeys.d
  312.    e = inc + 5;   temp.5  = ikeys.e
  313.    f = inc + 6;   temp.6  = ikeys.f
  314.    g = inc + 7;   temp.7  = ikeys.g
  315.    h = inc + 8;   temp.8  = ikeys.h
  316.    i = inc + 9;   temp.9  = ikeys.i
  317.    j = inc + 10;  temp.10 = ikeys.j
  318.    call VCheckBox 'Select Associaion type(s) to delete...', temp, sel, 1
  319.    del_tot = del_tot + sel.0
  320.    if sel.0 > 0 then do
  321.       do i = 1 to sel.0
  322.          z = (del_tot + 1) - i
  323.          delem.z = sel.i
  324.       end
  325.    end
  326. end
  327. delem.0 = del_tot
  328. if delem.0 > 0 then do
  329.    if delem.0 > 10 then do
  330.       msg.0 = 4
  331.       msg.1 = 'You have selected 'delem.0' associations to delete.'
  332.       msg.2 = 'The maximum number to delete at one time is 10.'
  333.       msg.3 = 'Operation canceled.'
  334.       msg.4 = 'Press OK to continue...'
  335.       call VMsgBox 'Delete Association Type...', msg, 1
  336.       return
  337.    end
  338.    else do
  339.       button = 3
  340.       button = VMsgBox('Selected Association(s) to DELETE...', delem, button)
  341.       if button = 'OK' then do
  342.          do i = 1 to delem.0
  343.             retc=SysIni('USER', 'PMWP_ASSOC_TYPE' ,delem.i,'DELETE:')
  344.             If LEFT(retc,6) = 'ERROR:' Then do
  345.                msg.0 = 3
  346.                msg.1 = 'ERROR Deleteing the Association Type 'delem.i'...' 
  347.                msg.2 = delem.i' has NOT been deleted.'
  348.                msg.3 = 'Press OK to continue...'
  349.                call VMsgBox 'Deleted Association Type(s)...', msg, 1
  350.                return
  351.             end
  352.             else do
  353.                deleted = deleted + 1
  354.                suc_del.deleted = delem.i
  355.             end
  356.          end
  357.          suc_del.0 = deleted 
  358.          call VMsgBox 'Deleted Association Type(s)...', suc_del, 1
  359.          return
  360.       end
  361.       else do
  362.          msg.0 = 2
  363.          msg.1 = 'Delete Association Type Cancelled.'
  364.          msg.2 = 'Press OK to continue...'
  365.          call VMsgBox 'Delete Association Type...', msg, 1
  366.          return
  367.       end
  368.    end
  369. end
  370. else do
  371.    msg.0 = 2
  372.    msg.1 = 'No Association Type specified.'
  373.    msg.2 = 'Press OK to continue...' 
  374.    call VMsgBox 'Delete Association Type...', msg, 1
  375.    return
  376. end
  377.  
  378. /*
  379.  * List existing Association types
  380.  */
  381.  
  382. LisTAss:
  383.    Call SysIni 'USER', 'PMWP_ASSOC_TYPE', 'ALL:', 'ikeys'
  384.    inc = 0
  385.    ass_tot = ikeys.0
  386.    list_types_go:
  387.    if ass_tot > 10 then do
  388.       temp.0  = 10
  389.       a = inc + 1;   temp.1  = ikeys.a
  390.       b = inc + 2;   temp.2  = ikeys.b
  391.       c = inc + 3;   temp.3  = ikeys.c
  392.       d = inc + 4;   temp.4  = ikeys.d
  393.       e = inc + 5;   temp.5  = ikeys.e
  394.       f = inc + 6;   temp.6  = ikeys.f
  395.       g = inc + 7;   temp.7  = ikeys.g
  396.       h = inc + 8;   temp.8  = ikeys.h
  397.       i = inc + 9;   temp.9  = ikeys.i
  398.       j = inc + 10;  temp.10 = ikeys.j
  399.       call VMsgBox 'Associaion types... ( OK for MORE)', temp, 1
  400.       ass_tot = ass_tot - 10
  401.       inc = inc + 10
  402.       signal list_types_go
  403.    end
  404.    if ass_tot > 0 then do
  405.       temp.0 = ass_tot
  406.       a = inc + 1;   temp.1  = ikeys.a
  407.       b = inc + 2;   temp.2  = ikeys.b
  408.       c = inc + 3;   temp.3  = ikeys.c
  409.       d = inc + 4;   temp.4  = ikeys.d
  410.       e = inc + 5;   temp.5  = ikeys.e
  411.       f = inc + 6;   temp.6  = ikeys.f
  412.       g = inc + 7;   temp.7  = ikeys.g
  413.       h = inc + 8;   temp.8  = ikeys.h
  414.       i = inc + 9;   temp.9  = ikeys.i
  415.       j = inc + 10;  temp.10 = ikeys.j
  416.       call VMsgBox 'Associaion types...', temp, 1
  417.    end
  418. return
  419. /*
  420.  * List System Supplied Objects
  421.  */
  422.  
  423. ListSso:
  424.    pos.top    = 85
  425.    pos.bottom = 25
  426.    pos.left   = 20
  427.    pos.right  = 80
  428.    color = 'WHITE'
  429.    x = 50
  430.    y = 950
  431.    Call SetObjList
  432.    lso_id = VOpenWindow('System Supplied Objects...', color, pos)
  433.    call VSay lso_id, 37, y, ' KeyWord  Object Title              KeyWord  Object Title' 
  434.    y = y - 25
  435.    Do i=1 to (objk.0 /2)
  436.       k=i*2
  437.       n=i*2-1
  438.       call VSay lso_id, x, y, substr(objk.n,1,7)'- 'substr(objd.n,1,25) substr(objk.k,1,6) '- 'objd.k
  439.       y = y - 25
  440.    end
  441.    n=objk.0
  442.    If ((objk.0/2)-TRUNC(objk.0/2))\=0 Then
  443.       call VSay lso_id, x, y, substr(objk.n,1,6) '- 'substr(objd.n,1,25)
  444.    call VDialogPos 50, 10
  445.    msg.0 = 2
  446.    msg.1 = 'Press OK to close the'
  447.    msg.2 = 'System Supplied Objects window.' 
  448.    call VMsgBox 'System Supplied Objects...', msg, 1
  449.    call VCloseWindow lso_id
  450. return 
  451.  
  452.  
  453. /*
  454.  * Recreate System Supplied Objects
  455.  */
  456.  
  457. RecSso:
  458.    prompt.0 = 1   /* 1 prompt line */
  459.    prompt.1 = 'System Object to Recreate  '
  460.    width.0 = 1
  461.    width.1 = 10   /* widths in character units */
  462.    hide.0 = 1
  463.    hide.1 = 0     /* echo input */
  464.    answer.0 = 1
  465.    answer.1 = ''  /* default string */
  466.    button = VMultBox('Create a System Supplied Object...', prompt, width, hide, answer, 3)
  467.    if button = 'OK' then do
  468.       call strip(answer.i)
  469.       If answer.1='' Then Do
  470.          msg.0 = 2
  471.          msg.1 = 'No System Object specified.'
  472.          msg.2 = 'Press OK to continue...' 
  473.          call VMsgBox 'Create a System Supplied Object...', msg, 1
  474.       end
  475.       else do
  476.          pos.top    = 60
  477.          pos.bottom = 40
  478.          pos.left   = 9
  479.          pos.right  = 35
  480.          color = 'WHITE'
  481.          cso_id = VOpenWindow('Create System Object...', color, pos)
  482.          call VSay cso_id, 35, 800, 'creating Object List...'
  483.          Call SetObjList
  484.          call VSay cso_id, 35, 600, 'Now searching Object List...'
  485.          /* find keyword specified by answer.1 in the objlist */
  486.          targttl=''
  487.          answer.1=Translate(answer.1)   /* upper case */
  488.          Do i=1 to objk.0
  489.             If answer.1=objk.i Then Do
  490.                targttl=objd.i
  491.                Leave
  492.             End /* match */
  493.          End /* search */
  494.          If targttl='' Then Do
  495.             call VCloseWindow cso_id
  496.             msg.0 = 3
  497.             msg.1 = answer.1' is an invalid keyword.'
  498.             msg.2 = 'Issue "List System Supplied Objects" for valid keywords.'
  499.             msg.3 = 'Press OK to continue.'
  500.             call VMsgBox 'Create a System Supplied Object...', msg, 1
  501.             return
  502.          End
  503.          /* Find title specified in INI.RC */
  504.          call VSay cso_id, 35, 400, 'Now parsing INI.RC file...'
  505.          BtDrv=filespec('drive',value('COMSPEC',,'OS2ENVIRONMENT'))
  506.          rcfile=BtDrv'\OS2\INI.RC'
  507.          objnam=''
  508.          Do While lines(rcfile)
  509.             rcline=linein(rcfile)
  510.             parse var rcline '"'iv1'"' '"'iv2'"' '"'objset'"'
  511.             If iv1='PM_InstallObject' Then Do
  512.                parse var iv2 sss';'ttt';'yyy
  513.                If sss=targttl Then Do
  514.                   objnam=sss; objcls=ttt; objloc=yyy
  515.                   Leave
  516.                End /* match */
  517.             End  /* installobject */
  518.          End /* do while */
  519.          call stream rcfile, 'c', 'close'
  520.          If objnam='' Then Do
  521.             call VCloseWindow cso_id
  522.             msg.0 = 4
  523.             msg.1 = 'Internal program error.  The object title:'targttl' could not be found'
  524.             msg.2 = 'in the INI.RC file.  Please contact the author so that the program''s internal'
  525.             msg.3 = 'table can be corrected.  Thank you.'
  526.             msg.4 = 'Press OK to continue.'
  527.             call VMsgBox 'Create a System Supplied Object...', msg, 1
  528.             return
  529.          End
  530.          call VCloseWindow cso_id
  531.          opt.0 = 2
  532.          opt.1 = 'Create the object in it''s ORIGINAL location  '
  533.          opt.2 = 'Create the object on the DESKTOP  '
  534.          button = 3
  535.          button = VRadioBox('Select function', opt, button)
  536.          if button = 'OK' then do
  537.             If opt.vstring = 'Create the object on the DESKTOP  ' Then
  538.                objloc='<WP_DESKTOP>'
  539.             msg.0 = 3
  540.             msg.1 = 'Creating the ['answer.1'] System Supplied Object...'
  541.             retc = SysCreateObject(objcls,objnam,objloc,objset,'U')
  542.             If retc=1 Then
  543.                msg.2 = '  SUCCESS.'
  544.             Else
  545.                msg.2 = '  FAILURE.'
  546.             msg.3 = 'Press OK to continue...'
  547.             call VMsgBox 'Create a System Supplied Object...', msg, 1
  548.          end
  549.       end
  550.    end
  551.    else
  552.       call Canceled
  553. return
  554.  
  555. /*
  556.  * List installed Fonts
  557.  */
  558.  
  559. ListFon:
  560.    Call SysIni 'USER', 'PM_Fonts', 'ALL:', 'ikeys'
  561.    font_inc = 0
  562.    font_total = ikeys.0
  563.    adobe = '   (Adobe Type 1)'
  564.    Fonts_go:
  565.    if font_total > 10 then do
  566.       temp.0  = 10
  567.       a = font_inc + 1
  568.       If pos('.AFM',ikeys.a) > 0 Then do
  569.          aa = ikeys.a
  570.          bb = adobe
  571.          temp.1 = aa||bb
  572.       end
  573.       else
  574.          temp.1 = ikeys.a
  575.       b = font_inc + 2
  576.       If pos('.AFM',ikeys.b) > 0 Then do
  577.          aa = ikeys.b
  578.          bb = adobe
  579.          temp.2 = aa||bb
  580.       end
  581.       else
  582.          temp.2 = ikeys.b
  583.       c = font_inc + 3
  584.       If pos('.AFM',ikeys.c) > 0 Then do
  585.          aa = ikeys.b
  586.          bb = adobe
  587.          temp.3 = aa||bb
  588.       end
  589.       else
  590.          temp.3 = ikeys.c
  591.       d = font_inc + 4
  592.       If pos('.AFM',ikeys.d) > 0 Then do
  593.          aa = ikeys.d
  594.          bb = adobe
  595.          temp.4 = aa||bb
  596.       end
  597.       else
  598.          temp.4 = ikeys.d
  599.       e = font_inc + 5
  600.       If pos('.AFM',ikeys.e) > 0 Then do
  601.          aa = ikeys.e
  602.          bb = adobe
  603.          temp.5 = aa||bb
  604.       end
  605.       else
  606.          temp.5 = ikeys.e
  607.       f = font_inc + 6
  608.       If pos('.AFM',ikeys.f) > 0 Then do
  609.          aa = ikeys.f
  610.          bb = adobe
  611.          temp.6 = aa||bb
  612.       end
  613.       else
  614.          temp.6 = ikeys.f
  615.       g = font_inc + 7
  616.       If pos('.AFM',ikeys.g) > 0 Then do
  617.          aa = ikeys.g
  618.          bb = adobe
  619.          temp.7 = aa||bb
  620.       end
  621.       else
  622.          temp.7 = ikeys.g
  623.       h = font_inc + 8
  624.       If pos('.AFM',ikeys.h) > 0 Then do
  625.          aa = ikeys.h
  626.          bb = adobe
  627.          temp.8 = aa||bb
  628.       end
  629.       else
  630.          temp.8 = ikeys.h
  631.       i = font_inc + 9
  632.       If pos('.AFM',ikeys.i) > 0 Then do
  633.          aa = ikeys.i
  634.          bb = adobe
  635.          temp.9 = aa||bb
  636.       end
  637.       else
  638.          temp.9 = ikeys.i
  639.       j = font_inc + 10
  640.       If pos('.AFM',ikeys.j) > 0 Then do
  641.          aa = ikeys.j
  642.          bb = adobe
  643.          temp.10 = aa||bb
  644.       end
  645.       else
  646.          temp.10 = ikeys.j
  647.       call VMsgBox 'Installed Fonts... ( OK for MORE)', temp, 1
  648.       font_total = font_total - 10
  649.       font_inc = font_inc + 10
  650.       signal Fonts_go
  651.    end
  652.    if font_total > 0 then do
  653.       temp.0  = font_total
  654.       a = font_inc + 1
  655.       If pos('.AFM',ikeys.a) > 0 Then do
  656.          aa = ikeys.a
  657.          bb = adobe
  658.          temp.1 = aa||bb
  659.       end
  660.       else
  661.          temp.1 = ikeys.a
  662.       b = font_inc + 2
  663.       If pos('.AFM',ikeys.b) > 0 Then do
  664.          aa = ikeys.b
  665.          bb = adobe
  666.          temp.2 = aa||bb
  667.       end
  668.       else
  669.          temp.2 = ikeys.b
  670.       c = font_inc + 3
  671.       If pos('.AFM',ikeys.c) > 0 Then do
  672.          aa = ikeys.b
  673.          bb = adobe
  674.          temp.3 = aa||bb
  675.       end
  676.       else
  677.          temp.3 = ikeys.c
  678.       d = font_inc + 4
  679.       If pos('.AFM',ikeys.d) > 0 Then do
  680.          aa = ikeys.d
  681.          bb = adobe
  682.          temp.4 = aa||bb
  683.       end
  684.       else
  685.          temp.4 = ikeys.d
  686.       e = font_inc + 5
  687.       If pos('.AFM',ikeys.e) > 0 Then do
  688.          aa = ikeys.e
  689.          bb = adobe
  690.          temp.5 = aa||bb
  691.       end
  692.       else
  693.          temp.5 = ikeys.e
  694.       f = font_inc + 6
  695.       If pos('.AFM',ikeys.f) > 0 Then do
  696.          aa = ikeys.f
  697.          bb = adobe
  698.          temp.6 = aa||bb
  699.       end
  700.       else
  701.          temp.6 = ikeys.f
  702.       g = font_inc + 7
  703.       If pos('.AFM',ikeys.g) > 0 Then do
  704.          aa = ikeys.g
  705.          bb = adobe
  706.          temp.7 = aa||bb
  707.       end
  708.       else
  709.          temp.7 = ikeys.g
  710.       h = font_inc + 8
  711.       If pos('.AFM',ikeys.h) > 0 Then do
  712.          aa = ikeys.h
  713.          bb = adobe
  714.          temp.8 = aa||bb
  715.       end
  716.       else
  717.          temp.8 = ikeys.h
  718.       i = font_inc + 9
  719.       If pos('.AFM',ikeys.i) > 0 Then do
  720.          aa = ikeys.i
  721.          bb = adobe
  722.          temp.9 = aa||bb
  723.       end
  724.       else
  725.          temp.9 = ikeys.i
  726.       j = font_inc + 10
  727.       If pos('.AFM',ikeys.j) > 0 Then do
  728.          aa = ikeys.j
  729.          bb = adobe
  730.          temp.10 = aa||bb
  731.       end
  732.       else
  733.          temp.10 = ikeys.j
  734.       call VMsgBox 'Installed Fonts... (total 'ikeys.0')', temp, 1
  735.    end
  736. return
  737.  
  738. /*
  739.  * Display Bitmap
  740.  */
  741.  
  742. DispBit:
  743.    prompt.0 = 1   /* 1 prompt line */
  744.    prompt.1 = 'Bitmap file to view  '
  745.    width.0 = 1
  746.    width.1 = 35   /* widths in character units */
  747.    hide.0 = 1
  748.    hide.1 = 0     /* echo input */
  749.    answer.0 = 1
  750.    answer.1 = ''  /* default string */
  751.    button = VMultBox('Bitmap Viewer...', prompt, width, hide, answer, 3)
  752.    if button = 'OK' then do
  753.       call strip(answer.i)
  754.       If answer.1='' Then Do
  755.          msg.0 = 2
  756.          msg.1 = 'No file specified.'
  757.          msg.2 = 'Press OK to continue...' 
  758.          call VMsgBox 'Bitmap Viewer...', msg, 1
  759.       end
  760.       drvspec=DIRECTORY()                        /* Get current drive and subdir */
  761.       Parse value drvspec with wdrv':'wdir
  762.       wdrv=wdrv':'                               /* add trailing colon           */
  763.       tdrv=FILESPEC("drive",answer.1)              /* Get drive specified          */
  764.       tdir=FILESPEC("path",answer.1)               /* Get path specified           */
  765.       tnam=FILESPEC("name",answer.1)               /* Get name specified           */
  766.       If tdrv='' Then tdrv=wdrv                  /* if no drive, assume current  */
  767.       If tdir='' Then tdir=wdir                  /* if no subdir, assume current */
  768.       If RIGHT(tdir,1)\='\' Then tdir=tdir'\'    /* ensure trailing backslash    */
  769.       wbmp=tdrv||tdir||tnam                      /* compose filespec             */
  770.       If STREAM(wbmp,'C','QUERY EXISTS')='' Then Do
  771.          msg.0 = 2
  772.          msg.1 = 'The file 'wbmp' could not be found.'
  773.          msg.2 = 'Press OK to continue...'
  774.          call VMsgBox 'Bitmap Viewer...', msg, 1
  775.          return
  776.       End
  777.       wpclassname='WPFolder'
  778.       wptitle='Bitmap Viewer'
  779.       wplocation='<WP_DESKTOP>'
  780.       wpobject='<BMP_VIEWER>'
  781.       wpsetup='OBJECTID='wpobject';BACKGROUND='wbmp
  782.       opt.0 = 2
  783.       opt.1 = 'View the file in a folder called Bitmap Viewer  '
  784.       opt.2 = 'View the file on the DESKTOP  '
  785.       button = 3
  786.       button = VRadioBox('Select function', opt, button)
  787.       if button = 'OK' then
  788.          If opt.vstring = 'View the file on the DESKTOP  ' Then do
  789.             wpobject=wplocation
  790.             dest = 'on the desktop.'
  791.          end
  792.          else
  793.             dest='in a folder called Bitmap Viewer.'
  794.       else do
  795.          call Canceled
  796.          return
  797.       end
  798.       retc=SysSetObjectData(wpobject,'BACKGROUND='wbmp)
  799.       If retc=0 Then Do
  800.          retc=SysCreateObject(wpclassname,wptitle,wplocation,wpsetup,'U')
  801.          retc=SysSetObjectData(wpobject,'BACKGROUND='wbmp)
  802.       End  /* if /d */
  803.       If retc=1 then do
  804.          msg.0 = 3
  805.          msg.1 = 'The file 'wbmp
  806.          msg.2 = 'Has been sucessfully displayed 'dest
  807.          msg.4 = 'Press OK to continue...'
  808.          call VMsgBox 'Bitmap Viewer...', msg, 1
  809.       end
  810.       Else do
  811.          msg.0 = 2
  812.          msg.1 = 'The file 'wbmp' has NOT been sucessfully displayed.'
  813.          msg.2 = 'Press OK to continue...'
  814.          call VMsgBox 'Bitmap Viewer...', msg, 1
  815.       end
  816.    end
  817. return         
  818.  
  819. /*
  820.  * Set files to a certain Association Type
  821.  */
  822.  
  823. SetAss:
  824.    go_ahead = 0
  825.    success = 0
  826.    failure = 0
  827.    Call SysIni 'USER', 'PMWP_ASSOC_TYPE', 'ALL:', 'ikeys'
  828.    prompt.0 = 2
  829.    prompt.1 = 'Files to set (full pathname)  '
  830.    prompt.2 = 'Association  '
  831.    width.0 = 2
  832.    width.1 = 35
  833.    width.2 = 35
  834.    hide.0 = 2
  835.    hide.1 = 0
  836.    hide.1 = 0
  837.    answer.0 = 2
  838.    answer.1 = ''
  839.    answer.2 = ''
  840.    button = 3
  841.    button = VMultBox('Set Association (WILDCARDS OK)...', prompt, width, hide, answer, 3)
  842.    if button = 'OK' then do
  843.       do i = 1 to answer.0
  844.          call strip(answer.i)
  845.       end
  846.       If answer.1='' Then Do
  847.          msg.0 = 2
  848.          msg.1 = 'No files specified.'
  849.          msg.2 = 'Press OK to continue...' 
  850.          call VMsgBox 'Set Association...', msg, 1
  851.          return
  852.       end
  853.       If answer.2 = '' Then Do
  854.          msg.0 = 2
  855.          msg.1 = 'No Association specified.'
  856.          msg.2 = 'Press OK to continue...' 
  857.          call VMsgBox 'Set Association...', msg, 1
  858.          return
  859.       end
  860.       do i = 1 to ikeys.0
  861.          if answer.2 = ikeys.i then
  862.             go_ahead = 1
  863.       end
  864.       if go_ahead \= 1 then do
  865.          msg.0 = 4
  866.          msg.1 = 'The Assosiation type you selected "'answer.2'"'
  867.          msg.2 = 'does NOT exist.  The requested operation'
  868.          msg.3 = 'HAS BEEN CANCELED.'
  869.          msg.4 = 'Press OK to continue...'
  870.          call VMsgBox 'Set Association...', msg, 1
  871.          return
  872.       end
  873.       do_tree.0 = 2
  874.       do_tree.1 = 'ALL SUBDIRECTORIES     '
  875.       do_tree.2 = 'SELECTED DIRECTORY ONLY        '
  876.       button = 3
  877.       button = VRadioBox('Select function', do_tree, button)
  878.       if button = 'OK' then do
  879.          if do_tree.vstring = do_tree.1 then
  880.             asscopt='FS'
  881.          else
  882.             asscopt='F'
  883.          call  Working
  884.          If ifspec.0 > 0 Then Do
  885.             typeconst="DFFF00000100FDFF"x||d2c(length(answer.2))||'00'x||answer.2
  886.             Do i=1 TO ifspec.0
  887.                ifspec.i=WORD(ifspec.i,5)
  888.                rez=SysPutEa(ifspec.i,'.TYPE',typeconst)
  889.                If rez=0 Then do
  890.                   success = success + 1
  891.                   good.i = ifspec.i
  892.                end
  893.                Else do
  894.                   failure = failure + 1
  895.                   bad.i = ifspec.i
  896.                end
  897.             end
  898.             call VCloseWindow win_id
  899.             call Results
  900.             return
  901.          end
  902.          else do
  903.             call VCloseWindow win_id
  904.             msg.0 = 2
  905.             msg.1 = 'No files found matching 'answer.1
  906.             msg.2 = 'Press OK to continue...'
  907.             call VMsgBox 'Set Association...', msg, 1
  908.             return
  909.          end
  910.       end
  911.       else
  912.          call Canceled
  913.    end
  914.    else
  915.       call Canceled
  916. Return
  917.  
  918. /*
  919.  *Set icon for a group of files
  920.  */
  921.  
  922. SetIco:
  923.    success = 0
  924.    failure = 0
  925.    prompt.0 = 2
  926.    prompt.1 = 'Files to set (full pathname)  '
  927.    prompt.2 = 'Icon  '
  928.    width.0 = 2
  929.    width.1 = 35
  930.    width.2 = 35
  931.    hide.0 = 2
  932.    hide.1 = 0
  933.    hide.1 = 0
  934.    answer.0 = 2
  935.    answer.1 = ''
  936.    answer.2 = ''
  937.    button = 3
  938.    button = VMultBox('Set Icon (WILDCARDS OK)...', prompt, width, hide, answer, 3)
  939.    if button = 'OK' then do
  940.       do i = 1 to answer.0
  941.          call strip(answer.i)
  942.       end
  943.       If answer.1='' Then Do
  944.          msg.0 = 2
  945.          msg.1 = 'No files specified.'
  946.          msg.2 = 'Press OK to continue...' 
  947.          call VMsgBox 'Set Icon...', msg, 1
  948.          return
  949.       end
  950.       If answer.2 = '' Then Do
  951.          msg.0 = 2
  952.          msg.1 = 'No Icon specified.'
  953.          msg.2 = 'Press OK to continue...' 
  954.          call VMsgBox 'Set Icon...', msg, 1
  955.          return
  956.       end
  957.       do_tree.0 = 2
  958.       do_tree.1 = 'ALL SUBDIRECTORIES     '
  959.       do_tree.2 = 'SELECTED DIRECTORY ONLY        '
  960.       button = 3
  961.       button = VRadioBox('Select function', do_tree, button)
  962.       if button = 'OK' then do
  963.          if do_tree.vstring = do_tree.1 then
  964.             asscopt='FS'
  965.          else
  966.             asscopt='F'
  967.          If stream(answer.2,'c','query exists')='' Then Do
  968.             msg.0 = 3
  969.             msg.1 = 'The Icon file "'answer.2'"'
  970.             msg.2 = 'Does not exist.'
  971.             msg.3 = 'Press OK to continue...'
  972.             call VMsgBox 'Set Icon...', msg, 1
  973.             return
  974.          end
  975.          call  Working
  976.          Call SysFileTree answer.1,'ifspec',asscopt
  977.          If ifspec.0 > 0 Then Do
  978.             do i = 1 TO ifspec.0
  979.                ifspec.i = WORD(ifspec.i,5)
  980.                rez = SysSetIcon(ifspec.i,answer.2)
  981.                If rez = 1 Then do
  982.                   success = success + 1
  983.                   good.i = ifspec.i
  984.                end
  985.                Else do
  986.                   failure = failure + 1
  987.                   bad.i = ifspec.i
  988.                end
  989.             end
  990.             call VCloseWindow win_id
  991.             call Results
  992.             return
  993.          end
  994.          else do
  995.             call VCloseWindow win_id
  996.             msg.0 = 2
  997.             msg.1 = 'No files found matching 'answer.1
  998.             msg.2 = 'Press OK to continue...'
  999.             call VMsgBox 'Set Association...', msg, 1
  1000.             return
  1001.          end
  1002.       end
  1003.       else
  1004.          call Canceled
  1005.    end
  1006.    else
  1007.       call Canceled
  1008. Return
  1009.  
  1010. /*
  1011.  * Working Window
  1012.  */
  1013.  
  1014. Working:
  1015.    pos.top    = 55
  1016.    pos.bottom = 45
  1017.    pos.left   = 40
  1018.    pos.right  = 60
  1019.    color = 'WHITE'
  1020.    x = 50
  1021.    y = 700
  1022.    win_id = VOpenWindow('Working...', color, pos)
  1023.    call VSay win_id, x, y, 'Processing files...' 
  1024.    y =  y - 425
  1025.    call VSay win_id, x, y, 'Please Wait...'
  1026.    Call SysFileTree answer.1,'ifspec',asscopt
  1027. return
  1028.  
  1029. /*
  1030.  * Results
  1031.  */
  1032.  
  1033. Results:
  1034.    good.0 = success
  1035.    good_inc = 0
  1036.    good_total = good.0
  1037.    good_go:
  1038.    if good_total > 10 then do
  1039.       temp.0  = 10
  1040.       a = good_inc + 1;   temp.1  = good.a
  1041.       b = good_inc + 2;   temp.2  = good.b
  1042.       c = good_inc + 3;   temp.3  = good.c
  1043.       d = good_inc + 4;   temp.4  = good.d
  1044.       e = good_inc + 5;   temp.5  = good.e
  1045.       f = good_inc + 6;   temp.6  = good.f
  1046.       g = good_inc + 7;   temp.7  = good.g
  1047.       h = good_inc + 8;   temp.8  = good.h
  1048.       i = good_inc + 9;   temp.9  = good.i
  1049.       j = good_inc + 10;  temp.10 = good.j
  1050.       call VMsgBox 'Successful Associations... (OK for MORE)', temp, 1
  1051.       good_total = good_total - 10
  1052.       good_inc = good_inc + 10
  1053.       signal good_go
  1054.    end
  1055.    if good_total > 0 then do
  1056.       temp.0 = good_total
  1057.       a = good_inc + 1;   temp.1  = good.a
  1058.       b = good_inc + 2;   temp.2  = good.b
  1059.       c = good_inc + 3;   temp.3  = good.c
  1060.       d = good_inc + 4;   temp.4  = good.d
  1061.       e = good_inc + 5;   temp.5  = good.e
  1062.       f = good_inc + 6;   temp.6  = good.f
  1063.       g = good_inc + 7;   temp.7  = good.g
  1064.       h = good_inc + 8;   temp.8  = good.h
  1065.       i = good_inc + 9;   temp.9  = good.i
  1066.       j = good_inc + 10;  temp.10 = good.j
  1067.       call VMsgBox 'Successful Associations...', temp, 1
  1068.    end
  1069.    bad.0 = failure
  1070.    bad_inc = 0
  1071.    bad_total = bad.0
  1072.    bad_go:
  1073.    if bad_total > 10 then do
  1074.       temp.0  = 10
  1075.       a = bad_inc + 1;   temp.1  = bad.a
  1076.       b = bad_inc + 2;   temp.2  = bad.b
  1077.       c = bad_inc + 3;   temp.3  = bad.c
  1078.       d = bad_inc + 4;   temp.4  = bad.d
  1079.       e = bad_inc + 5;   temp.5  = bad.e
  1080.       f = bad_inc + 6;   temp.6  = bad.f
  1081.       g = bad_inc + 7;   temp.7  = bad.g
  1082.       h = bad_inc + 8;   temp.8  = bad.h
  1083.       i = bad_inc + 9;   temp.9  = bad.i
  1084.       j = bad_inc + 10;  temp.10 = bad.j
  1085.       call VMsgBox 'Failed Associations... (OK for MORE)', temp, 1
  1086.       bad_total = bad_total - 10
  1087.       bad_inc = bad_inc + 10
  1088.       signal bad_go
  1089.    end
  1090.    if bad_total > 0 then do
  1091.       temp.0 = bad_total
  1092.       a = bad_inc + 1;   temp.1  = bad.a
  1093.       b = bad_inc + 2;   temp.2  = bad.b
  1094.       c = bad_inc + 3;   temp.3  = bad.c
  1095.       d = bad_inc + 4;   temp.4  = bad.d
  1096.       e = bad_inc + 5;   temp.5  = bad.e
  1097.       f = bad_inc + 6;   temp.6  = bad.f
  1098.       g = bad_inc + 7;   temp.7  = bad.g
  1099.       h = bad_inc + 8;   temp.8  = bad.h
  1100.       i = bad_inc + 9;   temp.9  = bad.i
  1101.       j = bad_inc + 10;  temp.10 = bad.j
  1102.      call VMsgBox 'Failed Associations...', temp, 1
  1103.   end
  1104. return
  1105.  
  1106. /*
  1107.  * Canceled
  1108.  */
  1109.  
  1110. Canceled:
  1111.    msg.0 = 3
  1112.    msg.1 = 'Operation CANCELED by user.'
  1113.    msg.2 = 'No action taken.'
  1114.    msg.3 = 'Press OK to continue...'
  1115.    call VMsgBox 'Information...', msg, 1
  1116. return
  1117.