• 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: Double-quotes and Bar-quotes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Double-quotes and Bar-quotes


  • Subject: Re: Double-quotes and Bar-quotes
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 18 Sep 2009 19:01:10 -0500

On Sep 18, 2009, at 5:52 PM, Christopher Nebel wrote:

On Sep 18, 2009, at 7:44 AM, Luther Fuller wrote:

I just said ...

But, I can still use ...

tell application "System Events" to set value of property list item |ArchiveLastKnownLocation| of property list file (prefsFile as text) to the result

without error.

No I can't! It does not error, but it fails to write unless the bars are replaced with double-quotes.

So ... what's going on here?

You're confusing two very different uses of "quotes".  The double quotes delimit a text constant, such as the name of a property list item.  The bar quotes delimit an identifier that is, er, special in some way. [1]  In the above sample, |ArchiveLastKnownLocation| is merely a variable, so I'm actually surprised that it doesn't just give you an "undefined variable" error.

I looked at more details of the behavior of these things this afternoon. After some simple experiments, I have concluded that the phrase property list item  must always be followed by a string, the name of the item within double-quotes.

On the other hand, I have to write ...

|version| of defaultPrefsRecord

since version is a reserved word. I should have called it something else, but I didn't, so I seem to be stuck with |version| .

For a non-reserved word, I can use either as in ...

|ArchiveLastKnownLocation| of defaultPrefsRecord or ArchiveLastKnownLocation of defaultPrefsRecord

Now that my script complies with these rules, it seems to be working without error.

 _______________________________________________
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

References: 
 >Double-quotes and Bar-quotes (From: Luther Fuller <email@hidden>)
 >Re: Double-quotes and Bar-quotes (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: Double-quotes and Bar-quotes
  • Next by Date: Re: Applescript Editor preferences
  • Previous by thread: Re: Double-quotes and Bar-quotes
  • Next by thread: Obtaining real (RAW) filename in iPhoto
  • Index(es):
    • Date
    • Thread