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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printfile & Number of Copies

Status
Not open for further replies.

abbas69

Programmer
May 5, 2006
8
GB
Dear Members

I and Working on FPD 2.6 under XP(pro) Environment.
I have installed Tamedos 5.0 which allows my program to under under XP Env very well.

as There is a USB Samsung Printer Attached to the XP. as reading a Thread in this Form I am using Printfile Freeware program which I like very much as that you can use any USB Printer with a DOS Program (Thanks to Ramani)

My problem is here....


I have a System Paramters DBF file where user can set the No of Copies of a Report like 1 or 2 or 3 or any upto 99.

My Program is Pickup the No of copies from the System Parameter file and then run a loop with report form

my previous program was like this


x=1
do while x < mcopies
Report Form abc to printer noconsole noejct
x=x+1
enddo

when I was using Window 98 or Win ME Environement it works very well. but when now I am using Printfile program I have to spool to a txt file like this

x=1
do while x < mcopies
Report Form abc to c:\spool\prt.txt noconsole noejct
x=x+1
enddo

but when the printer (USB) prints It only prints 1 copy. what I can under stand is as the PC is too fast it overwites the PRT.TXT File twice and way I can over come this issue.



 
abbas69,
possibilities are insert into cycle:
1)wait "" timeout 6
(not very good,waste time)
2)do while file("c:\spool\prt.txt")
enddo
(i prefer)
3)unique file name instead prt.txt
for example with sys(2015)
Tesar
 
Dear Tesar

I have tried to use a delay procedure like

procedure pdelay
tm=0
do which tm < 10000
tm=tm+1
enddo
return

it works for sometime but it depends on the size of the report if the report is small it gets overwrittern

I have tried to create a unique file name with second()
but that works when there is delay of 5 sec but it didnt look nice any otherway

Thanks for reply
 
hello

You can try use this:

_Pcopies=mcopies && set the sistem memory variable
Printjob
Report Form abc to c:\spool\prt.txt noconsole noejct
End

OR, You can try this:

if file(file_prn.txt)
dele file file_prn.txt
endif
set print to file_prn.txt additive
_Pcopies=mcopies && set the sistem memory variable
Printjob
Report Form abc to file_prn.txt noconsole noejct
End
set print to
copy file file_prn.txt to c:\spool\prt.txt

good look!
Octavian.
 
Edit Later:

_Pcopies=mcopies && set the sistem memory variable
Printjob
Report Form abc to c:\spool\prt.txt noconsole noejct
EndPrintjob
 
Didnt woked it out I have tried every possibility

What worked is I have to reduced the no of copies to 5

and then use

do case
case copies=1
repor form xxx to c:\spool\prt noeject no console
case copies=2
repor form xxx to c:\spool\prt1 noeject no console
repor form xxx to c:\spool\prt2 noeject no console
case copies=3
repor form xxx to c:\spool\prt1 noeject no console
repor form xxx to c:\spool\prt2 noeject no console
repor form xxx to c:\spool\prt3 noeject no console
case copies=4
repor form xxx to c:\spool\prt1 noeject no console
repor form xxx to c:\spool\prt2 noeject no console
repor form xxx to c:\spool\prt3 noeject no console
repor form xxx to c:\spool\prt4 noeject no console
case copies=5
repor form xxx to c:\spool\prt1 noeject no console
repor form xxx to c:\spool\prt2 noeject no console
repor form xxx to c:\spool\prt3 noeject no console
repor form xxx to c:\spool\prt4 noeject no console
repor form xxx to c:\spool\prt5 noeject no console
endcase


this work fine but i have to reduced the no of copies

I have tried sys(2015) it still didnt worked as the speed of the CPU is too fast it cannot generates the difference name which in the loop. it only generate 1 file name so i have to choose a very very basic to see if this work

any other reply will be appriciated

 
How about something like this? (I do not have FPD 2.6 to test it.)

Code:
FOR nCtr = 1 TO nCopies
	cFile = "c:\spool\prt" + ALLTRIM(STR(nCtr))
	REPORT FORM xxx TO &cFile NOEJECT NOCONSOLE 
ENDFOR
 
I had similar problem when using pcl commands. I found a pcl command that let me print n copies. Your native printer language may have such a command.
 
abbas69,
try
? sys(2015)+sys(2015)+sys(2015)
Fox varies not first, but last characters.
If you try for file name
myfilename = right(sys(2015),8)+".txt"
irrespective of speed CPU should be unique.
Tesar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top