home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / SRC / MEUTIL1.SRC < prev    next >
Encoding:
Text File  |  1990-05-24  |  20.5 KB  |  823 lines

  1. $MACRO_FILE MEUTIL1;
  2. {******************************************************************************
  3.                                                 MULTI-EDIT MACRO FILE MEUTIL1
  4.  
  5. LOADFILE - Prompted file loading
  6. SAVEFILE - Prompted file saving
  7. SAVEBLCK - Prompted block saving
  8. SPLICE - Prompted block loading
  9. FILESTAT - Displays and allows changes to file name and lock status
  10. EDFORMAT - Edit the format line
  11. EXEC - Run programs or dos commands.  Controls memory and swapping.
  12. SHELLDOS - Run DOS from ME (uses EXEC).
  13. RUNMAC - Prompt to run a macro
  14. REPEAT - Repeat any single keystroke
  15.  
  16.                              (C) Copyright 1989 by American Cybernetics, Inc.
  17. ******************************************************************************}
  18.  
  19. $MACRO LOADFILE TRANS;
  20. {******************************************************************************
  21.                                                                 MULTI-EDIT MACRO
  22.  
  23. Name: LOADFILE
  24.  
  25. Description:  Prompts for and loads a single file into the current window.
  26.  
  27. Parameters:
  28.                             /Y=        Y coordinate of prompt box
  29.                             /X=   X coordinate of box
  30.                             /BC=    Amount of boxes currently on screen
  31.                             /E=        If 1, indicates macro was called from Edit New File.
  32.  
  33.                              (C) Copyright 1989 by American Cybernetics, Inc.
  34. ******************************************************************************}
  35.  
  36.     Def_Str(tempstring, help_str[40]);
  37.     Def_Int(jx, kill_count, x, c_win_id );
  38.     Def_Int(Start_Row);
  39.  
  40.     Return_Int := False;
  41.     Start_Row := Parse_Int('/Y=',MParm_Str);
  42.     x := parse_int( '/X=', mparm_str );
  43.     Kill_count := Parse_Int('/BC=',mparm_str);
  44.  
  45.     If Start_Row = 0 THEN
  46.         Start_Row := 2;
  47.     END;
  48.     Set_Global_Int('LOAD_COUNT',0);
  49.  
  50.     tempstring := File_Name;
  51.     JX := 1;
  52.  
  53.     if parse_int('/E=', mparm_str) then
  54.         help_str := '/H=EDITNEW';
  55.     else
  56.         help_str := '/H=LOADFILE';
  57.     end;
  58.  
  59.     IF (Global_Str('@FM_MACRO@') <> '') THEN
  60.         Help_Str := Help_Str + '/F5=FILMGR';
  61.     END;
  62.  
  63.     IF (File_Changed <> 0) and (NOT(Parse_Int('/E=',MParm_Str))) THEN
  64.         RM('userin^CHECKFILE /X=' + str(x) +
  65.                                     '/Y=' +    Str(Start_Row));
  66.         JX := Return_Int;
  67.     END;
  68.     Return_Int := False;
  69.     IF jx THEN
  70.     QAGAIN:
  71.         Return_Str := TempString;
  72.  
  73.         RM('userin^QUERYBOX /HISTORY=FILE_HISTORY/W=60/ML=80/T=INPUT FILENAME TO LOAD/F2=Dir   /L=' + Str(Start_Row) + '/C=' + str(x)  + help_str);
  74.         If Return_Int = -1 THEN
  75.  
  76.             IF ((Key1 = 0) and (Key2 = 63)) THEN
  77.                 RM(global_str('@FM_MACRO@'));
  78.                 Goto SKIP_DIR;
  79.             END;
  80.  
  81.             if (caps(return_str) = '?NO-FILE?') or (return_str = tempstring) then
  82.                 return_str := '*.*';
  83.             else
  84.                 if NOT(file_exists(return_str)) AND (copy(return_str,length(return_str),1) <> '*') then
  85.                     return_str := return_str + '*';
  86.                 end;
  87.             end;
  88.             RM('DIRSHELL /S=2/Y=' + str(start_Row) + '/X=' + str(x) +
  89.                 '/W=62/L=100/D=' + return_str
  90.                 );
  91. SKIP_DIR:
  92.             If Return_Str <> '' THEN
  93.                 TempString := Return_Str;
  94.             END;
  95.             Goto QAgain;
  96.         END;
  97.         TempString := Return_Str;
  98.         If Return_Int THEN
  99.             while box_count > kill_count do
  100.                 kill_box;
  101.             end;
  102.             Return_Int := True;
  103.             Error_Level := 0;
  104.             refresh := true;
  105.             return_str := tempstring;
  106.             c_win_id := window_id;
  107.             RM( 'LDFILES /LC=0/CW=' + str(parse_int('/E=',mparm_str)) );
  108.             return_int := 1;
  109.         END;
  110.     ELSE
  111.         Return_Int := False;
  112.     END;
  113. EXIT:
  114. END_MACRO;
  115.  
  116.  
  117. $MACRO SAVEFILE TRANS;
  118. {******************************************************************************
  119.                                                                 MULTI-EDIT MACRO
  120.  
  121. Name: SAVEFILE
  122.  
  123. Description:  Prompts for and saves a single file from the current window.
  124.  
  125. Parameters:
  126.                             /NP=1            Bypass prompt, just save the file.
  127.                             /X=                X coordinate of prompt box
  128.                             /Y=                Y coordinate of prompt box
  129.                             /BC=            Amount of boxes currently on screen
  130.  
  131. Returns:
  132.                             Return_Int - If 1, save was unsuccessful.
  133.  
  134.                              (C) Copyright 1989 by American Cybernetics, Inc.
  135. ******************************************************************************}
  136.  
  137.     Def_Str(TempString);
  138.     Def_Int(Start_Row, Jx, kill_count, prompt_bypass);
  139.  
  140.     Return_Int := False;
  141.     Kill_count := Parse_Int('/BC=',mparm_str);
  142.     Start_Row := Parse_Int('/Y=',MParm_Str);
  143.     If Start_Row = 0 THEN
  144.         Start_Row := 2;
  145.     END;
  146.  
  147.     tempstring := File_Name;
  148.     prompt_bypass := parse_int('/NP=', mparm_str);
  149.     IF caps(file_name) = '?NO-FILE?' THEN
  150.         prompt_bypass := false;
  151.     END;
  152. Try_Again:
  153.     Return_Str := TempString;
  154.     IF prompt_bypass THEN
  155.         return_int := TRUE;
  156.     ELSE
  157.         RM('userin^QUERYBOX /HISTORY=FILE_HISTORY/C=3/H=SAVEFILE/W=60/ML=80/T=INPUT FILENAME TO SAVE/L=' + Str(Start_Row));
  158.     END;
  159.     If Return_Int THEN
  160.         rm('setfilename');
  161.         TempString := Return_Str;
  162.  
  163.         IF (First_Save) or (TempString <> Caps(File_Name))  THEN
  164.             IF File_Exists(TempString) THEN
  165. {
  166. Make_Message('[' + Str(Prompt_Bypass) + ']');
  167. }
  168.                 RM('userin^VERIFY /C=' + parse_str('/X=',mparm_str) + '/H=SAVEFILE/T=' +
  169.                     TempString + ' exists;  Overwrite? /L=' +    Str(Start_Row));
  170.                 IF Return_Int = 0 THEN
  171.                     IF prompt_bypass THEN
  172.                         goto EXIT;
  173.                     END;
  174.                     Goto Try_Again;
  175.                 END;
  176.             END;
  177.             File_Name := TempString;
  178.         END;
  179.  
  180.         Return_Int := True;
  181.         while box_count > kill_count do
  182.             kill_box;
  183.         end;
  184.         Make_Message('Saving "'+File_Name+'"...');
  185.         Save_File;
  186.  
  187.         Redraw;
  188.  
  189.         If Error_Level = 0 THEN
  190.             Make_Message('"'+File_Name+'" Saved.');
  191.         ELSE
  192.             MAKE_MESSAGE('Error occured saving file "'+File_Name+'".');
  193. {
  194.             File_Changed := True;
  195. }
  196.         END;
  197.         Return_Int := True;
  198.     ELSE
  199.         Return_Int := False;
  200.     END;
  201. EXIT:
  202. END_MACRO;
  203.  
  204. $MACRO SAVEBLCK TRANS;
  205. {******************************************************************************
  206.                                                                 MULTI-EDIT MACRO
  207.  
  208. Name: SAVEBLCK
  209.  
  210. Description:  This macro will save blocks as they are marked including column
  211.                             and stream marks. It will only copy the marked text.
  212.  
  213. Parameters:
  214.                             /X=                X coordinate of prompt box
  215.                             /Y=                Y coordinate of prompt box
  216.                             /BC=            Amount of boxes currently on screen
  217.                             /FN=            Default file name to save
  218.  
  219.                              (C) Copyright 1989 by American Cybernetics, Inc.
  220. ******************************************************************************}
  221.  
  222.     def_int(scol,srow,ecol,erow,result,mrow,mcol,orig_window,stat, kill_count);
  223.     def_str(blckname);
  224.  
  225.     messages := false;
  226.  
  227.     mrow := Parse_Int('/Y=',MParm_Str);
  228.     scol := Parse_Int('/X=',MParm_Str);
  229.     Kill_count := Parse_Int('/BC=',mparm_str);
  230.  
  231. { SET DEFAULT EXIT STATUS }
  232.     stat := 0;
  233.  
  234. { SET PROMPT ROW AND COLUMN }
  235.     if (mrow = 0) then
  236.         srow := 2;
  237.     else
  238.         srow := mrow;
  239.     end;
  240.  
  241.     if (scol = 0) then
  242.         scol := 2;
  243.     end;
  244.  
  245.     ecol := scol + 69;
  246.     erow := srow + 3;
  247.  
  248.     IF Block_Stat = 0 THEN
  249.         Return_Int := False;
  250.         Goto Exit;
  251.     END;
  252.  
  253.  
  254. { PROMPT USER FOR BLOCK SAVE FILE NAME }
  255.  
  256.     blckname := Parse_Str('/FN=',MParm_Str);
  257.  
  258.     IF blckname = '' THEN
  259. Try_AGAIN:
  260.         Return_Str := BlckName;
  261.         RM('userin^QUERYBOX /HISTORY=FILE_HISTORY/H=SAVEBLOCK/C=' + Str(Scol) + '/L=' + Str(Srow) + '/W=64/ML=80'
  262.                             + '/T=INPUT FILENAME TO SAVE BLOCK');
  263.         Result := Return_Int;
  264.         rm('setfilename');
  265.         BlckName := Return_Str;
  266.     ELSE
  267.         result := true;
  268.     END;
  269.  
  270.         {If escape was pressed in prompt then exit}
  271.     IF (result = 0) THEN
  272.         Goto Exit;
  273.     END;
  274.     refresh := false;
  275.  
  276.  
  277.     IF File_Exists(Blckname) THEN
  278.         RM('userin^VERIFY /C=' + parse_str('/X=',mparm_str) + '/H=SAVEBLOCK/T='+ 'File exists;  Overwrite? /L=' +
  279.             Str(SRow));
  280.         IF Return_Int = 0 THEN
  281.             Goto Try_Again;
  282.         END;
  283.     END;
  284.         {If the this macro was called from the menu system then kill other menu boxes}
  285.     while box_count > kill_count do
  286.         kill_box;
  287.     end;
  288.  
  289. { CREATE A NEW WINDOW - SAVE PLACE }
  290.  
  291.     orig_window := Cur_Window;
  292.     create_window;
  293.  
  294. { COULD WE CREATE THE WINDOW }
  295.     if (error_level) then
  296.         RM('MEERROR');
  297.         Return_Int := True;
  298.         goto exit;
  299.     end;
  300.  
  301. { COPY AND SAVE THE COPY }
  302.     file_name := blckname;
  303.     window_copy(orig_window);
  304.     save_file;
  305.  
  306. { COULD WE COPY AND SAVE }
  307.     if (error_level <> 0) then
  308.         Make_Message('Error occured saving block.');
  309.     else
  310.         Make_Message('Block saved.');
  311.     end;
  312.     RM('meerror');
  313.  
  314.     delete_window;
  315.     switch_window(orig_window);
  316.     Refresh := True;
  317.     Redraw;
  318.     return_int := true;
  319.     error_level := 0;
  320. Exit:
  321. END_MACRO;
  322.  
  323. $MACRO SPLICE TRANS;
  324. {******************************************************************************
  325.                                                                 MULTI-EDIT MACRO
  326.  
  327. Name: SPLICE
  328.  
  329. Description:  Loads("SPLICES") a file from disk into the current window without
  330.                             dumping the current file.  I.E. loads a file into a file.
  331.  
  332.                             /Y=                Y coordinate of prompt box
  333.                             /BC=            Amount of boxes currently on screen
  334.  
  335.                              (C) Copyright 1989 by American Cybernetics, Inc.
  336. ******************************************************************************}
  337.  
  338.     Def_Str(Temp_String,fm_str[50]);
  339.     Def_Int(Temp_Refresh,Active_Window,Temp_Window,kill_count);
  340.     Def_Int(Start_Row);
  341.  
  342.     Temp_Refresh := Refresh;
  343.  
  344.     Return_Int := False;
  345.     Kill_count := Parse_Int('/BC=',mparm_str);
  346.     Start_Row := Parse_Int('/Y=',MParm_Str);
  347.     If Start_Row = 0 THEN
  348.         Start_Row := 2;
  349.     END;
  350.  
  351.     fm_str := '';
  352.     IF (Global_Str('@FM_MACRO@') <> '') THEN
  353.         fm_Str := '/F5=FILMGR';
  354.     END;
  355.  
  356.  
  357.     Temp_String := '';
  358. QAGAIN:
  359.  
  360.     Return_Str := Temp_String;
  361.     RM('userin^QUERYBOX /HISTORY=FILE_HISTORY/C=3/H=LOADBLOCK/W=60/ML=80/T=INPUT FILENAME TO MERGE/F2=Dir   /L=' + Str(Start_Row) + fm_str);
  362.     If Return_Int = -1 THEN
  363.             IF ((Key1 = 0) and (Key2 = 63)) THEN
  364. {This is for the new file manager macro}
  365.                 RM(global_str('@FM_MACRO@'));
  366.                 GOTO QAGAIN;
  367.             END;
  368.  
  369.         if (caps(return_str) = '?NO-FILE?') or (return_str = temp_string) then
  370.             return_str := '*.*';
  371.         else
  372.             if copy(return_str,length(return_str),1) <> '*' then
  373.                 return_str := return_str + '*';
  374.             end;
  375.         end;
  376.  {     RM('DIRLIST /SD=1/CP=1/DL=1/X=3/Y=' + str(start_Row - 4) +
  377.                 '/P=' + return_str
  378.                 );
  379.         If Return_Int > 0 THEN
  380.             Temp_String := Return_Str;
  381.         END; }
  382.         RM('DIRSHELL /S=2/X=3/Y=' + str(start_Row) +
  383.             '/W=62/L=100/D=' + return_str
  384.             );
  385.      If Return_Str <> '' THEN
  386.             Temp_String := Return_Str;
  387.         END;
  388.         Goto QAgain;
  389.     END;
  390.     Temp_String := Return_Str;
  391.     If (Return_Int) THEN
  392.         Refresh := False;
  393.         while box_count > kill_count do
  394.             kill_box;
  395.         end;
  396.         Active_Window := Cur_Window;
  397.         Create_Window;
  398.         file_name := '!!SPLICE!!.TMP';
  399.         Temp_Window := Cur_Window;
  400.         Return_Int := 0;
  401.         Error_Level := 0;
  402.         return_str := temp_string;
  403.         set_global_int('LOAD_COUNT', 0);
  404.         RM('ldfiles /LC=0/MC=1/NW=1/NC=1/PRE=1');
  405.         Working;
  406.         IF error_level <> 0 THEN
  407.             RM('MEERROR^Beeps /C=1');
  408.             Make_Message('File not found, or error loading.');
  409.             Error_Level := 0;
  410.         ELSE
  411.             Goto_Col(1);
  412.             Block_Begin;
  413.             Eof;
  414.             Block_End;
  415.             Switch_Window(Active_Window);
  416.             Messages := False;
  417.             Window_Copy(Temp_Window);
  418.             Switch_Window(Temp_Window);
  419.             Make_Message('"' + file_name + '" inserted into file.');
  420.         END;
  421.         Delete_Window;
  422.         Switch_Window(Active_Window);
  423.         Refresh := Temp_Refresh;
  424.         return_int := 1;
  425.     END;
  426.  
  427. END_MACRO;
  428.  
  429. $MACRO FILESTAT TRANS;
  430. {*******************************MULTI-EDIT MACRO******************************
  431.  
  432. Name: FILESTAT
  433.  
  434. Description:  Allows the user to examine and change the current filename
  435. and lock/readonly attribute.
  436.  
  437. Parameters:
  438.                             /Y=                Y coordinate of prompt box
  439.                             /X=                X coordinate of prompt box
  440.  
  441.                              (C) Copyright 1989 by American Cybernetics, Inc.
  442. ******************************************************************************}
  443.  
  444.     Def_Int( x, y );
  445.     x := parse_int('/X=', mparm_str );
  446.     y := parse_int('/Y=', mparm_str );
  447.     IF x = 0 THEN
  448.         x := 2;
  449.     END;
  450.     IF y = 0 THEN
  451.         y := 2;
  452.     END;
  453.  
  454.     Set_Global_Str('IHELP3','/C=1/L=2/H=File currently takes up ' + str( cur_file_size ) + ' bytes on disk.');
  455.     Set_Global_Str('ISTR_1', file_name );
  456.     Set_Global_Str('IPARM_1','/T=NAME:/C=1/W=60/ML=80/L=1');
  457.     Set_Global_Str('ISTR_2','/T=LOCKED//READONLY and may NOT be modified/F=NOT LOCKED and may be modified');
  458.     Set_Global_Int('IINT_2', read_only );
  459.     Set_Global_Str('IPARM_2','/T=File is/TP=5/C=1/W=39/L=4');
  460.  
  461.     RM('UserIn^Data_In /H=FILEINFO/S=1/A=1/#=2/T=FILE INFORMATION/X=' + str(x) +
  462.                         '/Y=' + str(y));
  463.  
  464.     IF (read_only <> Global_Int('IINT_2')) THEN
  465.         RM('MEERROR^MessageBox /B=1/T=WARNING!/M=Please exercise caution when changing the LOCKED // READONLY attribute of a file.  ' +
  466.                         'If you are on a network, this action may have adverse effects on other users.');
  467.     END;
  468.     READ_ONLY := global_int('IINT_2');
  469.     cur_file_attr := (cur_file_attr AND $FFFE) OR (read_only <> 0);
  470.     IF global_str('ISTR_1') <> file_name THEN
  471.         file_name := fexpand(global_str('ISTR_1'));
  472.     END;
  473.     Return_Int := 1;
  474.  
  475. END_MACRO;
  476.  
  477.  
  478. $MACRO EDFORMAT TRANS;
  479. {******************************************************************************
  480.                                                                 MULTI-EDIT MACRO
  481.  
  482. Name: EDFORMAT
  483.  
  484. Description:  This macro allows for editing of the format line for an
  485.                             individual file.
  486.  
  487.                              (C) Copyright 1989 by American Cybernetics, Inc.
  488. ******************************************************************************}
  489.  
  490.     Def_Str(Temp_Line);
  491.     DEF_INT(TEMP_WRAP, Temp_TC, temp_changed );
  492.  
  493.     TEMP_WRAP := WRAP_STAT;
  494.     WRAP_STAT := FALSE;
  495.     temp_tc := file_changed;
  496.  
  497.     Messages := False;
  498.     UNDO_STAT := FALSE;
  499.  
  500.     Push_Labels;
  501.     Flabel('Help',1,$FF);
  502.     Mark_Pos;
  503.     While C_Row > 1 DO
  504.         UP;
  505.     End;
  506.     Temp_Line := Get_Line;
  507.     Temp_Changed := Line_Changed;
  508.     Put_Line(Format_Line);
  509.     Redraw;
  510.     Make_Message('Editing format line.');
  511.     Set_Global_Str('@EFEV#1', '/T=Don''t save/KC=<ESC>/K1=27/K2=1/R=0/W=15/X=40/Y='
  512.      + str(Message_Row));
  513.     Set_Global_Str('@EFEV#2', '/T=Save Changes/KC=<CR>/K1=13/K2=28/R=1/W=16/X=23/Y='
  514.      + str(Message_Row));
  515.     RM('CheckEvents /M=2/G=@EFEV#/#=2');
  516.  
  517. EF_Loop:
  518.     Read_Key;
  519.     If Key1 = 13 THEN
  520. ENTER:
  521.         temp_tc := true;
  522.         Make_Message('Format line changes saved.  The format line WILL BE SAVED with the file.');
  523.         GOTO Save_Exit;
  524.     END;
  525.     If Key1 = 27 THEN
  526. ESCAPE:
  527.         Make_Message('Format line changes NOT saved. Old format line restored.');
  528.         GOTO Exit;
  529.     END;
  530.     If Key1 = 9 THEN
  531.         If (Length(Get_Line) < 999) AND (C_Col < 999) THEN
  532.             Text('|16');
  533.         ELSE
  534.             Make_Message('Format line to long!');
  535.         END;
  536.         GOTO Ef_Loop;
  537.     END;
  538.     If Key1 = 8 THEN
  539.         IF C_COL > 1 THEN
  540.             Back_Space;
  541.         END;
  542.         GOTO Ef_Loop;
  543.     END;
  544.     If Key1 = 0 THEN
  545.         IF key2 = 250 THEN
  546.       IF (mou_last_x > win_x1) AND (mou_last_x < win_x2) AND
  547.             (mou_last_y = wherey) THEN
  548.         RM('MOUSE^MouseInWindow');
  549.         IF return_int THEN
  550.                     RM('MOUSE^Mouse_Move /H=1');
  551.                 END;
  552.             ELSE
  553.                 RM('CheckEvents /M=1/G=@EFEV#/#=2');
  554.                 IF (Return_Int = 1) THEN
  555.                     Goto ESCAPE;
  556.                 ELSIF (Return_Int = 2) THEN
  557.                     Goto ENTER;
  558.                 END;
  559.             END;
  560.         ELSIf Key2 = 77 THEN
  561.             If C_Col < 999 THEN
  562.                 RIGHT;
  563.             END;
  564.             GOTO Ef_Loop;
  565.         END;
  566.         If key2 = 75 THEN
  567.             If C_Col > 1 THEN
  568.                 LEFT;
  569.             END;
  570.             GOTO EF_Loop;
  571.         END;
  572.         If key2 = 83 THEN
  573.             If NOT( At_Eol ) THEN
  574.                 Del_Char;
  575.             END;
  576.             GOTO EF_Loop;
  577.         END;
  578.         If key2 = 79 THEN
  579.             EOL;
  580.             GOTO EF_Loop;
  581.         END;
  582.         If key2 = 71 THEN
  583.             GOTO_COL(1);
  584.             REDRAW;
  585.             GOTO EF_Loop;
  586.         END;
  587.         If key2 = 82 THEN
  588.             Insert_Mode := NOT( Insert_Mode);
  589.             GOTO EF_Loop;
  590.         END;
  591.         If key2 = 116 THEN
  592.             IF C_Col < 999 THEN
  593.                 RIGHT;
  594.                 While (Cur_Char <> '|0') and (C_Col < 999) and (Cur_Char <> '|16') DO
  595.                     RIGHT;
  596.                 END;
  597.             END;
  598.             GOTO EF_Loop;
  599.         END;
  600.         If key2 = 115 THEN
  601.             If C_Col > 1 THEN
  602.                 LEFT;
  603.                 While (Cur_Char <> '|0') and (C_Col > 1) and (Cur_Char <> '|16') DO
  604.                     LEFT;
  605.                 END;
  606.             END;
  607.             GOTO EF_Loop;
  608.         END;
  609.         If key2 = 59 THEN
  610.             Help('FM');
  611.         END;
  612.         GOTO Ef_Loop;
  613.     END;
  614.  
  615.     If (Length(Get_Line) < 999) AND (C_Col < 999) THEN
  616.         Text(Char(Key1));
  617.     ELSE
  618.         Make_Message('Format line to long!');
  619.     END;
  620.  
  621.     GOTO EF_Loop;
  622. Save_Exit:
  623.     Format_Line := Get_Line;
  624.     TEMP_WRAP := WRAP_STAT;
  625.     Format_Stat := True;
  626. Exit:
  627.  
  628.     Put_Line(Temp_Line);
  629.     RM('CheckEvents /M=3/G=@EFEV#/#=2');
  630.     Line_Changed := Temp_Changed;
  631.     file_changed := temp_tc;
  632.     Goto_Mark;
  633.     WRAP_STAT := TEMP_WRAP;
  634.     UNDO_STAT := TRUE;
  635.     Messages := True;
  636.     Pop_Labels;
  637.     redraw;
  638. END_MACRO;
  639.  
  640. $MACRO EXEC TRANS;
  641. {******************************************************************************
  642.                                                                 MULTI-EDIT MACRO
  643.  
  644. Name: EXEC
  645.  
  646. Description:  Executes a DOS command or program
  647.  
  648. Parameters:        Return_Str = the command line
  649.                             /MEM=nn    The amount of memory needed to run the program.
  650.                                             (in paragraphs).
  651.                                         0=ALL available.
  652.                             /SWAP=nn  The swap method to use
  653.                                                 0 = Use default method
  654.                                                 1 = No swap
  655.                                                 2 = Swap to disk only
  656.                                                 3 = Swap to ems only
  657.                                                 4 = Swap to ems then to disk
  658.                             /CMD=1        Use COMMAND.COM (or COMSPEC equivalent).
  659.                             /SCREEN=1 Restore old dos screen.
  660.                                          =2 Clear screen, put cursor at top
  661.  
  662.                              (C) Copyright 1989 by American Cybernetics, Inc.
  663. ******************************************************************************}
  664.  
  665.     def_int(
  666.                     screen_mode,
  667.                     t_swap_mode,
  668.                     t_swap_mem,
  669.                     jx,
  670.                     t_status_row,
  671.                     tr
  672.                 );
  673.  
  674.     tr := refresh;
  675.     refresh := false;
  676.     t_swap_mem := swap_mem;
  677.     t_swap_mode := swap_mode;
  678.     t_status_row := status_row;
  679.     status_row := 0;
  680.     RM( 'XlateCmdLine' );
  681.  
  682.     screen_mode := parse_int('/SCREEN=', mparm_str );
  683.     swap_mem := parse_int('/MEM=', mparm_str);
  684.     jx := parse_int( '/SWAP=', mparm_str );
  685.     IF jx > 0 THEN
  686.         swap_mode := jx - 1;
  687.     END;
  688.  
  689.     IF screen_mode = 1 THEN
  690.         save_box(1,1,screen_width,screen_length);
  691.         rest_dos_screen;
  692.     ELSIF screen_mode = 2 THEN
  693.         save_box(1,1,screen_width,screen_length);
  694.         clear_screen( dos_color + (dos_back shl 4 ));
  695.         gotoxy(1,1);
  696.     END;
  697.     shell_to_dos( return_str, parse_int( '/CMD=', mparm_str ) );
  698.     IF screen_mode = 1 THEN
  699.         save_dos_screen;
  700.         kill_box;
  701.     ELSIF screen_mode = 2 THEN
  702.         kill_box;
  703.     END;
  704.     swap_mem := t_swap_mem;
  705.     swap_mode := t_swap_mode;
  706.     status_row := t_status_row;
  707.     refresh := tr;
  708. END_MACRO;
  709.  
  710.  
  711. $MACRO SHELLDOS TRANS;
  712. {******************************************************************************
  713.                                                                 MULTI-EDIT MACRO
  714.  
  715. Name: SHELLDOS
  716.  
  717. Description:  Run DOS from EDIT mode, restoring the original DOS screen.
  718.  
  719.                              (C) Copyright 1989 by American Cybernetics, Inc.
  720. ******************************************************************************}
  721.     def_int(tr);
  722.     tr := refresh;
  723.     refresh := false;
  724.     return_str := global_str( '@SHELL_TO_DOS_CMD' );
  725.     IF return_str = '' THEN
  726.         return_str := '<COMSPEC> /E:1000 /c <ME_PATH>DOSPROMPT';
  727.     END;
  728.     RM('EXEC /SWAP=0/MEM=' + str(swap_mem) + '/SCREEN=1');
  729.     refresh := tr;
  730. END_MACRO;
  731.  
  732. $MACRO RUNMAC TRANS;
  733. {******************************************************************************
  734.                                                                 MULTI-EDIT MACRO
  735.  
  736. Name: RUNMAC
  737.  
  738. Description:  Prompt for and run a macro.
  739.  
  740.                             /Y=                Y coordinate of prompt box
  741.                             /BC=            Amount of boxes currently on screen
  742.  
  743.                              (C) Copyright 1989 by American Cybernetics, Inc.
  744. ******************************************************************************}
  745.  
  746.     Def_Int( Y1, kill_count );
  747.  
  748.     Kill_count := Parse_Int('/BC=',mparm_str);
  749.     Y1 := Parse_Int('/Y=',MParm_Str);
  750.     If Y1 = 0 THEN
  751.         Y1 := 2;
  752.     END;
  753.  
  754.     Return_Str := Global_Str('MAC_RUN');
  755.     RM('userin^QUERYBOX /HISTORY=MACRO_HISTORY/H=MC/C=3/L=' + Str(Y1) + '/ML=254/W=65/T=RUN MACRO');
  756.     Set_Global_Str('MAC_RUN',Return_Str);
  757.     IF (Return_Int) THEN
  758.         while box_count > kill_count do
  759.             kill_box;
  760.         end;
  761.         RM(Return_Str);
  762.     END;
  763.     return_int := 100;
  764. END_MACRO;
  765.  
  766. $MACRO REPEAT TRANS;
  767. {******************************************************************************
  768.                                                                 MULTI-EDIT MACRO
  769.  
  770. Name:  Repeat
  771.  
  772. Description:  Performs a simple, single key command repeat function.
  773.  
  774.                              (C) Copyright 1989 by American Cybernetics, Inc.
  775. ******************************************************************************}
  776.  
  777.     def_int(
  778.                     k1,k2,          { Key codes to be repeated }
  779.                     count           { Number of repeats }
  780.                     );
  781.  
  782.     def_str(
  783.                     count_str       { Stores the inputed string }
  784.                     );
  785.  
  786.     count := 0;
  787.     count_str := '1';       { Start with a count of one }
  788.         {Now read keys.  Build count_str until a non numeric key is pressed.
  789.          Use that key to repeat}
  790. LP1:
  791.     make_message('Repeat command ' + count_str + ' times;  Type command, count or <ESC>.');
  792.     read_key;
  793.     if ((key1 > 47) and (key1 < 58) and (key2 < 12)) then
  794.         if count = 0 then
  795.             count_str := CHAR(key1);
  796.         else
  797.             count_str := count_str + CHAR(key1);
  798.         end;
  799.         ++count;
  800.         goto lp1;
  801.     else
  802.         make_message('');
  803.         if (key1 = 27) and (key2 = 1) then
  804.             goto exit;
  805.         end;
  806.         if val(count,count_str) = 0 THEN
  807.             k1 := key1;
  808.             k2 := key2;
  809.             Push_Undo;
  810.             while count > 0 do
  811.                 Pass_key(k1,k2);
  812.                 while check_key do                {We must do this to avoid problems with}
  813.                     pass_key(key1,key2);        {  nested keystroke macros }
  814.                 end;
  815.                 count := count - 1;
  816.             end;
  817.             Pop_Undo;
  818.             redraw;
  819.         end;
  820.     end;
  821. exit:
  822. END_MACRO;
  823.