Hi.
I would do this a different way. Try this: make a button, name it "Product Code", and put this into its script:
Code: Select all
on mouseUp
ask "Enter Project Code"
if it is not among the lines of the productCodes of me then
set the productCodes of me to the productCodes of me & return & it
--doSomethingUsefulWithTheNewCode
else
answer "Code already exists!"
end if
end mouseUp
Every time you click on it, you can enter a code. If it is new, it is added to the list of codes, held in a custom property of the button itself. If it already exists, it complains, and does nothing. You can always check the entirety of the custom prop by just asking for it:
Code: Select all
put the productCodes of button "Product Code" into someVariable
But if it is a new code, you can use that overLong command call to do your thing.
Craig Newman