My application utilizes a bunch of user interface check boxes. I have each one bound to a property in my script:
property attributeOne : missing value
property attributeTwo : missing value
property attributeThree : missing value
property attributeFour : missing value
property attributeFive : missing value
property attributeSix : missing value
property attributeSeven : missing value
property attributeEight : missing value
etc...
There are a few places in the code where I need to check these checkbox values and do something on them:
if (attributeOne's integerValue) then
set nPc to nPc & attributeSd & (item 1 of attributeList) & attributeEd & ","
end if
if (attributeTwo's integerValue) then
set nPc to nPc & attributeSd & (item 2 of attributeList) & attributeEd & ","
end if
if (attributeThree's integerValue) then
set nPc to nPc & attributeSd & (item 3 of attributeList) & attributeEd & ","
end if
etc...
The computer scientist in me screams that the above code is unnecessarily repetitive. In another language I would just use an array or list and iterate over it.
Is there a way to iterate over properties in some sort of ordered container in Apple Script?