Saving Selected Text and URL From Safari to a File
One thing I do everyday is surf the web. I bet you do too. Sometimes I find information, snippets of code or just something useful and I would like to save that information for later use.
I use a FileMaker database to store this information and I extract the data from Safari using AppleScript. Since everyone does not own a copy of FileMaker, this example will demonstrate extracting the info from Safari and writing it to a file on your desktop.
What It Does
This script will take the current Safari selection (what you have highlighted) along with the URL (website address) and append it to a text file on your desktop called "safari_clippings.txt". You can change this location in the script as well as the formatting of the output.
- Save this file as "selection_to_file" in "/Users/your_user_name/Library/Scripts/Applications/Safari/".
- If it is not already, turn on your scripts menu using the AppleScript Utility located in /Applications/AppleScript/
Now when you are in Safari and click the script icon in the menu bar the "selection_to_file" will be listed at the top.
That's all there is to it!