• 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: "koenig.yvan" <email@hidden>
  • Date: Wed, 30 Jul 2014 18:34:28 +0200


Le 30/07/2014 à 18:21, Deivy Petrescu <email@hidden> a écrit :


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

Hello Deivy.
It seems that I was not clear enough.
text item was not a feature used by Pages '09 but it is used in the last issue :

text item n [inh. iWork item] : A text container
elements
contained by documents.
properties
background fill type (no fill/‌color fill/‌gradient fill/‌advanced gradient fill/‌image fill/‌advanced image fill, r/o) : The background, if any, for the text item.
object text (rich text) : The text contained within the text item.
opacity (integer) : The opacity of the object, in percent.
reflection showing (boolean) : Is the iWork item displaying a reflection?
reflection value (integer) : The percentage of reflection of the iWork item, from 0 (none) to 100 (full).
rotation (integer) : The rotation of the iWork item, in degrees from 0 to 359.

So we are facing a terminology conflict.
I tried to solve it using the good old « tell me » tip in the tell application "Pages" block but it failed.
As I didn’t wanted to spend time upon that, I choose to use my good old decoupe handler.


Yvan KOENIG (VALLAURIS, France) mercredi 30 juillet 2014 18:33:25



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