• 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: open for access command, more re my original query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open for access command, more re my original query


  • Subject: Re: open for access command, more re my original query
  • From: Shane Stanley via AppleScript-Users <email@hidden>
  • Date: Thu, 14 May 2020 09:47:45 +1000

On 14 May 2020, at 8:03 am, le0car--- via AppleScript-Users
<email@hidden> wrote:
>
> the files are not text files, rather are rtf "rich text format"

You can extract the text directly using AppleScriptObjC:

use AppleScript version "2.5" -- macOS 10.11 or later
use framework "Foundation"
use framework "AppKit"
use scripting additions

set theFile to choose file
set theAttString to current application's NSAttributedString's alloc()'s
initWithURL:theFile options:(missing value) documentAttributes:(missing value)
|error|:(missing value)
set theString to theAttString's |string|() as text

That should work with any document format that TextEdit can open.

--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

 _______________________________________________
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

References: 
 >open for access command, more re my original query (From: le0car--- via AppleScript-Users <email@hidden>)

  • Prev by Date: Copy email address from clipboard to outgoing Mail message
  • Next by Date: Re: Copy email address from clipboard to outgoing Mail message
  • Previous by thread: Re: open for access command, more re my original query
  • Next by thread: Copy email address from clipboard to outgoing Mail message
  • Index(es):
    • Date
    • Thread