This file contains information about: PRINT : General Tips on Printing From FoxPro ******** THREADS2.DBF, 2.0 BETA MESSAGES ******** Msg#: 13406 Date: 29-Apr-91 Fm: Joe Gotthelf [DSA] 74017,3670 To: Kevin Sleeper 70020,535 ? (PRINT) outputs a LF before it prints the line, thusly incrementing _PLINENO ?? (print), and @ do not do this. ?? Just starts printing @ goes to whatever line and prints. Neither of them put a LF out, which is how they are designed. Thusly, they do not increment _PLINENO Other things that I think work with _PLINENO are list to print disp to print repo form joebob to print (anything 'to print' I think) ******** THD201.DBF ******** Msg#: 108263 Date: 10-Jun-91 Fm: Toni Taylor [Fox] 76702,1237 To: Steve Freides 76070,231 (X) Steve, You could return a Form Feed, however, unless you set _PADVANCE="LINE FEEDS," you may not advance to the Top of Form. You also need to be careful how many CHR(13)'s you send if there is a page footer on the report. You could end up with the page footer of one page and the page header of the next printed back to back. Toni- Msg#: 120035 Date: 21-Jul-91 Fm: ANTHONY DELGAUDIO 70312,1077 To: all I am using the on escape command to stop a printout routine. If the user its escape when the printer is printing he or she may stop the report. Is there any way to find out if the user hits the online button or the printer got jamed with paper turning the print out?? I used printstatus() only to see if it is online or offline, but turning the printing I do not know what to do. Does anyone have any ideas?? Thanks anthony Msg#: 120155 Date: 21-Jul-91 Fm: tom meeks 70304,2176 To: ANTHONY DELGAUDIO 70312,1077 (X) Since the only thing that can be checked is the availability of the printer I don't think you'll be able to determine the reason for the offline printer status message. You can, however, use an ON ERROR DO command to jump to a procedure that checks to see if ERROR() = 125. If so, activate a window with directions for the user to fix the printer problem. Finally, allow the user to abort or retry the printer after a fix through a small menu. Tom Msg#: 108163 Date: 10-Jun-91 Fm: Steve Freides 76070,231 To: John Stuppy 70461,2757 (X) I've had success issueing a CHR(13) to make sure I'm in column 1. CHR(13) bring the printhead flush left w/o issueing a line feed (CHR(10)). Works for me. Msg#: 120154 Date: 21-Jul-91 Fm: tom meeks 70304,2176 To: jeff goza 75056,3555 (X) Jeff, If you want to print anywhere (and at anytime) on a page with a laser printer you can simply print *all* lines with... @ 0,0 SAY. It is xBase that worries about the y-axis in the @ y,x SAY construct... not the laser printer. There are a number of ways to do it. Here is one example that would jump 'up' the page 3 lines. @ 0,0 SAY CHR(27)+'&a5r10C'+'Test on Row = 5, Col = 10' @ 0,0 SAY CHR(27)+'&a3r10C'+'Jump up to Row = 3' The positioning code *follows* the SAY instead of preceding it. Tom Msg#: 138904 Date: 26-Aug-91 Fm: Ben Charron 72540,1155 To: Dave Marsh 72510,2326 (X) Good morning Dave, (At least it's morning right now!) About PRINTJOB/ENDPRINTJOB, now that we know that SET PRINTER ON has to be issued _before_ your printjob, it all works fine. I tried it out and it works like a charm - just remember to set the printer. It beats using ??? because PRINTJOB will send the _PSCODE and _PECODES to a file if the printer is redirected (SET PRINTER TO whereas ??? goes straight to the printer - no detours. As a matter of fact, if you've been following this thread, PRINTJOB will send to the active window/screen if SET PRINTER is OFF - that's how this whole thing got started in the first place. Regards, ...Ben Msg#: 142085 Date: 01-Sep-91 Fm: Dave Marsh 72510,2326 To: jason jones 70670,3023 Jason, Are you running your report from within a PRINTJOB...ENDPRINTJOB construct? Most, if not all, of the system variables having to do with printing assume you'll do this. If not, I can almost guarantee this is your problem. Try something like: _PBPAGE = 3 _PEPAGE = 6 PRINTJOB REPORT FORM ENDPRINTJOB You should only get pages 3-6 of the report. Dave ******** THD202.DBF ******** Msg#: 159226 Date: 09-Oct-91 Fm: WALTER MILLER 72010,1420 To: Benjamin Diss 71270,341 (X) Ben, this the 1st part of the other msg. I sent this to myself by mistake. SET ESCA ON/OFF is really a different matter. The way I've used it is to allow users to abort out of report printing. E.G., in housekeeping setup I'll say: SET ESCA OFF ON ESCA DO ABRT_PROC PROC ABRT_PROC prompt for continue printing or cancel (e.g.) process the selection RETU PRN_PROC this is the actual print program SET ESCA ON code to print report SET ESCA OFF That's all there is to it..to activate your esc proc, just SET ESCA ON. SET ESCA ON/OFF applies to your esca proc. ******** THD203.DBF ******** Msg#: 181013 Date: 21-Nov-91 Fm: Cathy Selhorst [Fox] 76177,3002 To: Michael 76137,3006 (X) -Michael Yes, you can embed printer control codes in a memo field. Here is what I did to accomplish this. I am working with a HP LaserJet II so I used the escape codes to change the Stroke Weight, asc(27)(s3B for Bold and asc(27)(s0B for Medium. I embedded these codes in a memo field then tried printing the memo through a REPORT FORM and using ? with SET PRINT ON. The string that I used looked like this, 'This is a asc(27)(s3B test asc(27)(s0B of control codes.' In both cases, when the memo printed, the printer read the escape codes and changed the Stroke Weight accordingly. Hence, the word 'test' was printed Bold and the other words appeared as normal. Note: in the memo field you would use the left arrow character that represents ASCII 27 in place of asc(27). I hope that you find this information helpful. If you have any further questions, don't hesitate to ask. Msg#: 171922 Date: 03-Nov-91 Fm: Calvin Hsia 72251,1725 To: Paul Rosner 76046,3643 << ! (foxswap) copy &f_name prn>nul>> Try: set head off && turn off page numbers and headers (Undocumented, BTW) mhead=set("head") set head off set print to &mprint && can be the name of network printer or "prn" set print on type &f_name set print off set print to set head &mhead set cons on This is faster because it doesn't need to swap out. Aloha, Calvin Msg#: 177598 Date: 14-Nov-91 Fm: Jackie Jaynes [Fox] 76177,2777 To: Lisa Slater 72077,2417 Lisa, If _PADVANCE="FORMFEEDS", then FoxPro calls PDPAGEST() and PDPAGEEND() or if _PADVANCE="LINEFEEDS", then FoxPro calls PDLINEST() and PDLINEEND() for the number of lines to get to the next page. FoxPro is smart enough to do this for you. Jackie Msg#: 170857 Date: 01-Nov-91 Fm: Randy Pearson 73020,642 To: Barry Pollack 73340,460 I include a "scratch" field in _every_ table I create. I typically call the field "PRINT" and make it Character-1 (thus allowing more than 2 states). It's great to have this field available in advance, rather than having to MODIFY STRUCTURE at an inconvenient time. The field name of "PRINT" stems from a request I got from a client one time. I thought I had provided every option possible, but he wanted a printout of just records 1, 13, 1347, and 2549; there was no commonality suggested by any data elements. I sometimes even include the field in screens and query selection routines, so that users can make ad-hoc markings of selected records for processing without having to do any programming or Command Window manipulations. Randy Msg#: 183782 Date: 28-Nov-91 Fm: Jim Slater 76367,1735 To: Tom Canning 71650,1610 Tom - Their answer, in short, is that the printer driver system and the ON PAGE AT LINE commands are totally unaware of each other, and cannot co-exist peacefully. What I have determined is that when you issue an EJECT PAGE command, it resets _PLINENO to 1 (0?) and increments _PAGENO, but it doesn't affect the page and line counters in the printer driver. As a result, the printer driver thinks it is still on the previous page with a few lines to go, and merrily proceeds to issue a second Form Feed in a few more lines. I have spent countless hours fooling with the Xbase printer driver, with trying to change _PDPARMS in an ON PAGE AT LINE procedure, etc. As far as I can tell, there's just no way. If you want to use ON PAGE, you need to set _PDRIVER="" and handle all control codes manually. Cathy implied they were looking at making the two compatible. I sure hope so. I think it's presumptuous to assume that all printing needs can be handled by the Report Writer. Foxpro doesn't support some of the Dbase IV variables like _PPITCH because they are handled in other ways by the printer drivers. However, they haven't provided any printer-driver alternative to ON PAGE when coding manual reports, and I think this is a serious omission. We need other people to request this enhancement. Seems like there could be a nice match - a procedure called by ON PAGE AT LINE NN could be handled by the printer driver PDPAGEST() or PDPAGEEND(), or some such, and changes to _PAGENO and _PLINENO could automatically update the driver. Easy for me to say, of course, since I have no idea how all this is handled internally . However, my complaints in no way diminish my respect for the amazing language that FP 2.0 is... _PLINE Msg#: 184407 Date: 30-Nov-91 Fm: Jeff Davis 70242,1470 To: Joel Goldwein 76506,2305 (X) Hi Joel... To print the files directly, try using low-level file functions. handle = FOPEN("graphics.pcx") buffsize = 1024 * You may need to play with the buffer size * to fine-tune performance DO WHILE .NOT. FEOF(handle) print_str = FREAD(handle,buffsize) ?? print_str ENDDO =FCLOSE(handle) I don't have your original message handy, and I couldn't remeber if you said you tried this or not, So I apoligize in advance if I'm being redundant. Later... JD =:) ******** THD204.DBF ******** Msg#: 195117 Date: 23-Dec-91 Fm: Menachem Bazian 76366,42 To: JONATHAN ALLEN 74040,1515 Here's how I do it. I use low level file I/O for this. All you need to know about this is that lcFile is a parameter which has the name of the file to download to the printer. Hope this helps! * Send2Prt.Prg * Sends a file to the printer using Low Level File I/O PARAMETER lcFile lcOutPort = UPPER(ALLTRIM(SET("PRINT",1))) IF RIGHT(lcOutPort,1)=':' lcOutPort = LEFT(lcOutPort,LEN(lcOutPort)-1) ENDIF lnOutHand = FOPEN(lcOutPort,11) lnInHand = FOPEN(lcFile,10) *----------------------- * Now download the file *----------------------- DO WHILE !FEOF(lnInHand) =FWRITE(lnOutHand,FREAD(lnInHand,5000)) ENDDO =FCLOSE(lnInHand) =FCLOSE(lnOutHand) ******** THD205.DBF ******** Msg#: 210362 Date: 28-Jan-92 Fm: Dan Harris 76356,122 To: Chris Pudlicki [Fox] 76702,1237 (X) I figured out that the setting of _WRAP matters in dealing with the ?? '' function 'V(n)' So thanks Dan H. Msg#: 211691 Date: 31-Jan-92 Fm: Calvin Hsia 72251,1725 To: Franz Schredl 70020,535 (X) Franz, Often what is meant by ignoring line feeds is that they are ignored only if followed by a CR. There are a lot of historical reasons behind this. Msg#: 201146 Date: 08-Jan-92 Fm: Joe Gotthelf [DSA] 74017,3670 To: GEORGE HENDERSON 70632,2370 (X) George, As far as I know there is not way to clear PROW() & PCOL() w/o an EJECT, but you can fool fox with a simple routine: procedure plEject * * Do an EJECT to reset PROW() & PCOL() & other system variables * private all like l* lcOldPrint = set("print", 1) set print to nul && NUL device creates no file eject setc print to (lcOldPrint) ADDITIVE * * Depending on your application you may at this time want to decrement * _PAGENO, and perhaps save _PLINENO before the EJECT & restore it after * the eject. (I just typed this into Tapcis - but it should work...) ******** THD206.DBF ******** Msg#: 222081 Date: 21-Feb-92 Fm: Chip Doolittle 73347,2775 To: dave reinhardt 71107,1642 (X) Dave, here's the code I use in get the stuff from the p_codes dbf into memvars. PROCEDURE pcodes SELECT 0 USE LOCFILE('P_CODES.DBF','DBF','Where is the Printer code?') ALIAS pcodes CLEA DEFINE POPUP pcodes FROM 1,10 TO 23,50 PROMPT FIELD p_name TITLE 'Choose printer ON SELE POPUP pcodes DEAC POPUP pcodes ACTI POPUP pcodes p_driver = PROMPT() p_init = TRIM(pcodes.p_setup) p_10cpi = TRIM(pcodes.p_10cpi) p_12cpi = TRIM(pcodes.p_12cpi) p_compress = TRIM(pcodes.p_compress) p_boldon = TRIM(pcodes.p_boldon) p_boldoff = TRIM(pcodes.p_boldoff) p_ulineon = TRIM(pcodes.p_ulineon) p_ulineoff = TRIM(pcodes.p_ulineoff) SAVE TO ptprint ALL LIKE p_* USE RETURN In your reports you can now include the these memvars, and your printer will behave the way you want. Ok? ---Chip ---Omaha,NeMsg#: 222168 Date: 21-Feb-92 Fm: dave reinhardt 71107,1642 To: Chip Doolittle 73347,2775 (X) Chip, the dawn begins to light. I was using the ???CHR(nn) approach. but then I had to write a bunch of code to cover each printer. I thought there was a way of using the field names in the P-code.dbf but could not figure it out. Your example cleared the way for a greater understanding of the _pdparms. I see in the example you use, you only get the p_codes you want instead of storing all of them. I like that, but is there ever a reason, or is it even possible to use the _pdparms array directly, Like _pdparams(14) for bold on and _pdparams(15) for bold off. To answer your first question. I have not got to using print codes in the report writer yst. I am using the codes in my applications which means each one needs a selection of printers coded in. Thank you, you have been a great help. +{:-)daveMsg#: 220656 Date: 19-Feb-92 Fm: Mike Dwyer 76100,3126 To: Fox Can someone tell me the advantage of using ON ESCAPE vs ON KEY LABEL ESC? Is it just the availability of the trap during sysmenus, etc? I have a problem when it comes to abandoning a print program cleanly. For example, consider the following code: ON ESCAPE DO FOOBAR SET PRINT ON DO WHILE !EOF() ? NAME ? ADDRESS ? CITY,STATE,ZIP SKIP ENDDO Where FOOBAR is a function which asks the user if he/she wants to terminate the printing. The problem is that if escape triggers FOOBAR during any of the print statements, execution will still continue on to the next line. What I want if for FOOBAR to somehow cause the program to break out of the loop immediately. In clipper, we had a program structure called BEGIN/END SEQUENCE, BREAK. where a chunk of code was surrounded by BEGIN SEQUENCE/END SEQUENCE. If at any point during that chunk of code, a BREAK was issued, program execution proceeded at the line following END SEQUENCE. This allowed a HOT KEY to break out of, say, a print job at _ANY_ point cleanly. This might be a good future enhancement? -Mike Msg#: 220744 Date: 19-Feb-92 Fm: Dorn W. Stickle 70473,3077 To: Mike Dwyer 76100,3126 How about if you set the printer to a temporary file in your FOOBAR function that is called by the escape key. Then the printing will stop going to the printer. You can then check for that specific file and delete it if it is there. Have a good day! Dorn.....Msg#: 220774 Date: 19-Feb-92 Fm: Jim Thompson 71441,1760 To: Mike Dwyer 76100,3126 If you put that block of code in its own procedure, then you could use RETURN TO to exit the loop. ******** THD07.DBF ******** Msg#: 229289 Date: 08-Mar-92 Fm: Kent Huff 70670,1710 To: all Is there a way to print in the background using Foxpro 2.0, and allow the user to do other things while the report is printing? Msg#: 229575 Date: 09-Mar-92 Fm: Calvin Hsia 72251,1725 To: Kent Huff 70670,1710 (X) Kent, check out the DOS PRINT command. It's a TSR, so you'll have to run it first. It essentiallys is a print spooler, so Fp can d other stuff while printing. Msg#: 245546 Date: 09-Apr-92 Fm: Lisa Slater 72077,2417 To: Gordon Abbott 70244,3532 (X) Don't head for the .BIN file so quick . I'd try COPY FILE the_file TO LPT1 ADDITIVE first off. I can't remember why the ADDITIVE and there might be problems over the network or something. Also try: SET HEADINGS OFF TYPE the_file TO PRINT (with no pdsetup in force, natch ). Another possibility would be to chunk up the file into memvars, using the LLFFns, and then ??? directly, using STRTRAN() to turn every instance of "{" into "{{}" and every instance of "}" into "{}}", of course. So you see you *can* use the LLFFns, just not quite the way you were thinking... So many ways, so little time... you're quite welcome . >L< Msg#: 245685 Date: 09-Apr-92 Fm: Carl Karsten 70471,516 To: Lisa Slater 72077,2417 (X) >L<,If you do this: x='abc{def' x=strt(x,'{','{{}') x=strt(x,'}','{}}') You get x="abc{{{}}def" which still gives a syntax error. It was my original solution too though. ^C Msg#: 245693 Date: 09-Apr-92 Fm: Lisa Slater 72077,2417 To: Carl Karsten 70471,516 (X) Carl, I swear that this works. Were you ???ing it or something else? If it doesn't work in your situation, try this: x = 'abc{def' x = strt(x,'{','########') x = strt(x,'}','@@@@@@@@') x = strt(x,'@@@@@@@@','{RBRACE}') x = strt(x,'########','{LBRACE}')>L< Msg#: 246900 Date: 13-Apr-92 Fm: Bob Velke 76366,1760 To: Lisa Slater 72077,2417 (X) >> ??? "{LBRACE}this is a string delimited by braces{RBRACE}" For the record, the "Syntax Error" doesn't apply to the right brace. But I can see the advantage to being consistent. -Bob Msg#: 267892 Date: 01-Jun-92 Fm: Dave Watkins [Fox] 76004,2575 To: Joseph Ruffolo 74040,136 (X) Joseph, The only way to reset PROW() and PCOL() is with the EJECT command. Kevin [Fox] Msg#: 233638 Date: 17-Mar-92 Fm: Dave Watkins [Fox] 76004,2575 To: Mike Dwyer 76100,3126 Mike, The PROW() does not respect multiple printers. The only way I know of to get around it is to issue an EJECT right after you SET PRINTER TO the next printer. This will ensure you that you are at the top of the form and PROW() will be reset to 0. Dave Msg#: 257019 Date: 06-May-92 Fm: Ken Buch 76346,3411 To: Clifford Redfield 76270,1656 (X) Clifford, I have had good luck repositioning the HPIII cursor by using the ??? to issue PCL commands like : CHR(27)+"&a0C" for column 0, and CHR(27)+"&a0R" for row 0. Regards, Ken Msg#: 257382 Date: 07-May-92 Fm: Calvin Hsia 72251,1725 To: Clifford Redfield 76270,1656 (X) Clifford: When using the horiz & vertical positioning you do *not* use @say as well. Just do this: put("text",12,10) put("more",5,50)proc put ???chr(27)+"&a"+allt(str(col))+'C'+chr(27)+"&a"+allt(str(row))+'R' *Or (because escape sequences can be concatenated): * ???chr(27)+"&a"allt(str(col))+'c&a'+allt(str(row))+'R' retu This proc will put stuff at the right column and row. If you want finer positioning, you can use the decipoint addressing by using H and V instaed of R and C. Msg#: 231707 Date: 12-Mar-92 Fm: Syd Bosloy 70572,3444 To: technical help I have a problem setting the horizontal tabs on my NEC printer. The escape sequence is chr(27) + "D" + chr(30) + chr(45) + chr(0). This will set two tabs, one at 30 and the other at 45. This does not work in foxpro2. I have done the same thing in Clipper and in basic and it works fine. What is going on? Before I send this sequence, I do: SET PRINTER ON and then I send it using ?? (? or ??? are the same) Msg#: 232045 Date: 13-Mar-92 Fm: Chris Pudlicki [Fox] 76702,1237 To: Syd Bosloy 70572,3444 (X) Syd - FoxPro uses spaces instead of the tab character in output. Therefore, it will not honor the tab placement that is on your printer. The only way to control this is to specify values for _TABS within FoxPro. Elaine [Fox] Msg#: 233591 Date: 17-Mar-92 Fm: Chris Pudlicki [Fox] 76702,1237 To: Syd Bosloy 70572,3444 (X) -Syd Internally to FP tabs are converted to spaces which are stored and sent out that way. You could avoid FoxPro's interpretation of the tab by sending the tab character directly to the printer with the ??? command. --Chris Msg#: 269344 Date: 04-Jun-92 Fm: Andrew Flower 100036,566 To: Tamar E, Granor 73227,3303 (X) FWIW I've uncovered the reasons why our 1.02 reports were prematurely ejecting (hope I spelled that right....) in FP 2.0. The functions I was using to draw boxes/shading/lines etc., were sending the control codes to the printer with SET PRINT ON. These activities were supposed to increment prow() but did _not_ in FP 1.02, but do in FP 2.0. Thus, when the program next sent an @ mrow,n SAY in FP 2.0 the value of mrow was less than prow() => eject the page. Also, when I ejected a page in FP 1.02 I sent CHR(12) to the printer, and prow() evidently reset to 0 - but not in FP 2.0, thus prow() values were getting up into the thousands! Using EJECT in FP 2.0 does reset prow() to 0, so that also has been fixed. regards, Andrew F. Msg#: 262959 Date: 20-May-92 Fm: Manjnath Ajjampur 72117,1064 To: Bob Ghodsi 72421,3045 Hi, I hate jumping into the middle of a thread like this, but... I had reported the PRINTSTATUS() reporting a .T. with no printer attached anywhere, no PRN2FILE look alikes, etc. In my particular case, the problem was with a local tape back up controller card using IRQ5. When this IRQ was changed, the whole problem disappeared. I also wonder if network drivers (NET5.COM & IPX) have anything to do with PRINTSTATUS() returning a false .T. If that is the case, will tinkling with the LOCAL PRINTERS=0 command in SHELL.CFG (on Netware only) solve the problem? Oh well... just some random thoughts.. Cheers.