Skip to main content
AppleVis

Main navigation

  • Apps
  • Forum
  • Blog
    • Podcast
    • Guides
    • Hardware & Accessory Reviews
    • Bug Tracker
    • Developer Resources
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. macOS and Mac Apps

Replace text, AppleScriptt

By Dave Matters, 12 September, 2017

Forum
macOS and Mac Apps

I am working on a large .txt document that I am trying to clean up. I have some places in the text that I would like to remove some hard returns. I know I can use find/replace to do this, but I don't want to do it to the entire document.

What I was thinking was an AppleScript that would copy selected text, run the find/replace on that selected text, and then literally replace that text with the modified text.

I have been doing it like this:
* Highlight the text in question
* Copy that text and paste into 'Stickies'
* Run find/replace on the text to remove the hard returns
* Copy the newly modified text from Stickies and paste back into the original document

There has got to be a faster method. Can anyone help me with a script that I can assign to a keystroke to do the above? This has prompted me to start looking into AppleScript, but I have no experience with it. I do have some experience with AutoHotKey for Windows. That is/was awesome. If I was using Windows (or owned a Windows machine) at this point, I would have it done already. I have moved away from Windows, however, and so having to dive into Apple even more. Which has been great.

Thanks for allowing the rambling.

Options

  • Log in or register to post comments

More Like This

Question about the note widget in iPad (Forum Topic)
What does the sticky header do? (Forum Topic)
Cannot edit text in sticky notes in Freeform using VoiceOver (macOS Bug Report)
Sticky Header? (Forum Topic)
Cannot reliably edit sticky notes in Freeform using VoiceOver (iOS or iPadOS Bug Report)
Help, longstanding problem with bluetooth keyboards (Forum Topic)
removing the band on my apple watch? (Forum Topic)
new app idea (Forum Topic)

Site Information

  • About
  • Club AppleVis
  • FAQ
  • Contact

Unless stated otherwise, all content is copyright AppleVis. All rights reserved. © 2023 | Accessibility | Terms | Privacy