Sign in to follow this  
Followers 0
edthedestroyer

Send ASCII String to IP Address

7 posts in this topic

#1 ·  Posted (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 by edthedestroyer

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by MilesAhead

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by edthedestroyer

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by hannes08

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0