|
|
|
Save selected browser text via AppleScript
Made progress on the learning curve to use BBEdit instead of the default text editor while also borrowing from other scripts in this thread, so this might be of use to others.
I will use this mostly to copy and save the "printer friendly" pages of news sites, as I save articles for research. Like the other scripts, this script gives me the date and the URL for future reference. At the end, I bring the new BBedit window forward so I can delete extra text and then save the file with my own title and/or date, depending on what I need for each research project. This script selects all of the text in the front most Safari window or tab, converts the text to Unciode, and then makes a new BBedit document and pastes the clipboard, along with the date (from a shell script) and URL. (Future enhancements might be adding "zap gremlins" to clean text or calling PlainClip to convert the clipboard to plain text before pasting.) tell application "Safari" activate tell application "System Events" tell process "Safari" click menu item "Select All" of menu "Edit" of menu bar 1 click menu item "Copy" of menu "Edit" of menu bar 1 end tell end tell end tell tell application "Safari" set textclip to (the clipboard) set theURL to (get URL of document 1) end tell try set the clipboard to Unicode text of (the clipboard as record) end try set dat to (do shell script "date '+%m/%d/%y'") as text tell application "BBEdit" activate make new document set text of front document to (dat & return & return & (theURL) & return & return & textclip & return) select insertion point 1 of contents of front document end tell |
SearchFrom our Sponsor...What's New:HintsNo new hintsComments last 2 days
Links last 2 weeksNo recent new linksWhat's New in the Forums?
The Editor's Corner...Here are some of my (robg) other projects...
Hints by TopicNews from Macworld
The macosxhints PollWhat version of OS X are you running as your main OS?
Other polls | 11,487 votes | 42 comments
|
|
Copyright © 2009 Mac Publishing LLC (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Powered by Geeklog Created this page in 0.06 seconds |
|