home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / comm / misc / RecentScript.lha / RecentScript / RecentScriptCmd.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-02-14  |  17.2 KB  |  750 lines

  1. /*****
  2.   $VER: RecentScript Commands 1.0 (9.2.97) ©Arndt van der Molen
  3.  
  4.  
  5.                    RecentScript Commands
  6.  
  7.   is a MUIRexx subapplication and can not be started directly.
  8.  
  9.   It is called only from the starter application.
  10. *****/
  11.  
  12.  
  13.  
  14. /* Change to path with trailing ':' or '/' where this script resides */
  15.  
  16. srcdir = 'MUIREXX:RecentScript/'
  17.  
  18.  
  19.  
  20. /* !!! NOTHING TO CHANGE BELOW THIS LINE !!! */
  21.  
  22. OPTIONS RESULTS
  23.  
  24. PARSE ARG portname cmd1 cmd2 '['cmd3']'
  25.  
  26. MUIV_List_Select_Off      =  0
  27. MUIV_List_Select_On       =  1
  28.  
  29.  
  30. cmd2 = STRIP(cmd2)
  31.  
  32. PRAGMA('Directory',srcdir)   /* Set current directory */
  33.  
  34. ADDRESS VALUE portname
  35.  
  36. SELECT
  37.   
  38.   WHEN cmd1 = 'ADD'         THEN CALL addentries
  39.  
  40.   WHEN cmd1 = 'CLR'         THEN CALL clearlist cmd2
  41.  
  42.   WHEN cmd1 = 'DEL'         THEN CALL delentry
  43.  
  44.   WHEN cmd1 = 'LOAD'        THEN CALL loadindex cmd2 cmd3
  45.  
  46.   WHEN cmd1 = 'MINUS'       THEN CALL patternentries MUIV_List_Select_Off
  47.  
  48.   WHEN cmd1 = 'PLUS'        THEN CALL patternentries MUIV_List_Select_On
  49.  
  50.   WHEN cmd1 = 'SAVE'        THEN CALL savelist
  51.  
  52.   WHEN cmd1 = 'SETBAT'      THEN CALL batchsettingopen '['cmd3']'
  53.  
  54.   WHEN cmd1 = 'SETBATHDL'   THEN CALL batchsettinghandle cmd2 '['cmd3']'
  55.  
  56.   WHEN cmd1 = 'TEST'        THEN CALL testprocedure
  57.  
  58.   OTHERWISE DO
  59.     request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING '"Unsupport command 'cmd1 cmd2 cmd3'"'
  60.   END
  61. END
  62.  
  63. RETURN
  64.  
  65.  
  66.  
  67. /* --------------------------------------------------------- */
  68. /* Add all selected entries from the LST_ALL to the LST_SEL  */
  69. /* --------------------------------------------------------- */
  70.  
  71. addentries: PROCEDURE
  72.  
  73. MUIA_List_Quiet           = '0x8042d8c7'
  74. MUIM_Busy_Move            = '0x80020001'
  75. MUIV_List_Insert_Bottom   = -3
  76.  
  77.  
  78. list ID LST_SEL ATTRS MUIA_List_Quiet 1
  79.  
  80. DO FOREVER
  81.  
  82.   list ID LST_ALL
  83.   entry = result
  84.  
  85.   IF entry = '' THEN LEAVE
  86.  
  87.   method ID CLS_BUSY MUIM_Busy_Move
  88.  
  89.   list ID LST_SEL NODUP POS MUIV_List_Insert_Bottom INSERT STRING entry
  90. END
  91.  
  92. list ID LST_SEL ATTRS MUIA_List_Quiet 0
  93.  
  94. RETURN
  95.  
  96.  
  97.  
  98. /* --------------------------------------------------------- */
  99. /* Delete selected entry from the LST_SEL                    */
  100. /* --------------------------------------------------------- */
  101.  
  102. delentry: PROCEDURE
  103.  
  104. MUIA_List_Active          = '0x8042391c'
  105.  
  106. list ID LST_SEL ATTRS MUIA_List_Active
  107. position = result
  108.  
  109. list ID LST_SEL POS position STRING
  110.  
  111. RETURN
  112.  
  113.  
  114.  
  115. /* --------------------------------------------------------- */
  116. /* Load specified AmiNet index file into specified listview  */
  117. /* --------------------------------------------------------- */
  118.  
  119. loadindex: PROCEDURE EXPOSE srcdir
  120.  
  121. parse arg listid ' ' filename
  122.  
  123. MUIA_List_Quiet           = '0x8042d8c7'
  124. MUIM_Busy_Move            = '0x80020001'
  125. ASLFR_InitialDrawer       = '0x80080009'
  126. MUIV_List_Insert_Bottom   = -3
  127.  
  128.  
  129. IF filename = '' THEN DO
  130.  
  131.   OPTIONS FAILAT 11
  132.   aslrequest ID RECSCRWIN TITLE '"Load AmiNet index file..."' ATTRS ASLFR_InitialDrawer srcdir
  133.   returncode = RC
  134.   filename   = result
  135.   OPTIONS FAILAT 0
  136.  
  137.   IF returncode ~= 0 | filename = '' THEN DO
  138.     RETURN
  139.   END
  140. END
  141.  
  142. IF OPEN(indexhandle, filename, 'R') THEN DO
  143.  
  144.   list ID listid ATTRS MUIA_List_Quiet 1
  145.  
  146.   DO UNTIL EOF(indexhandle)
  147.  
  148.     method ID CLS_BUSY MUIM_Busy_Move
  149.  
  150.     line = READLN(indexhandle)
  151.  
  152.     /* Check if the line is an AmiNet Index line */
  153.  
  154.     slashposition = POS('/',line)
  155.  
  156.     /* This check must be edited if the format of the index file changes */
  157.     IF   (SUBSTR(line,34,1)   = 'K' | SUBSTR(line,34,1) = 'M'),
  158.         & SUBSTR(line,19,1)  = ' ',
  159.         & SUBSTR(line,30,1)  = ' ',
  160.         & SUBSTR(line,36,1) ~= ' ', /* Exlude 'most downloaded' and 'top rated' files */
  161.         & slashposition > 20,
  162.         & slashposition < 29
  163.     THEN DO
  164.  
  165.       /* This line must be edited if the format of the index file changes */
  166.       PARSE VAR line WITH 1 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 comment
  167.  
  168.       LIST ID listid NODUP POS MUIV_List_Insert_Bottom INSERT STRING name","directory","size","comment
  169.     END
  170.   END
  171.  
  172.   list ID listid ATTRS MUIA_List_Quiet 0
  173.  
  174.   CALL CLOSE(indexhandle)
  175.  
  176. END
  177. ELSE DO
  178.   request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "Cannot read file '"filename"'"
  179. END
  180.  
  181. RETURN
  182.  
  183.  
  184.  
  185. /* --------------------------------------------------------- */
  186. /* Save LST_SEL to AmiNet index file or user defined batch   */
  187. /* --------------------------------------------------------- */
  188.  
  189. savelist: PROCEDURE EXPOSE srcdir
  190.  
  191. MUIA_List_Entries         = '0x80421654'
  192. MUIM_Busy_Move            = '0x80020001'
  193. ASLFR_InitialFile         = '0x80080008'
  194. ASLFR_InitialDrawer       = '0x80080009'
  195.  
  196.  
  197. /* Get batchmode */
  198.  
  199. cycle ID CYC_BAT
  200. batchmode = result
  201.  
  202. /* Save to AmiNet Index file ? */
  203.  
  204. IF batchmode = 'AmiNet Index' THEN DO
  205.   CALL saveasindex
  206.   RETURN
  207. END
  208.  
  209.  
  210. /* User configured batch mode selected... */
  211. /* Read batchmode config file.            */
  212.  
  213. filename = srcdir || "Configs/" || batchmode || ".cfg"
  214.  
  215. IF OPEN(handle, filename, 'R') THEN DO
  216.  
  217.   /* Read batchmode config in local stem variable */
  218.  
  219.   globalcfg.readme = READLN(handle)
  220.  
  221.   batchcfg.0 = 0
  222.   i          = 0
  223.  
  224.   DO UNTIL EOF(handle)
  225.  
  226.     method ID CLS_BUSY MUIM_Busy_Move
  227.  
  228.     description = READLN(handle)
  229.     value       = READLN(handle)
  230.  
  231.     IF description ~= '' & value ~= '' THEN DO
  232.  
  233.       i = i + 1
  234.       batchcfg.0 = i
  235.  
  236.       batchcfg.i.replace = '%'D2C(i+48)''   /* %1 ... */
  237.       batchcfg.i.desc    = description
  238.       batchcfg.i.val     = value
  239.     END
  240.   END
  241.  
  242.   CALL CLOSE(handle)
  243.  
  244.   OPTIONS FAILAT 11
  245.   aslrequest ID RECSCRWIN TITLE '"Save ''batchmode'' file ..."' ATTRS ASLFR_InitialDrawer srcdir ASLFR_InitialFile TRANSLATE(batchmode, '_', ' ') || '.bat'
  246.   returncode = RC
  247.   filename   = result
  248.   OPTIONS FAILAT 0
  249.  
  250.   IF returncode ~= 0 | filename = '' THEN DO
  251.     RETURN
  252.   END
  253.  
  254.   IF OPEN(writehandle, filename, 'W') THEN DO
  255.  
  256.     /* Read and Write batchmode intro file if available */
  257.  
  258.     filename = srcdir || "Configs/" || batchmode || ".intro"
  259.  
  260.     IF OPEN(handle, filename, 'R') THEN DO
  261.  
  262.       /* Do for all lines in file */
  263.       DO UNTIL EOF(handle)
  264.       
  265.         method ID CLS_BUSY MUIM_Busy_Move
  266.  
  267.         line = READLN(handle)
  268.  
  269.         /* Replace batch placeholders with value from config */
  270.         DO i=1 TO (batchcfg.0)
  271.  
  272.           /* Replace all placeholders in line */
  273.           start = POS(batchcfg.i.replace, line)
  274.           DO WHILE start ~= 0
  275.  
  276.             line  = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
  277.             line  = INSERT(batchcfg.i.val, line, start-1)
  278.             start = POS(batchcfg.i.replace, line)
  279.           END
  280.         END
  281.  
  282.         CALL WRITELN(writehandle, line)
  283.       END
  284.  
  285.       CALL CLOSE(handle)
  286.     END
  287.  
  288.  
  289.     /* Read and Write batchmode entry file if available */
  290.  
  291.     filename = srcdir || "Configs/" || batchmode || ".entry"
  292.  
  293.     IF OPEN(handle, filename, 'R') THEN DO
  294.  
  295.       /* Add entry placeholders to local stem varaible */
  296.       i = batchcfg.0 + 1
  297.       batchcfg.i.replace = '%n'     /* name      */
  298.       i = i+1
  299.       batchcfg.i.replace = '%d'     /* directory */
  300.       i = i+1
  301.       batchcfg.i.replace = '%s'     /* size      */
  302.       i = i+1
  303.       batchcfg.i.replace = '%c'     /* comment   */
  304.       batchcfg.0 = i
  305.  
  306.       /* Read batchmode entry lines in local stem variable */
  307.  
  308.       entrycfg.0 = 0
  309.       i = 1
  310.  
  311.       DO UNTIL EOF(handle)
  312.   
  313.         method ID CLS_BUSY MUIM_Busy_Move
  314.  
  315.         entrycfg.i = READLN(handle)
  316.         entrycfg.0 = i
  317.         i = i + 1
  318.       END
  319.  
  320.       CALL CLOSE(handle)
  321.  
  322.       /* Do for all entries in LST_SEL */
  323.  
  324.       list ID LST_SEL ATTRS MUIA_List_Entries
  325.       lstselcount = result
  326.  
  327.       IF lstselcount > 0 THEN DO
  328.  
  329.         DO lstselnr=0 TO lstselcount-1
  330.  
  331.           method ID CLS_BUSY MUIM_Busy_Move
  332.  
  333.           list ID LST_SEL POS lstselnr
  334.           listline = result
  335.  
  336.           /* This line must be edited if the format of the index file changes */
  337.           PARSE VAR listline WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 comment
  338.  
  339.           /* Add entry values to local stem varaible */
  340.           i = batchcfg.0
  341.           batchcfg.i.val = comment
  342.           i = i-1
  343.           batchcfg.i.val = size
  344.           i = i-1
  345.           batchcfg.i.val = STRIP(directory)
  346.           i = i-1
  347.           batchcfg.i.val = STRIP(name)
  348.  
  349.  
  350.           DO global=0 TO globalcfg.readme  /* Process *.readme file ? */
  351.  
  352.             IF global=1 THEN DO
  353.  
  354.               i        = batchcfg.0 - 1    /* Set new 'size' to 0 */
  355.               batchcfg.i.val = '  0K'
  356.  
  357.               i        = batchcfg.0 - 3    /* Set new 'name' to *.readme */
  358.               position = LASTPOS('.', batchcfg.i.val)
  359.  
  360.               IF position ~= 0 THEN DO
  361.                 batchcfg.i.val = SUBSTR(batchcfg.i.val, 1, position) || "readme"
  362.               END
  363.               ELSE DO
  364.                 batchcfg.i.val = batchcfg.i.val || ".readme"
  365.               END
  366.             END
  367.  
  368.             /* Do for all entry config lines */
  369.  
  370.             DO entrycfgnr=1 TO entrycfg.0
  371.  
  372.               line = entrycfg.entrycfgnr
  373.  
  374.               /* Replace batch and entry placeholders with value from config */
  375.               DO i=1 TO batchcfg.0
  376.  
  377.                 /* Replace all placeholders in line */
  378.                 start = POS(batchcfg.i.replace, line)
  379.                 DO WHILE start ~= 0
  380.  
  381.                   line  = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
  382.                   line  = INSERT(batchcfg.i.val, line, start-1)
  383.                   start = POS(batchcfg.i.replace, line)
  384.                 END
  385.               END
  386.  
  387.               CALL WRITELN(writehandle, line)
  388.             END
  389.           END
  390.         END
  391.       END
  392.       batchcfg.0 = batchcfg.0 - 4  /* Remove entry variables from config */
  393.     END
  394.  
  395.  
  396.     /* Read and Write batchmode extro file if available */
  397.  
  398.     filename = srcdir || "Configs/" || batchmode || ".extro"
  399.  
  400.     IF OPEN(handle, filename, 'R') THEN DO
  401.  
  402.       /* Do for all lines in file */
  403.       DO UNTIL EOF(handle)
  404.       
  405.         method ID CLS_BUSY MUIM_Busy_Move
  406.  
  407.         line = READLN(handle)
  408.  
  409.         /* Replace batch placeholders with value from config */
  410.         DO i=1 TO (batchcfg.0)
  411.  
  412.           /* Replace all placeholders in line */
  413.           start = POS(batchcfg.i.replace, line)
  414.           DO WHILE start ~= 0
  415.  
  416.             line  = SUBSTR(line,1,start-1) || SUBSTR(line,start+2)
  417.             line  = INSERT(batchcfg.i.val, line, start-1)
  418.             start = POS(batchcfg.i.replace, line)
  419.           END
  420.         END
  421.  
  422.         CALL WRITELN(writehandle, line)
  423.       END
  424.  
  425.       CALL CLOSE(handle)
  426.     END
  427.  
  428.     CALL CLOSE(writehandle)
  429.   END
  430.   ELSE DO
  431.     request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "'Cannot write file '"filename"'"
  432.   END
  433.  
  434. END
  435. ELSE DO
  436.   request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read file '"filename"'"
  437. END
  438.  
  439. RETURN
  440.  
  441.  
  442.  
  443. /* --------------------------------------------------------- */
  444. /* Save all entries from the LST_SEL to an AmiNet index file */
  445. /* --------------------------------------------------------- */
  446.  
  447. saveasindex: PROCEDURE EXPOSE srcdir
  448.  
  449. MUIA_List_Entries         = '0x80421654'
  450. MUIM_Busy_Move            = '0x80020001'
  451. ASLFR_InitialFile         = '0x80080008'
  452. ASLFR_InitialDrawer       = '0x80080009'
  453.  
  454.  
  455. OPTIONS FAILAT 11
  456. aslrequest ID RECSCRWIN TITLE '"Save selected files..."' ATTRS ASLFR_InitialDrawer srcdir ASLFR_InitialFile "RecentScript.lst"
  457. returncode = RC
  458. filename   = result
  459. OPTIONS FAILAT 0
  460.  
  461. IF returncode = 0 & filename ~= '' THEN DO
  462.  
  463.   IF OPEN(handle, filename, 'W') THEN DO
  464.  
  465.     list ID LST_SEL ATTRS MUIA_List_Entries
  466.     number = result
  467.  
  468.     IF number > 0 THEN DO
  469.  
  470.       DO i=0 TO number-1
  471.  
  472.         method ID CLS_BUSY MUIM_Busy_Move
  473.  
  474.         list ID LST_SEL POS i
  475.         line = result
  476.  
  477.         /* This line must be edited if the format of the index file changes */
  478.         PARSE VAR line WITH 1 name +18 WITH 20 directory +10 WITH 31 size +4 WITH 36 comment
  479.  
  480.         CALL WRITELN(handle,name directory size comment)
  481.       END
  482.     END
  483.  
  484.     CALL CLOSE(handle)
  485.   END
  486.   ELSE DO
  487.     request ID RECSCRWIN TITLE '"File Error"' GADGETS "_OK" STRING "'Cannot write file '"filename"'"
  488.   END
  489. END
  490.  
  491.  
  492. RETURN
  493.  
  494.  
  495.  
  496. /* --------------------------------------------------------- */
  497. /* Delete all entries in specified listview                  */
  498. /* --------------------------------------------------------- */
  499.  
  500. clearlist: PROCEDURE
  501.  
  502. parse arg listid
  503.  
  504. list ID listid STRING
  505.  
  506. RETURN
  507.  
  508.  
  509.  
  510. /* --------------------------------------------------------- */
  511. /* (De)Select entries in LST_ALL with search string          */
  512. /* --------------------------------------------------------- */
  513.  
  514. patternentries: PROCEDURE
  515.  
  516. parse arg mode
  517.  
  518. MUIA_List_Entries         = '0x80421654'
  519. MUIM_List_Select          = '0x804252d8'
  520. MUIM_Busy_Move            = '0x80020001'
  521.  
  522. list ID LST_ALL ATTRS MUIA_List_Entries
  523. number = result
  524.  
  525. string ID STR_PATT
  526. pattern = result
  527.  
  528. IF number > 0 THEN DO
  529.  
  530.   DO i=0 TO number-1
  531.  
  532.     method ID CLS_BUSY MUIM_Busy_Move
  533.  
  534.     list ID LST_ALL POS i
  535.     line = result
  536.  
  537.     IF POS(pattern, line) ~= 0 THEN DO
  538.  
  539.       method ID LST_ALL MUIM_List_Select i mode 0
  540.     END
  541.   END
  542. END
  543.  
  544. RETURN
  545.  
  546.  
  547.  
  548. /* --------------------------------------------------------- */
  549. /* Opens batch settings window for the specified batchmode   */
  550. /* --------------------------------------------------------- */
  551.  
  552. batchsettingopen: PROCEDURE EXPOSE portname srcdir
  553.  
  554. parse arg '['batchmode']'
  555.  
  556. Selected                  = '0x8042654b'
  557.  
  558. /* GUI Commands */
  559.  
  560. CMD_BUT_OK     = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL OK     ['batchmode']"'
  561. CMD_BUT_CANCEL = '"'srcdir'RecentScriptCmd 'portname' SETBATHDL CANCEL ['batchmode']"'
  562.  
  563. filename = srcdir || "Configs/" || batchmode || ".cfg"
  564.  
  565. IF OPEN(handle, filename, 'R') THEN DO
  566.  
  567.   /* Read batchmode config in local stem variable */
  568.  
  569.   globalcfg.readme = READLN(handle)
  570.  
  571.   batchcfg.0 = 0
  572.   i          = 0
  573.  
  574.   DO UNTIL EOF(handle)
  575.  
  576.     method ID CLS_BUSY MUIM_Busy_Move
  577.  
  578.     description = READLN(handle)
  579.     value       = READLN(handle)
  580.  
  581.     IF description ~= '' & value ~= '' THEN DO
  582.  
  583.       i = i + 1
  584.       batchcfg.0 = i
  585.  
  586.       batchcfg.i.replace = '%'D2C(i+48)''   /* %1 ... */
  587.       batchcfg.i.desc    = description
  588.       batchcfg.i.val     = value
  589.     END
  590.   END
  591.  
  592.   CALL CLOSE(handle)
  593.  
  594.   asdf = 'endgroup'  /* Workaround for an interpreting error (?) */
  595.  
  596.   /* Create window with string gadgets for each variable */
  597.  
  598.   window ID BATSETWIN TITLE '"Settings for '''batchmode'''"' PORT portname
  599.  
  600.     group FRAME LABEL 'Global'
  601.       group HORIZ
  602.         space HORIZ
  603.  
  604.         check ID CHK_README STRINGS '"0,1"' ATTRS Selected globalcfg.readme HELP '"Generate an extra line for the ''.readme'' file ?"'
  605.         label  "Include '#?.readme'"
  606.         space HORIZ
  607.       endgroup
  608.     endgroup
  609.  
  610.  
  611.     group FRAME LABEL 'Variables'
  612.  
  613.       DO i=1 TO batchcfg.0
  614.         group ID '"G'D2C(i+65)'"'
  615.           label CENTER '"'batchcfg.i.desc'"'
  616.           group HORIZ
  617.             label batchcfg.i.replace
  618.             string ID '"S'D2C(i+65)'"' HELP '"Replaces configuration variable ''%'D2C(i+48)''' in output"' CONTENT batchcfg.i.val
  619.           interpret asdf
  620.         interpret asdf
  621.       END i
  622.  
  623.     endgroup
  624.  
  625.     group HORIZ
  626.       button COMMAND CMD_BUT_OK     LABEL 'OK'
  627.       button COMMAND CMD_BUT_CANCEL LABEL 'Cancel'
  628.     endgroup
  629.  
  630.   endwindow
  631.  
  632. END
  633. ELSE DO
  634.   request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read file '"filename"'"
  635. END
  636.  
  637. RETURN
  638.  
  639.  
  640.  
  641. /* --------------------------------------------------------- */
  642. /* Handle buttons from the batch settings window             */
  643. /* --------------------------------------------------------- */
  644.  
  645. batchsettinghandle: PROCEDURE expose srcdir
  646.  
  647. parse arg mode '['batchmode']'
  648.  
  649. MUIM_Busy_Move            = '0x80020001'
  650.  
  651.  
  652. SELECT
  653.  
  654.   WHEN mode = 'CANCEL' THEN DO
  655.  
  656.     window ID BATSETWIN CLOSE
  657.   END
  658.  
  659.   WHEN mode = 'OK' THEN DO
  660.   
  661.     /* Save new batchmode config */
  662.  
  663.     filename = srcdir || "Configs/" || batchmode || ".cfg"
  664.  
  665.     IF OPEN(handle, filename, 'R') THEN DO
  666.  
  667.       /* Read old batchmode config in local stem variable */
  668.  
  669.       globalcfg.readme = READLN(handle)
  670.  
  671.       batchcfg.0 = 0
  672.       i = 0
  673.  
  674.       DO UNTIL EOF(handle)
  675.  
  676.         method ID CLS_BUSY MUIM_Busy_Move
  677.  
  678.         description = READLN(handle)
  679.         value       = READLN(handle)
  680.  
  681.         IF description ~= '' & value ~= '' THEN DO
  682.  
  683.           i = i + 1
  684.           batchcfg.0 = i
  685.  
  686.           batchcfg.i.replace = '%'D2C(i+48)''   /* %1 ... */
  687.           batchcfg.i.desc    = description
  688.           batchcfg.i.val     = value
  689.         END
  690.       END
  691.  
  692.       CALL CLOSE(handle)
  693.  
  694.  
  695.       /* Overwrite values with actual ones */
  696.  
  697.       check ID CHK_README
  698.       globalcfg.readme = result
  699.  
  700.       DO i=1 TO batchcfg.0
  701.         string ID '"S'D2C(i+65)'"'
  702.         batchcfg.i.val = result
  703.       END
  704.  
  705.  
  706.       /* Write new batchmode file */
  707.  
  708.       IF OPEN(handle, filename, 'W') THEN DO
  709.  
  710.         CALL WRITELN(handle, globalcfg.readme)
  711.  
  712.         DO i=1 TO batchcfg.0
  713.  
  714.           method ID CLS_BUSY MUIM_Busy_Move
  715.  
  716.           CALL WRITELN(handle, batchcfg.i.desc)
  717.           CALL WRITELN(handle, batchcfg.i.val)
  718.         END
  719.  
  720.         CALL CLOSE(handle)
  721.       END
  722.       ELSE DO
  723.         request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot write file '"filename"'"
  724.       END
  725.  
  726.     END
  727.     ELSE DO
  728.       request ID RECSCRWIN TITLE '"File Error"' GADGETS '"_OK"' STRING "Cannot read file '"filename"'"
  729.     END
  730.  
  731.     window ID BATSETWIN CLOSE
  732.   END
  733.  
  734.   OTHERWISE DO
  735.     request ID RECSCRWIN TITLE '"Internal Error"' GADGETS '"_OK"' STRING '"Unsupport command 'batchmode'"'
  736.   END
  737. END
  738.  
  739. RETURN
  740.  
  741.  
  742.  
  743. /* --------------------------------------------------------- */
  744. /* Only a testprocedure for testing new features             */
  745. /* --------------------------------------------------------- */
  746.  
  747. testprocedure: PROCEDURE
  748.  
  749. RETURN
  750.