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

Re: TextEdit things


  • Subject: Re: TextEdit things
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 24 Apr 2017 02:01:50 -0500

On 04/24/2017, at 00:36, Jean-Christophe Helary <email@hidden> wrote:
I have 3 issues with TextEdit (for now):

1) Can't Save a file... [edited for brevity]


Hey Jean-Christophe,

A very disgusting bug that's been with us for about 3 iterations of macOS and still not fixed...

The workaround is to “touch” the file before saving.

------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/04/24 01:09
# dMod: 2017/04/24 01:46
# Appl: TextEdit, Finder
# Task: Create a new TextEdit document and save it on the Desktop
#     : Works around a very nasty bug in macOS.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @TextEdit, @ccstone, @Save, @Bug, @WorkAround
------------------------------------------------------------------------------

set destPath to (path to desktop folder as text) & "test_doc.rtf"
set someText to "Now is the time for all good men to come to the aid of their country."

close access (open for access destPath)

tell application "TextEdit"
    activate
    make new document with properties {text:someText}
    tell front document
        save in file destPath
    end tell
end tell

tell application "Finder"
    reveal destPath as alias
end tell

------------------------------------------------------------------------------

You pointed out the basics of this to someone last month.

2) … there does not seem to be a way to create a file in a different file formats (ex. txt is the default is rtf, etc.)

This seems to work:

save as "com.apple.rtfd" in file destPath

3) I can't seem to figure out how to access the "Open Link" contextual menu that appears when right-clicking on a link inside a RTF file...

You can't.  System Events sees them but only offers the ability to click the link – not open.

Nor can you extract the URL from the link with System Events (although UI Browser can see it).

You might be able to get the coordinates of the link and use a utility like Keyboard Maestro to right-click there.

If you want to read the url in the link then you're better off reading the file and parsing out the links.

--
Take Care,
Chris

 _______________________________________________
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 things
      • From: Jean-Christophe Helary <email@hidden>
References: 
 >TextEdit things (From: Jean-Christophe Helary <email@hidden>)

  • Prev by Date: TextEdit things
  • Next by Date: Re: TextEdit things
  • Previous by thread: TextEdit things
  • Next by thread: Re: TextEdit things
  • Index(es):
    • Date
    • Thread