A good ideia would be to do it all in batches instead of just one book at a time.
I've never worked with FM and barscanning together but if you manage to create a single FM, return delimited text, file with a bunch of your barcodes you are in business. Actually this script will also work with one record at a time. But you should grab a list of books, or make one as you go along, so you can capture loads of barcodes (and still know which book each barcode references
So considering you have all the barcodes in a single FM field in an out of system PARENT file, like this:
All you have to do is create a CHILD file and a relation from Parent->to->Child, with Allow creation of related records Set On.
This relation can be based on an simple field (with a constant in it) or a calculation.
k =:: k
You need these fields in Parent:
Put these fields in the Child File:
Know it's easy:
Go back to Parent make a Portal to Child on the Portal put the child field OneBarcodeRecord.
Create the following script in Parent: "CreatChildBarcodes"
Go to Layout [with Portal]
Set Field[gWordCount, WordCount(YourRecordWithAllBarcodes)]
Set Field[gLeftAllBarcodesCount, "1"]
Go to Portal Row[Last]
Set Field[Relation::OneBarcodeRecord, MiddleWords(YourRecordWithOneFieldWithAllBarcodes; gLeftBarCodeCount; 1)
Set Field[gLeftAllBarcodesCount, gLeftAllBarcodesCount + 1]
Exit Loop If[gLeftAllBarcodesCount = gWordCount + 1]
Go to Layout[original layout]
The Relation must Allow creation of records
The Script must run on the same layout as the portal (because of the "Go to Portal Row" step.