1

Is there a utility that saves current selection (from terminal, web browser, ...) to a text/html file in a specific location?

I want to use it as a quick note taking tool so I do not have to "create new file, paste, save file" each time I want to take some note.

3 Answers 3

3

Open Automator and create a service "text2file" with the following steps:

enter image description here

After saving the service, you may choose any text (you don't have to copy it!) and in the context menu -> Services choose "text2file" to save the content to clip.txt on your desktop.

After saving the file you can add a shortcut for "text2file" in System Preferences -> Keyboard -> Shortcuts -> Services -> Text -> text2file

The screenshot above is taken in Automator 2.2.4/10.7 (Lion). If another system is used the steps might be slightly different.

2
  • I get this error "text2file" service could not be used!
    – Mahdi
    Oct 20, 2015 at 1:26
  • I don't know what was the problem but after restarting my Mac it now works perfectly. I also needed to change the script to auto-generate the filename. Will write about it on my next weblog post.
    – Mahdi
    Oct 20, 2015 at 2:38
1

Create a shell script clip2file (or function) in bash:

#!/bin/sh

pbpaste -pboard general -Prefer txt > ${1:-~/clip.txt}

and run it with

clip2file ~/Desktop/clip.txt

to save the current clipboard.

0

TextEdit has the Service "New TextEdit Window Containing Selection" & TextWrangler adds the Service "New TextWrangler Document with Selection" to the right click menu.

You could add a key command to either from System Prefs > Keyboard > Shortcuts > Services
...though it wouldn't auto-save for you, it might be a start.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .