• 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: Best practices for creating and comparing lists of text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best practices for creating and comparing lists of text?


  • Subject: Re: Best practices for creating and comparing lists of text?
  • From: Emmanuel <email@hidden>
  • Date: Sat, 17 Dec 2005 11:11:51 +0100

At 6:00 PM -0600 12/16/05, CYB wrote:
Hi all, this is a question for Kai who answered with a very interesting solution.

But I also admit that in this particular solution that you Kai, proposed I don't understand parts of it,

When you encapsulate a piece of script in a "tell somebody", the effect is basically that every term in the scope of the "tell" statement for which it makes sense has an implicit "of somebody" appended, and "it" refers to the target of the "tell" ("somebody".)


tell t starts with "#" -- Which is the objective to do this. This is the first time I see something like this.
I understand "starts" as a containment operator (boolean) , as part of some question, but here forming a tell block, (?) I didn't catch it

So far, the "tell" does nothing.

if (count t) is 0

t and 0 make sense by themselves, so here nothing special

or it

"it" means: t starts with "#"

and (count t's paragraphs) is 1 then return {{}, {}} -- here I'm totally lost, when you say "or it and ... " I'm not sure what represent "it" (is, in this case "t"?) and how it's working between "or" & "and'
if it then set t to t's text from paragraph 2 to end - Here I assuming that you are asking if "it" is true?
end tell

Here the "tell" structure has [only] saved to write "t starts with "#" twice. (I think no-one said it makes things clearer, though.)


script o
property m : t's paragraphs
property l : m's items
end script
Here, why you declare properties inside of a script object? Is not the same to do it out of it? I had never use script objects and I'm trying to learn about it.




--------------SECOND PART OF YOUR SCRIPT------------

tell m1's text items to if (count) is 1 then
set m2's end to i's contents
else
set AppleScript's text item delimiters to return
set m1 to beginning & ({""} & rest)
end if
Here you began with a tell, but there's no end tell and..., well I don't understand it :(
I'm sure there's a more verbose way to do the same and would be more clear to me, but I didn't found it. Can you do it for me? and probably for other beginners that sniff around this list?

Same system: "tell [something which is in fact a list] to if (count) is 1" means:


if (count of that something) is 1 etc.

Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Best practices for creating and comparing lists of text? (From: CYB <email@hidden>)

  • Prev by Date: Re: Best practices for creating and comparing lists of text?
  • Next by Date: Re: Best practices for creating and comparing lists of text?
  • Previous by thread: Re: Best practices for creating and comparing lists of text?
  • Next by thread: Re: Best practices for creating and comparing lists of text?
  • Index(es):
    • Date
    • Thread