After working on this problem for over an hour, I still can’t figure out how to get the number of items in a list - and display that number in a text field. For some reason this code doesn’t work (though it should) and is the same code that I normally use for regular AppleScript. This code when run displays a “the variable bla is not defined” error though the var bla is clearly defined before the “set contents” code.
Code:
property asdf : {“a”, “b”}
on clicked theObject
set bla to number of items of asdf
set contents of text field “text” to bla
end clicked
to count the items of a list better use the keyword count, or this syntax
set bla to number of (get items of asdf)
it’s always recommended to use the appropriate command ro assign different classes to a text field,
in this case the variable bla contains a number (integer)
property asdf : {"a", "b"}
on clicked theObject
set bla to count asdf
set integer value of text field "text" to bla
end clicked