• 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: TextEdit oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextEdit oddity


  • Subject: Re: TextEdit oddity
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 21 May 2014 11:00:40 +0100

"koenig.yvan" wrote on Mon, 19 May 2014 16:37:00 +0200:

>As the real script make changes to the text, a bare version is :
>
>tell application "TextEdit" to tell document 1
>	set leTexte to its text
>
>	set its text to (leTexte & "=azertyuiop=")
>
>	delay 0.1
>	set properties of its text to {font:"Menlo-Regular", size:11.0}
>
>end tell
>
>For most of the texts, all works well.
>
>I just get a problem with large files.
>For instance, I have one text containing 141831 characters (including
space
>ones) the script fails

Hi Yvan.

I don't know if this helps for your current purpose, but the following
version of your example script works very well (on my machine) with text
twice as long as that generated by Deivy's script:

  tell application "TextEdit" to tell document 1's text
    make new character at end with data "=azertyuiop="
    set properties to {font:"Menlo-Regular", size:11.0}
  end tell

'new character', 'new word', or 'new paragraph' can be used
interchangeably here. But for some reason, 'new character' works almost
instantaneously, 'new paragraph' takes a little longer, and 'new word'
takes quite a while.

If it's not practical for the script to edit the text within TextEdit
itself, vanilla-edited text can be put back in smaller chunks:

  tell application "TextEdit" to tell document 1
    set leTexte to its text
    set leTexteNouveau to (leTexte & "=azertyuiop=") -- or whatever your edit may be.
    set c to (count leTexteNouveau)

    set its text to ""
    repeat with i from 1 to (count leTexteNouveau) by 65536
      set j to i + 65535
      if (j > c) then set j to c
      make new character at end of its text with data (text i thru j of leTexteNouveau)
    end repeat
    set properties of its text to {font:"Menlo-Regular", size:11.0}
  end tell


NG


 _______________________________________________
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: TextEdit oddity
      • From: "koenig.yvan" <email@hidden>
    • Re: TextEdit oddity
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: TextEdit oddity
  • Next by Date: Re: TextEdit oddity
  • Previous by thread: Re: TextEdit oddity
  • Next by thread: Re: TextEdit oddity
  • Index(es):
    • Date
    • Thread