Thanks so much Shane, I’ve got that working great now.
The other thing I need to update to get through this dialog is the last label in my dialog window, named “thePath.”
I’ve been searching, I’m not finding commands for changing that beyond “setStringValue:”
I did Google up other people with issues changing that - saying it doesn’t update just by changing the value, but their solutions immediately get waay over my head.
It’s my “on setThePath:sender” handler that’s not doing anything.
Any help? Any other ASObjC users following along who wants to give Shane a break and give me a hint?
I apologize for having not found time to read Shane’s book yet, perhaps I could spare you all from my questions.
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 listOfTabLists : {}
property orderList : {}
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"}, {"Tab 1 - Front - Blank - Qty:1"}}
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 {printAreaPopop, printAreaPopupLabel, theTop, matrixLeft} to create labeled popup (item 1 of listOfTabLists) left inset 0 bottom theTop + 10 popup width 300 max width 400 label text (item 2 of theLabelStrings) popup left 0
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:"
printAreaPopop's setTarget:me
printAreaPopop's setAction:"setThePath:"
set allControls to {orderPopup, orderLabel, printAreaPopop, printAreaPopupLabel, 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 setThePath:sender
my thePath's setStringValue("Updated String")
end setThePath:
on setOrderList:sender
set currentSelection to sender's titleOfSelectedItem() as text
set orderChoosen to item 1 of my list_positions(orderList, currentSelection)
my printAreaPopop's removeAllItems()
my (printAreaPopop's addItemsWithTitles:(item orderChoosen of listOfTabLists))
end setOrderList:
on list_positions(this_list, this_item)
set the offset_list to {}
repeat with i from 1 to the count of this_list
if item i of this_list is this_item then
set the end of the offset_list to i
end if
end repeat
return the offset_list
end list_positions