Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing raw data to NT print queue?
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00260321
Message ID:
00261472
Views:
26
Well, I verify that the file is finished writing before I queue it. These can be very large plot files - is it possible it is not finished queueing before I try to delete it?

You suggestion about attempting to open it before deleting will work, I'm sure. Would it be worth your while modifying the class to provide a property to indicate whether qeuing is complete?

IAC - thanks for the workaround - and the class!!!!

>I haven't been able to replicate the problem.
>
>It is possible that the file is still in use by the process that created it?
>If it is, it can be opened for reading (printing), but can be deleted.
>
>You can test if a file can be deleted by trying to open it for writing, if it can't be opened, then it is in use.
>
>Eg.
>
>    * Try to open for read/write before erasing it.
>    hnd = -1
>    Do While hnd = -1
>        hnd=Fopen(mbhRunCmd,12)
>    Enddo
>    Fclose(hnd)
>    Erase (mbhRunCmd)
>
>
>
>>
>>mbhRunCmd = "F:\CADD\PLOT\" + Queue + "\" + PlotFiles(Dummy,1)
>>THISFORM.Printdev1.cfilename = mbhRunCmd
>>If THISFORM.Printdev1.oOpen()
>>	WAIT WINDOW "PrintDev1 is Open" TIMEOUT 10
>>	if !THISFORM.Printdev1.oPrintFile()
>>		wait window 'Print error' nowait
>>	else
>>		WAIT WINDOW "Cleaning file " + mbhRunCmd TIMEOUT 50
>>                <B>* Here's where I get permission problems if we go too fast:
>>		Erase &mbhRunCmd</b>
>>	endif
>>	THISFORM.Printdev1.oClose()
>>ELSE
>>	WAIT WINDOW "Error number: " + STR(THISFORM.PrintDev1.nerror)
>>Endif</i>
>>
>
>>
>>If I do the above without the timeouts, it give me a file permission problem on occasion. If I increase the timeouts, it happens less frequently. The machine this runs on is doing other tasks that can occasionally take up lots of cycles. Any ideas?
>>
>>>I have tested this class sending several files (15) to the print queue, in a loop, without any problem.
>>>
>>>Could you be more specific about the problem; provide sample code?.
>>>
>>>>Very cool, Ramon. Seems I'm needing to put in a delay between oOpen() and oPrintFile() for it to work, tho. I'm looping through several files in a directory - is there a cleaner way?
>>>>
>>>>TIA
>>>>
>>>>>>How can I send a raw print file to an NT queue programmatically? Ideally, I'd like to also delete the file after getting it into the queue.
>>>>>>
>>>>>>TIA
>>>>>
>>>>>Look at RawPrintVCX in the files section (Classes - VCX).
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform