Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to print text file programmatically?
Message
From
23/10/2000 19:53:52
 
 
To
23/10/2000 08:21:42
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00432017
Message ID:
00433250
Views:
16
>What about when the printer is in the network???
>

* The DECLARE is case sensitive
DECLARE INTEGER CopyFile IN WIN32API STRING @, STRING @, INTEGER
=CopyFile('MyFile.TXT','\\234.1.1.1\PrinterShare',0)
* This works undeer NT & 2K, Win9x does not support IP adddresses as a part of
* a UNC, so you need to somehow translate the IP address to a NetBIOS name;
* a WINS server or entry in your LMHOSTS file
=CopyFile('MyFile.TXT','\\MyServer\PrinterShare',0)
* If you had previously mapped the network printer to a local system port
* using the API or NET USE, you can send to the port
=CopyFile('MyFile.TXT','LPT2:',0)

>We have a line printer connected in the network - actually it is connected on a Unix maschine, but my NT PC sees it as an lpr port : "lp333@234.1.1.1", anyway suppose that this is a network printer. Now, because this line printer prints 1000 lines per minutes in character mode, if i want to keep the same speed i have to output the report in ascii form and then print directly to the port. I tried the following solutions with no success:
>
>1.print directly to the port:
>
>fso = createobject("scripting.filesystemobject")
>fso.copyfile("myfile.txt", "lp333@234.1.1.1")
> ^--------- the port
>
>define a driver and then bypassing it
>
>set printer on
>set printer to ibmproprinter
>???filetostr(myfile)
>set printer to
>set printer off
>
>I would appreciate any help
>
>Thank you
>
>
>>>>Hi,
>>>> Thank you.
>>>> I already use REPORT FORM myreport TO FILE mytext.txt ASCII to save my report in to TEXT FILE. Now, I need to print it out programmactically from this TEXT FILE without need to regenerate the report.
>>>>any idea>?
>>>
>>>This is adapted from the _1001 Things You Wanted to Know about Visual FoxPro_ book by Akins/Kramek/Shummer (see www.hentzenwerke.com), which has become an indispensable reference on my desktop:
>>>
>>>DECLARE INTEGER ShellExecute IN Shell32.dll ;
>>> LONG HWnd, STRING cAction, STRING cFileName, STRING cParameters, ;
>>> STRING cPath, INTEGER nShowWindow
>>>
>>>RetVal = ShellExecute( 0, "Print", "C:\MyFile\File.txt", ;
>>> "", "", 0)
>>>
>>
>>As long as print via the Windows GDI is what's wanted, this will work; if he needs to send the file as a stream to a device, especially containing control codes, he needs to use CopyFile() or David Frankenbach's approach of ??? FILETOSTR('c:\myfile\file.txt') to keep the GDI out of the loop.
>>
>>>
>>>
>>> - della
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform