Problem with MacBarcoda (MBC4)

Hello,

I am trying to automate a UPC generation routine with Macbarcoda. What I am doing is parsing a text file (do shell script ‘awk…’) to find the line of text with the right product number. I then parse out two bits of info (UPCNum and UPC2Num) which generate the barcode.

The data is getting to the variables, but an error is generated when the script is run. When I set the variable explicitly, the script runs fine. When it’s set from the parsed file, I get an error code saying that Macbarcoda’s property, “code data” doesn’t understand the data, even though it echos back the proper 12 digit sequence, which is what “code data” wants to be fed. I’ve tried stripping any extraneous white space (using ignore…) but still no luck.

Any thoughts would be most helpful.

Thanks.



set itmInf to (do shell script "awk '/" & cardNum & "/' /Volumes/CARDS.CREATIVE/Prepress/PAGE4APP/itmmst.txt") as string
set AppleScript's text item delimiters to tab
set itmInfo to every text item of itmInf

--Chokes here when parsed from a text file
set UPCNum to item 60 of itmInfo as string
set UPC2Num to item 6 of itmInfo as string

--Works fine when variable explicitly set
--set UPCNum to "013975006069"
--set UPC2Num to "00015"

launch application "MBC4"
tell application "MBC4"
	copy title to theDocName -- Get the name of any open document. 
	if theDocName = "" then -- If there isn't a document... 
		make new document -- we need to create one. 
	end if
	set template to "UPC-A + 5"
	set code data to UPCNum
	set addon data to UPC2Num
	set check digit to "auto-correct"
	set units to millimetres
	set supply recommended height to true
	set magnification to 150
	save window theDocName in file UPC
end tell