Sign in to follow this  
Followers 0
Grantson

Getting input from a bar-code scanner

7 posts in this topic

Hi Folks

I have been trying to write a little script to help with asset logging

basically I have an rs-232 bar-code scanner

I have tried the file open method to read from the scanner but it just seems to get stuck in the loop

$comm = FileOpen("COM5", 4)
While 1
    $scan = FileRead($comm, 1)
    ConsoleWrite($scan)
    FileClose($comm)
WEnd
EndFunc

The function is called twice once to scan the asset tag and once to scan the serial number

Also is there a way of having a popup on the screen to prompt the user, something like a message box but that closes automatically when an input from the scanner is detected?

Thanks

Grant

Share this post


Link to post
Share on other sites



basically I have an rs-232 bar-code scanner

Question:

If you have notepad open and you scan, does the result appear on notepad?


Share this post


Link to post
Share on other sites

Dumb question, but if, as JoHanatCent indicated, you aren't getting readable text in Notepad, does your scanner require a "wedge"?

All of our older serial port scanners required a wedge interface box between the scanner and the serial port. You could plug the scanner directly into the serial port, but it wouldn't do anything.

Share this post


Link to post
Share on other sites

Scanning directly into notepad does nothing

using hyper terminal or rs-232 datalogger produces a list of list of barcodes

Share this post


Link to post
Share on other sites

Well, IMO you are not on the right way to do this.

You need to have a look at martin's COM UDF and you have to deal with the serial port by reading what is received.

There are about 2 other ways to deal with the COM ports and both of them are in Example Scripts.

Your short snippet doesn't show how you deal with the rest; if only these lines are dealing with the COM port, it won't work at all. Show your full script and it will be easier to get help.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

I had a feeling i wasn't i was just using what i found from a search for using the com port

I will look into the com udf

Which example scripts? I am drawing a blank searching the help files

I will post the full script but need to clear it up a bit first

(lots of commented out bits while I was trying to figure it out)

Thanks

Well, IMO you are not on the right way to do this.

You need to have a look at martin's COM UDF and you have to deal with the serial port by reading what is received.

There are about 2 other ways to deal with the COM ports and both of them are in Example Scripts.

Your short snippet doesn't show how you deal with the rest; if only these lines are dealing with the COM port, it won't work at all. Show your full script and it will be easier to get help.

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