Q35261: Macro to Print Part or All of a File from within M
Article: Q35261
Product(s): See article
Version(s): 1.00 1.02 | 1.00 1.02
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_basic
Last Modified: 21-AUG-1989
Microsoft Editor Version 1.00 contains no built-in primitives for
printing; there is no actual "print" command. However, a set of steps
can be performed involving the shell function, and a macro can be
written to execute the steps conveniently. The 1.02 version of the
Microsoft Editor does contain a print function. For more information
on Version 1.02's print function, please see Section 4.9, "Printing a
File," in the "Microsoft Editor User's Guide for MS OS/2 and MS-DOS
Operating Systems."
The following is a sample macro for the 1.00 Editor:
print1:=copy arg "<clipboard>" setfile
print2:=arg arg "PRINT.TMP" setfile
print3:=arg "print PRINT.TMP" shell
print4:=arg "del PRINT.TMP" shell setfile
print:=print1 print2 print3 print4
Note: The DOS PRINT command is a resident program. If you shell out of
M and invoke the PRINT command for the first time, PRINT will be
loaded above M and you will fragment memory. To prevent this, invoke
the PRINT command before entering M, so that it will be loaded into
low memory.
The following explains the above example:
1. copy: This copies the currently selected region into the
clipboard. This way, you can select a region, using a boxarg or
linearg, and then execute this macro to print it. Because the
selected region defines what is to be printed, it can be modified
to suit your needs.
2. arg "<clipboard>" setfile: This loads the <clipboard> pseudo file
as the current file.
3. arg arg "PRINT.TMP" setfile: This saves the contents of the current
file (which is now <clipboard>) to the file PRINT.TMP.
4. arg "print PRINT.TMP" shell: This executes a DOS shell that prints
PRINT.TMP.
5. arg "del PRINT.TMP" shell setfile: This executes a DOS shell that
deletes PRINT.TMP, then uses Setfile to return to the original file.
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.