• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Confusion says what? (was Re: Script expects quoted text mystery)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Confusion says what? (was Re: Script expects quoted text mystery)


  • Subject: Confusion says what? (was Re: Script expects quoted text mystery)
  • From: Dave Stewart <email@hidden>
  • Date: Fri, 16 Jan 2004 16:33:20 -0800

On Jan 15, 2004, at 10:00 PM, Paul Berkowitz offered this:


On 1/15/04 2:46 AM, "Shane Stanley" <email@hidden> wrote:

On Jan 15, 2004, at 7:04 PM, Paul Berkowitz wrote:

It's not a good idea to nest one application block within another at
the
best of times

Why (apart from readability)? I know this seems to be accepted wisdom,
but when I run something like:

tell application "Finder"
name
tell application "InDesign CS"
name of document 1
end tell
end tell

The log says:

tell application "Finder"
get name
--> "Finder"
end tell
tell application "InDesign CS"
get name of document 1
--> "Untitled-18"
end tell

That suggests to me that AS is handling the situation fine. And I can't
detect any performance issues. I even tried making the outer app
unresponsive to events (leaving an open file dialog up) like so:

tell application "InDesign CS"
tell application "Finder"
name
end tell
end tell

And the call to the Finder worked fine.

I've noticed that too. So worries about confusion are perhaps needless. (I
do wonder if 'using terms from' might still be a special case, however.) But
I know that you are sending a call to the Finder to send a call to InDesign.
That probably doesn't matter at all if it occurs just once, but doing
something like that in a repeat loop would probably really jam things. Of
course, things might be so efficient in OS X that this is now less
significant than before - I wouldn't know.

--
Paul Berkowitz

Uh-oh, this one rang a bell. I've been browsing through the most excellent "AppleScript The Definitive Guide" by Matt Neuburg (O'Reilly) and noticed this excerpt from Chapter 10 (page 188):

"Once AppleScript has determined a complete target, it stops, ignoring any further of's or tell's that make up the rest of the chain."

He gives an example that's similar to the above, where a Finder tell block is nested inside another tell block. He claims the other tell is never targeted, since AppleScript can build a complete target with the Finder.

What Paul claims above seems to contradict that directly (unless I'm totally misreading his statements). Am I about to learn something, or is Paul?

The big reason I'm asking is because of a script I'm working on that automates someone's workflow using the Terminal.app. I'm using a lot of GUI scripting to enter commands in the desired window, but Terminal scripting to "view" the results (think of taking a screen scrape and looking for particular strings indicating errors.) Rather than end and restart every GUI block, I've simply nested the Terminal blocks inside. Seems to work fine, but if Paul is correct I may have a performance impact that I wasn't aware of.


Dave Stewart
Aqua-flo Supply (Goleta)
dstewart at aquaflo dot com

"si hoc legere scis nimium eruditiones habes."
(If you can read this, you're overeducated.)
_______________________________________________
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.

  • Follow-Ups:
    • Re: Confusion says what? (was Re: Script expects quoted text mystery)
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Escaped tab character in shell (sed)
  • Next by Date: Re: Egg Timer Question
  • Previous by thread: Re: Piping sed to sed commands
  • Next by thread: Re: Confusion says what? (was Re: Script expects quoted text mystery)
  • Index(es):
    • Date
    • Thread