Save Selection Service
The Save Selection service allows you to immediately save the selected text in any application. When you invoke the service you’ll be asked where to save the selection. That’s it! No need to copy and paste into a separate text editor.
Download Save Selection Service 1.0 (33k)
The service file goes in ~/Library/Services/
and is invoked from the Services submenu of the application menu. Here is the AppleScript source code:
on process(_selection) tell application "System Events" to set _appname to the name of every process whose frontmost is true tell application (_appname as string) to set _file to choose file name with prompt "Save the selected text as:" default name "Selection.txt" set _fp to open for access _file with write permission write _selection to _fp close access _fp end process
This service made with ThisService.
Posted on Sunday, May 20th, 2007. Tags: mac.
4 Responses to “Save Selection Service”
Posted by Anonymous on Saturday, September 22nd, 2007 at 11:25 PM.
Hey, almost what i needed! How can i make it to save as PDF?
Posted by Jim on Monday, September 24th, 2007 at 6:54 PM.
Since the script accesses the selection through ThisService, which provides it to the script as plain text, I don’t think it would be possible to save it as a PDF with the same formatting you seen on the screen.
Would a screenshot of a selected area suffice? (See System Preferences->Keyboard & Mouse->Keyboard Shortcuts->Screen Shots.)
Posted by Jean on Tuesday, November 13th, 2007 at 1:17 AM.
I select text in a safari window and I choose save selection service but no save window comes up and no file was made.
Posted by Jim on Tuesday, November 13th, 2007 at 4:40 PM.
Thanks for the report, Jean. I have Mac OS X 10.4.10 and Safari 3.0.3 (it is a “beta” version). I don’t know whether the service works with other versions; perhaps not.
I do know that ThisService isn’t really intended for interactive scripts. I am aware of some similar quirks, so it is quite possible you have discovered another.
Anyway, I’m sorry it doesn’t work. I’ll post more information here if I ever figure out a solution.