Hi!
New to this with scripting but I noticed something strange. I was trying to compile an example from a book I am studying, but the code does not compile unless the application Contacts is actually running before I press compile.
tell application "Contacts"
get name of first person whose ("my_email_address@somewhere.com" is in (value of every email))
end tell
If the Contacts app is not running a get an error message (freely translated from Swedish)
“Expected class name but found identifier.” and the word “person” in the code is highlighted.
If the Contacts app is currently running I get the correct output, i.e. the name of the person that has the given email address.
I do not understand why this is the case? Is this perhaps a bugg or is there something I am missing?
I read that Applescript does not know about the dictionary if I would e.g. write
tell application "Contacts" to get name ...
instead of using it in a tell block. But I thought that putting things in a tell block would somehow make Applescript aware of the classes etc in the dictionary of the corresponding app.