Need Help with List Wrangling

I have a problem that is just escaping me…

I know I’m missing something fundamental in this.

set myLabelCode to choose from list {"MHK10", "SF103", "KAR01", "WDR3X3"}
	
	if result is "MHK10" then
		set input to MHK10
	else if result is "SF103" then
		set input to SF103
	else if result is "KAR01" then
		set input to WDR3X3
	end if
	
	set MHK10 to {2, 2, 5, 5}
	set SF103 to {4, 4, 8, 8}
	set KAR01 to {8, 8, 10, 10}
	set WDR3X3 to {0, 0, 1, 1}

Returns {0, 0, 1, 1} no matter what I choose in the pop up list. How do I separate the items?

The input variable is something I want to inject into a handler like so:

tell application "Adobe InDesign CS5"
	set myLabelCode to choose from list {"MHK10", "SF103", "KAR01", "WDR3X3"}
end tell


if result is "MHK10" then
	set input to MHK10
else if result is "SF103" then
	set input to SF103
else if result is "KAR01" then
	set input to WDR3X3
end if

set MHK10 to {2, 2, 5, 5}
set SF103 to {4, 4, 8, 8}
set KAR01 to {8, 8, 10, 10}
set WDR3X3 to {0, 0, 1, 1}




on mybigfatsquare(result)
	tell application "Adobe InDesign CS5"
		set myMaster to applied master of page 1 of document 1
		
		tell myMaster
			set myQRrectangle to make rectangle with properties {geometric bounds:result, fill color:swatch id 14, label:"QRCODE"}
			set pattern of myQRrectangle to "Lines" --This has to be exactly the name of the Pattern Style
			set pattern parameters of myQRrectangle to "Line Distance:12~Angle:20~Iterations:4~Stroke Weight:1~Dashes:true~Dash Length:12~Gap Length:6~Random Dash:true~Stroke Color:0 0 0 1 setcmykcolor ~" --these parameters are only valid for the 'Lines' pattern, will need to get properties of complete QR pattern
		end tell
	end tell
end mybigfatsquare




mybigfatsquare(result)

but it always wants to put 0, 0, 1, 1 in there. I kind of think there’s something about when I’m setting input, applescript is ignoring my if/ else if, and just setting input as each item until it ends with 0, 0, 1, 1.

Thanks!

I’m still fiddling with this, and I realize now that

a) KAR01 was attempting to get set to WDR3X3 (not that it matters, because this is all wrong.)

b) the “result” I was achieving was {0,0,1,1} only because it was passing “set WDR3X3 to {0, 0, 1, 1}” as a result to the handler…

Ugh, lots to learn.

… And such is the nature of this world, I was closer than I realized.

This works: (however inefficient)



set myLabelCode to choose from list {"MHK10", "SF103", "KAR01", "WDR3X3"}

set MHK10 to {2, 2, 5, 5}
set SF103 to {4, 4, 8, 8}
set KAR01 to {8, 8, 10, 10}
set WDR3X3 to {0, 0, 1, 1}

if item 1 of myLabelCode = "MHK10" then
	set input to MHK10
else if item 1 of myLabelCode = "SF103" then
	set input to SF103
else if item 1 of myLabelCode = "KAR01" then
	set input to KAR01
else if item 1 of myLabelCode = "WDR3X3" then
	set input to WDR3X3
end if


mybigfatsquare(input)


on mybigfatsquare(input)
	tell application "Adobe InDesign CS5"
		set myMaster to applied master of page 1 of document 1
		
		tell myMaster
			set myQRrectangle to make rectangle with properties {geometric bounds:input, fill color:swatch id 14, label:"QRCODE"}
			set pattern of myQRrectangle to "Lines" --This has to be exactly the name of the Pattern Style
			set pattern parameters of myQRrectangle to "Line Distance:12~Angle:20~Iterations:4~Stroke Weight:1~Dashes:true~Dash Length:12~Gap Length:6~Random Dash:true~Stroke Color:0 0 0 1 setcmykcolor ~" --these parameters are only valid for the 'Lines' pattern, will need to get properties of complete QR pattern
		end tell
	end tell
end mybigfatsquare