Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Command in Text Files

Status
Not open for further replies.

hjohnson

Programmer
Aug 1, 2001
90
US
I have a process which prints to information to a text file and then saves the contents of that text file to a memo field. My question is, is there a way to store printer control command within the text file such as changing to Landscape or setting paper tray to pull from on the printer?
 
Hi;

If your printer is DOS compatible, 3 question marks will send control codes to the printer.

Lets say the escape code for yor printer to switch to landscape is <esc>'ABC'

In foxpro issue the statement

??? chr(027)+'ABC'

Again if your printer is DOS compatible these codes will be listed in the manual.

Ed Please let me know if the sugestion(s) I provide are helpful to you.
Sometimes your the windshield... Sometimes your the bug.

 
Thanks for your suggestion. I may not have made the question very clear or maybe I'm a bit unclear with the answer. I am not printing directly from program, I am creating a temporary text file, and then copying that text into a memo field. later on, I send the memo field to the printer. Line and page feeds seem to work great but nothing else.

Here is somewhat of an example of whatI am trying to do.

Set alternate to temp.txt
set alternate on
? 'This is a printing Test'
? 'Page 1'
? chr(12) &&Page Feed
? 'This is also a test
? 'Page 2- The End'
set alternate off
set alternate to

What I would like to do is to add a line after ?chr(12) something like below to change the 2nd page to landscape.
? chr(27)+&quot;&l1O&quot;

I've tried this but &l1O actually prints out.

If you can help, a million and half thanks

Hal Johnson
 
As chr(27) serve as ESCAPE,
append memo probably filter it.
(Try insert in memo ALT+27 from keyboard..)
I suggest split report into two memos,
portrait and landscape,
and escape sequence in the middle.
 
Hi Hal;

Change:
? chr(27)+&quot;&l1O&quot;

to:
??? chr(27)+&quot;&l1O&quot;


3 question marks allow you to send control codes.

Ed Please let me know if the sugestion(s) I provide are helpful to you.
Sometimes your the windshield... Sometimes your the bug.

 
dont know if this is what you were looking for but, instead of setting alternate to file
set printer to <file>
set printer on
*do your report thing
set printer to
set printer off
the file created will maintain all ctrl codes sent to printer but it will be in a text file that you can add to your memo.

the goal of any good engineer is not to get anyone killed by his work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top