Page 1 of 1

Barcode Scan Hook

Posted: Thu Dec 15, 2005 2:20 pm
by Neil C
Hello

I'm looking for a hook to run a script when a barcode is scanned. Our barcodes are a combination of a part number and a serial number, or sometimes a part number followed by a box quantity. Is there hooks i can use when i scan a code into the data entry screen for recieved and dispatch from the warehouse manager so i can split the data into only the part number capital expects?

Posted: Mon Dec 19, 2005 11:23 pm
by COBS Tech Support
Yes the hook is called R-GETID.MAC and more information on its usage can be found if you locate the topic "Get Stock ID Script" in your product documentation.

Basically the script will provide you with the scan code. You must locate the product code based on this scan and return the Stock ID. In CAPITAL the Stock ID is a unique 7 digit code that is automatically assigned to each stock item in the system. Use the CBS function StockID() to return this code.

Also, in CAPITAL 7.4 there are new features to scan serial numbers and similar properties in addition to product codes from barcodes...

Posted: Fri Dec 23, 2005 9:02 am
by Neil C
I've seen this hook in the documentation, and i've written a script to use it
but i cannot seem to find out when it runs. I expected it to execute when you're in the warehouse manager input screens, but it doesn't seem to.

I thought that perhaps it wouldn't allow an echo so i tried to put an error in the scripting, but it didn't show that either, so, I'm under the impression the script runs somewhere else.

So basically when does this script run? I put some code below to give you an idea of what I'm trying to achieve. Also you mentioned that 7.4 allows special things with serial numbers and properties in the barcodes, how can I find out more about this?

Code: Select all

File:r-getid.mac
declare starAt type numeric
starAt := at('*',mBarCode)
mBarCode := Substr(mBarCode, 0, starAt-1)
Stock->(Find(mBarCode))
echo(stock->name)
Return StockID()

Posted: Fri Jan 06, 2006 11:01 am
by COBS Tech Support
In CAPITAL 7.3 you will need to edit the QP.INI found in your company data folder and edit or add the following line:

BarCode Field=(CBS macro script)

Please note that case is important.

You should then find that your script will 'fire'.

In CAPITAL 7.4 this is not necessary. It is sufficient that the script file R-GETID.MAC exists in your \CAPITAL folder. CAPITAL 7.4 becomes officially available on the 16th of January for preview members. If you drop us an email we can provide you with a download link if you qualify, or at least email you the product documentation for 7.4.

A general comment on your script example: Be careful with your usage of SUBSTR(). There is no such thing as a zero position. Strings start at position 1.

Posted: Tue Jan 10, 2006 10:45 am
by Neil C
You guys have sent us a sample of 7.4 (7.40w) just so we're clear.

At what stage does this script run? I've put just an echo out so i can find out when it runs, but i cannot seem to find at which stage this happens.

Posted: Tue Jan 10, 2006 3:55 pm
by COBS Tech Support
Unless you're running an official release of 7.4 please follow the instructions given to you for 7.3. (The official preview release date of 7.4 is not until January 16th.)

The script fires whenever a character is received during a scan. If your script is not being executed then please review the advice given in previous posts.

Posted: Fri Jan 13, 2006 1:07 pm
by Neil C
Ok, i tried adding the line

BarCode Field=R-GETID.MAC

to my qp.ini in the company folder, and i've added my R-GETID.MAC to the company folder and the root capital folder incase that made a difference. I still can't get an echo out at any stage in input mode, either for dispatch or recieve.

Posted: Mon Jan 16, 2006 10:22 am
by COBS Tech Support
You must follow the exact instructions we give. The statement is:

BarCode Field=(CBS macro script)

And not any other statement.

Posted: Mon Jan 16, 2006 1:29 pm
by Neil C
Haha :roll:

that works great, thanks lots