Jump to content

Getting input from a bar-code scanner


 Share

Recommended Posts

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

Link to comment
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.

Link to comment
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 :)

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...