• 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: Weird behavior of text in Pages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird behavior of text in Pages


  • Subject: Re: Weird behavior of text in Pages
  • From: Deivy Petrescu <email@hidden>
  • Date: Wed, 30 Jul 2014 12:21:34 -0400

On Jul 29, 2014, at 18:27 , Stockly, Ed <email@hidden> wrote:

> Has this been resolved?
>
> I ask because I've noticed something similar (but different) in BBEdit. If
> it define the TIDs inside {} and then coerce a list to text, it acts as if
> there TIDs are empty.  In your handler you're not using the {} and I'm
> wondering if you would get a different result if you did.
>
>
> my tid(return)
>
> on tid(x)
>    set AppleScript's text item delimiters to {x}
> end tid
>

No, including the curly brackets does not fix the problem.

As Yvan mentioned, we talked and he proposed some solutions.
I had a workaround before I submitted the question.

I looked at Yvan’s solutions and had some ideas to see if I could get the text items.
I tried

tell app “Pages”
…
tell me to set tt to tt as text
…


That is having the text be defined by AppleScript rather than Pages.
It did not work.
I tried setting the clipboard to the text and then working with the clipboard (inside Tell “Pages”).
It did not work.
Finally I tried working with the error dialog

…
on error e
get the text from e and try to get its text items
end try
…

It still did not work!!!!

Mine, as well as Yvan’s requires that the text be processed in a handler outside the tell block.
This happens with text captured in Pages, not Pages 09.

I am still puzzled at this behavior and can not tell if this is a “feature” or a bug!!!

By the way, my solution is as follows:


tell application "Pages" to tell document 1
	repeat with l from 1 to count every text item
		if exists object text of text item l then ---if object text of text item l contains "Phone:" then
			my tid(return)
			set tt to (paragraphs of (get object text of text item l))
			set tt to my gettxtitms(tt)
…



on gettxtitms(tt)
	set tt to (tt as string)
	my tid(return & return)
	return text items of tt
end gettxtitms

on tid(x)
	set AppleScript's text item delimiters to {x}
end tid

{} after your suggestion.




Deivy Petrescu
email@hidden




 _______________________________________________
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: Weird behavior of text in Pages
      • From: "koenig.yvan" <email@hidden>
References: 
 >Re: Weird behavior of text in Pages (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Weird behavior of text in Pages
  • Next by Date: Re: Weird behavior of text in Pages
  • Previous by thread: Re: Weird behavior of text in Pages
  • Next by thread: Re: Weird behavior of text in Pages
  • Index(es):
    • Date
    • Thread