edthedestroyer Posted May 4, 2012 Share Posted May 4, 2012 (edited) I am working on an card encoder which only requires a string of ascii to be sent to it's IP address in order to print. Example < Name #10000 "%10000? > So far I've been doing this be writing it to a text file, notepad.exe /p text.txt, then delete text.txt This prints to the default printer which is a generic/text printer with the IP address of the encoder. Is there a way to send this string directly to the IP Address, or at least a cleaner way to send it to the generic/text printer? Resolved: Used TCPConnect and TCPSend to send the print command string to a DataCard printer. Printer is in OpenCard format. Edited May 5, 2012 by edthedestroyer Link to comment Share on other sites More sharing options...
MilesAhead Posted May 4, 2012 Share Posted May 4, 2012 (edited) Not sure about the IP part. But WinAPIEx UDF has _WinAPI_GetDefaultPrinter() function. Might help get you part of the way. It returns the name of the default printer for the current user. Edited May 4, 2012 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
ProgAndy Posted May 4, 2012 Share Posted May 4, 2012 How can you access your card encoder? Only as a printer, or is there a way to simply use TCPOpen & TCPSend? *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
edthedestroyer Posted May 4, 2012 Author Share Posted May 4, 2012 (edited) I am using a genertic/text printer driver that sends the print job as text because that's the only way I know how to send acsii messages to an IP Address. The manual says it simply needs to IP stream with the acsii enclosed. Can you elaborate on TCPOpen & TCPSend? Edit: Didn't know that was a built-in function. I will research these functions and see if they suit. I don't believe the encoder documentation specified a port, should I just pick a random port over 20000? Edited May 4, 2012 by edthedestroyer Link to comment Share on other sites More sharing options...
hannes08 Posted May 4, 2012 Share Posted May 4, 2012 (edited) The default port for printing is 9100. You can find the actual port in the control panel ==> printers ==> (file ==> )Server Properties ==> Ports And TCPSend is the right way to go. Edited May 4, 2012 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
ProgAndy Posted May 4, 2012 Share Posted May 4, 2012 (edited) Edit: Didn't know that was a built-in function. I will research these functions and see if they suit. I don't believe the encoder documentation specified a port, should I just pick a random port over 20000?If there is no port specified, try a random port. If you want to associate some meaning, what about Port 9100 or 35 (Any private printer server protocol) Edited May 4, 2012 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
edthedestroyer Posted May 5, 2012 Author Share Posted May 5, 2012 Great! I was able to use the TCPSend example in the documentation to get it working. I have a DataCard printer and it appears to want data on port 9100. This was a lot easier than I expected. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now