How to check if a key exists in a record?

I found that if I try to access a field in a record, for example:

set track_album to (|Album| of t)

And this field does not exist, AppleScript throws an error. How can I check if this field exists first? Or how to make him fail? (Whatever the best practice.)

+5
source share
1 answer
set track_album to album of (t & {album:default})

it will be installed in the album if it exists, or by default if not.

or

try
album of t
on error -1728
default
end try
+8
source

All Articles