Re: Weird behavior of text in Pages
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:39:16 -0400
On Jul 30, 2014, at 12:34 , koenig.yvan <email@hidden> wrote:
>
> 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
>
Thanks Yvan, I missed that.
You were probably clear, I am the one to blame.
Good catch.
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