home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / fixnetap.zip / FIXNETAP.CMD next >
OS/2 REXX Batch file  |  1997-06-12  |  5KB  |  145 lines

  1. /*                                                           */
  2. /* This program modifies WIN-OS2 settings on */
  3. /* network applications listed in a companion data file. */
  4. /* The data file must be colocated with this .CMD file, and */
  5. /* be named FIXNETAP.DAT (see Housekeeping subrtn.) */
  6. /*                                                           */
  7. /* CHANGE LOG:                                           */
  8. /*   9/6/96  PAD  .DAT file processing                 */
  9. /*   12/96 PAD  longer timeout and                      */
  10. /*    same DAT file for DTObv, non-DTObv: mutiple FOLDER ID entries */
  11. /*   1/97  PAD  shorter timeout for objects within the folder  */
  12. /*                                                           */
  13. /*************************************************************/
  14.  
  15.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  16.   call SysLoadFuncs
  17.  
  18. start:
  19. if \ Housekeeping() then
  20.    exit
  21. if \ Get_Dat_File() then
  22.    exit
  23. if \ Get_Folder(Max_Delay) then
  24.    do
  25.       say "Can't find folder: "||Folder_ID
  26.       /*pull x*/
  27.       exit
  28.    end /* do */
  29.  
  30. /*  Finally, start modifying settings for net apps listed in parm file  */
  31. do i=1 to IDs.0
  32.    Obj_ID=substr(IDs.i,length(ID_Label)+1)
  33.    /*say Obj_ID*/
  34.    if \ Fix_Settings() then
  35.       say "Can't change settings for "||Obj_ID
  36. end 
  37. /*   processing stops here!   */
  38. return
  39.  
  40. Housekeeping:
  41. Dat_File='FIXNETAP.DAT'  /* name of .DAT file holding folder and app obj ids */
  42. ID_Label='OBJECT ID = '   /* a literal in the .DAT file */
  43. Folder_Label='FOLDER ID = '  /* a literal in the .DAT file */
  44. parse source me  /* get the directory where this .CMD is located */
  45. dir_start=lastpos(':',me)-1
  46. dir_len=(lastpos('\',me)-dir_start)+1
  47. dis_path=substr(me,dir_start,dir_len)
  48. /*if lastpos('\',dis_path)<length(dis_path) then
  49.    dis_path=dis_path||'\'*/
  50. /*say 'path to '||Dat_File||' is '||dis_path*/
  51. /* append this path to the name of the parameter file */
  52. Dat_File = dis_path||Dat_File
  53. /* the settings in the following string will overwrite current settings */
  54. /* for the program objects listed in the .DAT file.  */
  55. setup='PROGTYPE=PROG_31_ENHSEAMLESSCOMMON;'||,
  56.       'SET WIN_DDE=1;'||,
  57.       'SET WIN_CLIPBOARD=1;'||,
  58.       'SET WIN_ATM=0;'||,
  59.       'SET DOS_BACKGROUND_EXECUTION=0;'||,
  60.       'SET DOS_HIGH=1;'||,
  61.       'SET DOS_UMB=1;'||,
  62.       'SET DOS_LASTDRIVE=R;'||,
  63.       'SET DOS_DEVICE=C:\OS2\MDOS\LPTDD.SYS,'||,
  64.                      'C:\OS2\MDOS\ANSI.SYS,'||,
  65.                      'C:\TCPIP\BIN\VDOSTCP.SYS;'||,
  66.       'SET DOS_FILES=50;'||,
  67.       'SET DOS_FCBS=20;'||,
  68.       'SET HW_TIMER=1;'||,
  69.       'SET DPMI_DOS_API=ENABLED;'||,
  70.       'SET DPMI_MEMORY_LIMIT=64;'||,
  71.       'SET HW_ROM_TO_RAM=1;'||,
  72.       'SET IDLE_SECONDS=20;'||,
  73.       'SET IDLE_SENSITIVITY=75;'||,
  74.       'SET INT_DURING_IO=0;'||,
  75.       'SET SESSION_PRIORITY=1;'||,
  76.       'SET VIDEO_FASTPASTE=1;'||,
  77.       'SET VIDEO_RETRACE_EMULATION=0;'||,
  78.       'SET VIDEO_WINDOW_REFRESH=5;'||,
  79.       'SET VIDEO_8514A_XGA_IOTRAP=0;'||,
  80.       'SET XMS_MEMORY_LIMIT=10240;'||,
  81.       'SET VIDEO_SWITCH_NOTIFICATION=1;'
  82. RCOPEN=0
  83. RC1=0
  84. max_delay=120
  85. min_delay=3
  86. return 1
  87.  
  88. Get_Dat_File: 
  89. /* does the parameter file exist? */
  90. x=sysfiletree(Dat_File,'files.','fst')<>0
  91. if x then
  92. do
  93.    say 'SysFileTree failure, error '||x'  (press ENTER)'
  94.    /*pull x*/
  95.    return 0
  96. end /* do */
  97. if files.0=0 then
  98. do
  99.    say Dat_File||' Not found!'
  100.    /*pull x*/
  101.    return 0
  102. end /* do */
  103. call SysFileSearch ID_Label , dat_file , 'IDs.'
  104. if IDs.0 < 1 then
  105. do
  106.    say 'Parameter file must contain at least one "'||ID_Label||'"  entry!'
  107.    /*pull x*/
  108.    return 0
  109. end
  110. call SysFileSearch Folder_Label , dat_file , 'Fldrs.'
  111. if Fldrs.0 < 1 then
  112. do
  113.    say 'Parameter file must contain at least one "'||Folder_Label||'"  entry!'
  114.    /*pull x*/
  115.    return 0
  116. end
  117. do i = 1 to fldrs.0
  118.    Fldrs.i=substr(Fldrs.i,length(Folder_Label)+1)
  119. end
  120. return 1
  121.  
  122. Get_Folder: procedure expose fldrs.
  123. parse arg w
  124.  DO I=1 TO w
  125.   do j=1 to fldrs.0
  126.    RCOPEN = SysOpenObject(fldrs.j, 'ICON', '0')   /* open the folder identified in the .DAT file */
  127.    IF RCOPEN=1 then
  128.        DO
  129.           /*   change the settings for this folder to flowed, mini icons, etc  */
  130.           rc = SysSetObjectData(fldrs.j, 'ICONVIEW=FLOWED,MINI;ALWAYSSORT=YES') ;
  131.           return 1
  132.        END
  133.   end  /* j=1 to fldrs.0  */
  134.  RC=SYSSLEEP(1)
  135.  END
  136. return 0
  137.  
  138. Fix_Settings: procedure expose Obj_ID setup min_delay
  139. DO i=1 TO min_delay
  140.   RC1=SysSetObjectData(OBJ_ID,setup)  /*  overwrite settings with desired ones  */ 
  141.   IF RC1=1 then return 1
  142.   RC=SYSSLEEP(1)
  143. END
  144. return 0
  145.