Re: tell inside a tell
Re: tell inside a tell
- Subject: Re: tell inside a tell
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 12 Mar 2003 08:41:53 -0800
On 3/12/03 6:41 AM, "Darwin Zins" <email@hidden> wrote:
>
Is a tell inside a tell a bad thing? Is tell a bad thing is some
>
cases? I seem to get some strange errors, like I have:
>
>
tell application "Address Book"
>
repeat with aCard in every person
>
repeat with anItem in XML contents of theXML
>
if XML tag of anItem is equal to "Contacts" then
>
set found_in_z to false
>
repeat with zCard in XML contents of anItem
>
tell zCard
>
display dialog "test"
>
>
I get an error that displays the data of zCard and says it doesn't
>
understand the display dialog message. Maybe it is just my
>
misunderstanding, do I need to tell the address book to display the
>
dialog or how can I just have my running script always be the thing
>
that the dialog is displayed by, so that the address book doesn't come
>
to the top.
zCard is not an application, nor an application object, so how can it
display dialog? You're not giving us any information, but it must be a
record you've created yourself? It works when inside a tell block to an
application object:
tell application "Address Book"
set aCard to person 1
tell aCard
display dialog "No birthday."
end tell
end tell
-- (No problem)
But
tell application "Address Book"
set zCard to {a:1}
tell zCard
display dialog "No birthday."
end tell
end tell
--> ERROR: {a:1} doesn't understand the display dialog message.
If you really must have it inside a 'tell zCard' tell block, then just add
tell application "Address Book"
set zCard to {a:1}
tell zCard
tell application "Address Book" to display dialog "test"
end tell
end tell
-- works fine
if Address Book is in the front (activated); or
tell me to display dialog "test"
if the script (application) or script editor is in the front, or
tell current application to display dialog "test"
if you really don't know which will be in the front.
BTW, why do people type out " is equal to " every time when " = "works
perfectly well?
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.