AppleScript for Capture One barcode

I need an AppleScript so that when a barcode is scanned into Capture One Enterprise it automatically removes the first and last 4 digits but I am very new to AppleScript and so have no idea how to do it.

Any help would be gratefully received

Which do you want to know…?

(1) How to recognize 1D barcode image

(2)How to extract information from 1D barcode recognized text