• 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: problem w/ text item delimiters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem w/ text item delimiters


  • Subject: Re: problem w/ text item delimiters
  • From: T&B <email@hidden>
  • Date: Wed, 7 Feb 2007 11:41:50 +1100

What's very strange is that if you build your list using "as string," as in the example below, it seems to work, even though the class is already string.

Perhaps the problem is because you're not dereferencing the item reference. When you use "repeat with myItem in myList" loop, any ruse of myItem within that loop is actually the reference "item n in myList", not the contents of the item itself. Simply preceding reference with "contents of" will get the contents instead of the reference. This often helps with seemingly strange results. It should help in this case.


For example:

set myList to {"a", "b"}
repeat with myItem in myList
set myItemContents to contents of myItem
display dialog "Display myItem or contents of myItem?" buttons {"Cancel", "myItem", "contents of"}
if button returned of result is "myItem" then
error myItem
else
error myItemContents
end if
end repeat


If you choose "myItem" in the dialog, you get "item 1" displayed in the error dialog. If you choose "contents of", you see "a".

Tom

_______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Re: problem w/ text item delimiters (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: problem w/ text item delimiters
  • Next by Date: Re: Applescript and Mouse Keys failure
  • Previous by thread: Re: problem w/ text item delimiters
  • Next by thread: Re: problem w/ text item delimiters
  • Index(es):
    • Date
    • Thread