• 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
Re: Tell Blocks Considered Harmful (was Re: open for access)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell Blocks Considered Harmful (was Re: open for access)


  • Subject: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • From: Axel Luttgens <email@hidden>
  • Date: Sat, 20 Dec 2008 11:12:44 +0100

Le 20 déc. 08 à 08:10, Richard Rönnbäck a écrit :

I am trying to dig into my memory to see if I can remember any script of
mine that broke because of a "tell block problem".

Hello Richard,

The breakages do not need to be spectacular, they may just prove extremely annoying.
I remember this one from an earlier thread:


	set X to "/System"
	(POSIX file X) as text
	--> "BootDisk:System"
	tell application "Mail" to (POSIX file X) as text
	--> "BootDisk:System:"

So, depending on how one got a Mac-style path to an existing directory, the ending semicolon may be lacking or not.

On the other hand, if the directory doesn't exist (say "/System1"), the code will succeed outside of the tell block and fail inside of the block.

Without trying to decide here which behavior is more "correct"[1], one thing is sure: moving such seemingly innocuous code out of or into a tell block will almost surely break the whole script, and will require some rewriting.

Axel

[1] Clearly, there are inconsistencies. For example:
	set X to "/"
	(POSIX file X) as text
	--> "BootDisk:"
Why suddenly a trailing semicolon? _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Tell Blocks Considered Harmful (was Re: open for access)
      • From: KOENIG Yvan <email@hidden>
    • Re: HFS paths (was Tell Blocks Considered Harmful)
      • From: Chris Page <email@hidden>
References: 
 >Re: Tell Blocks Considered Harmful (was Re: open for access) (From: Richard Rönnbäck <email@hidden>)

  • Prev by Date: Re: libraries vs copy/paste (was: on neophytes vs perfectionists)
  • Next by Date: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • Previous by thread: Re: Tell Blocks Considered Harmful (was Re: open for access)
  • Next by thread: Re: HFS paths (was Tell Blocks Considered Harmful)
  • Index(es):
    • Date
    • Thread