I finally found time to dig into this again.
Changing the selection on the first popup is not changing the options on the matrix after it, which is what I’m going for.
When I click “OK,” I get the error:
“Stopped: (Error: missing value doesn’t understand the “title” message)
the AppleEvent was not handled by any handler (errAEEventNotHandled:-1708)”
Probably a simple stupid mistake on my end, but I’m a total noob with AS Obj C.
Any pointers on where I’ve gone wrong?
I’ll have some other dialogs with variable data in the future, so can you point me toward the place to discover the syntax for things like “removeAllItems” and “addItemsWithTitles” ? Those are not things I would have known how to find.
Thanks,
Tom.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
use script "Dialog Toolkit" version "2.0"
property printAreaMatrix : {}
set theTop to -10
set theSavePath to "Fill This in Later"
set orderList to {"234567 - Bob Roberts - QTY: 6", "345678 - Bob Plant - QTY: 10,000", "456789 - Marshmellow Fiddlesticks - QTY: 1"}
set listOfTabLists to {{"Tab 1 - Front - Screen Print - Qty:1", "Tab 1 - Back - DTG - Qty:1"}, {"Tab 1 - Front - Screen Print - Qty:50", "Tab 1 - Back - DTG - Qty:50", "Tab 2 - Front - Screen Print - Qty:100", "Tab 2 - Back - Digital Vinyl - Qty:100", "Tab 3 - Front - Screen Print - Qty:1,000", "Tab 3 - Back - Screen Print - Qty:1,000"}}
set theProductionMethods to {"SP - Screen Printing", "DTG - Direct To Garment", "EMB - Embroidery", "DV - Digital Vinyl", "VIN - Regular Vinyl"}
set theLabelStrings to {"ORDER:", "PRINT AREA:", "OPTIONAL - Override Production Method:", "OPTIONAL - Edit Print Area Name:", "Your File Save Path Will Be:"}
set {thePath, theTop} to create label theSavePath left inset 0 bottom (theTop + 10) max width 400 aligns left without multiline
set {thePathLabel, theTop} to create label (item 5 of theLabelStrings) left inset 0 bottom (theTop + 10) max width 400 aligns left without multiline
set {fileNameField, fileNameLabel, theTop, fieldLeft} to create side labeled field "" placeholder text "Rt Sleeve" left inset 0 bottom (theTop + 10) total width 400 label text (item 4 of theLabelStrings) field left 0
set {printMethodPopup, printMethodLabel, theTop} to create labeled popup theProductionMethods left inset 0 bottom theTop + 10 popup width 200 max width 400 label text (item 3 of theLabelStrings) popup left 0
set {printAreaMatrix, printAreaMatrixLabel, theTop, matrixLeft} to create labeled matrix item 2 of listOfTabLists left inset 0 bottom theTop + 10 max width 400 matrix left 0 label text (item 2 of theLabelStrings) with arranged vertically
set {orderPopup, orderLabel, theTop} to create labeled popup orderList left inset 0 bottom theTop + 10 popup width 400 max width 400 label text (item 1 of theLabelStrings) popup left 0
orderPopup's setTarget:me
orderPopup's setAction:"setOrderList:"
set allControls to {orderPopup, orderLabel, printAreaMatrix, printAreaMatrixLabel, printMethodPopup, printMethodLabel, fileNameField, fileNameLabel, thePathLabel, thePath}
set {buttonName, suppressedState, controlsResults} to display enhanced alert "Send for output" message "" as informational alert buttons {"Cancel", "OK"} giving up after 120 acc view width 500 acc view height theTop acc view controls allControls without suppression
on setOrderList(sender, listOfTabLists)
set currentSelection to sender's titleOfSelectedItem() as text
my printAreaMatrix's removeAllItems()
if currentSelection is "234567 - Bob Roberts - QTY: 6" then
my (printAreaMatrix's addItemsWithTitles:(item 1 of listOfTabLists))
else
my (printAreaMatrix's addItemsWithTitles:(item 2 of listOfTabLists))
end if
end setOrderList