Hello everyone…
This script normally runs an external shell script which you won’t be able to do. I’ve taken the output from a previous run and defined the variable (the_Bingo) that way instead.
If you run the script you will see that the variable bingo_Head does not get returned to the main script. It is defined in the sub correctly but does not appear to be returned.
I am sure i’ve missed something obvious…thanks for looking.
set AppleScript's text item delimiters to ""
set bingo_Key to "IBINGO"
set bingo_Mk to {"MK1", "MK2", "TR"}
set bingo_Head to "test text"
set the_Bingo to "Found 30 barcode(s)
MK1 (QRCODE, Page 1) - Tag box - X/Y,293,1075,46,46
MK2 (QRCODE, Page 1) - Tag box - X/Y,547,1075,46,46
9L (QRCODE, Page 1) - Tag box - X/Y,16,968,69,68
8L (QRCODE, Page 1) - Tag box - X/Y,16,876,67,67
7L (QRCODE, Page 1) - Tag box - X/Y,16,766,67,67
6L (QRCODE, Page 1) - Tag box - X/Y,16,656,69,69
0125666661 (CODE25, Page 1) - Tag box - X/Y,99,679,197,12
0125666662 (CODE25, Page 1) - Tag box - X/Y,353,657,176,29
0125666663 (CODE25, Page 1) - Tag box - X/Y,606,655,200,25
5L (QRCODE, Page 1) - Tag box - X/Y,16,541,69,69
0125555551 (CODE25, Page 1) - Tag box - X/Y,110,553,175,29
0125555552 (CODE25, Page 1) - Tag box - X/Y,339,553,217,36
0125555553 (CODE25, Page 1) - Tag box - X/Y,614,555,204,34
4L (QRCODE, Page 1) - Tag box - X/Y,16,445,69,69
0125429992 (CODE25, Page 1) - Tag box - X/Y,336,433,206,53
0125429993 (CODE25, Page 1) - Tag box - X/Y,616,445,190,31
3L (QRCODE, Page 1) - Tag box - X/Y,16,332,69,68
0125399999 (CODE25, Page 1) - Tag box - X/Y,108,330,194,37
0125329992 (CODE25, Page 1) - Tag box - X/Y,347,330,193,37
0125329993 (CODE25, Page 1) - Tag box - X/Y,611,335,188,28
2L (QRCODE, Page 1) - Tag box - X/Y,17,219,65,67
0353222222 (CODE25, Page 1) - Tag box - X/Y,110,237,192,32
0353444444 (CODE25, Page 1) - Tag box - X/Y,339,234,193,32
0353233333 (CODE25, Page 1) - Tag box - X/Y,602,233,204,34
1L (QRCODE, Page 1) - Tag box - X/Y,17,123,65,67
0353223344 (CODE25, Page 1) - Tag box - X/Y,123,144,179,30
0353667799 (CODE25, Page 1) - Tag box - X/Y,348,144,184,30
0353111111 (CODE25, Page 1) - Tag box - X/Y,589,134,191,49
IBINGO BE 407 SOUDUB277 BEHAN (QRCODE, Page 1) - Tag box - X/Y,17,9,68,68
TR (QRCODE, Page 1) - Tag box - X/Y,804,15,57,57
EOT"
tell current application
-- set the_Bingo to (do shell script "cd /Users/accounts/Documents/XBP/bardecoder_7_3_1b_osx/java/; java twooffive") as string
--end tell
-- validate(the_Bingo, bingo_Mk)
my header(the_Bingo, bingo_Key, bingo_Head)
log "Log entry back in main: " & bingo_Head
end tell
-----------------------------------------
on header(the_Bingo, bingo_Key, bingo_Head)
set list_Length to the number of paragraphs in the_Bingo
set bingo_Sub_Line to 1
set bingo_Sub_Para to text of paragraph bingo_Sub_Line in the_Bingo
set bingo_Found to false
log "1st Log entry in sub: " & bingo_Head
repeat while bingo_Found = false
set bingo_Sub_Para to text of paragraph bingo_Sub_Line in the_Bingo
try
if word 1 of bingo_Sub_Para = bingo_Key then
set bingo_Head to "Flight " & characters 8 thru 13 of text in bingo_Sub_Para
set bingo_Found to true
else
set bingo_Sub_Line to bingo_Sub_Line + 1
end if
end try
end repeat
log "2nd Log entry in sub: " & bingo_Head
return bingo_Head
end header
on validate(the_Bingo, bingo_Mk)
end validate