Capturing text on a Safari web page

I’d like to begin my first Applescript project.

The goal is to capture text on a Safari web page that has been selected, write it to a Simpletext file along with the URL for that page. When the script is started, a choice would be given to create a new file or append it to the last file used, and a choice to include the URL or not. For example for this page I selected the top area of the page. The Simpletext file would have an entry of :


http://bbs.applescript.net/posting.php?mode=newtopic&f=2

MacScripter BBS | Applescript Forums
Scripting Forum
�

�FAQ� �Search� �Memberlist� �Usergroups�

�Profile� �You have no new messages� �Log out [ hkhamilton ]�


Any ideas as to if or how this could be done?

See these links:

http://scriptbuilders.net/category.php?search=safari+selection
http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.11.htm
http://macscripter.net/exchange/index.php?id=P219

Jon

Thanks Jon

I tried the “Safari Selection to Script Editor” script and changed the Scrip Editor application line to Textedit. Ran the script and a new Textedit file opened but may selection in Safari or the URL did not paste in. I quess I’ll need to learn some Applescript. I’m running OS 10.2.8, Applescript 1.9., Script Editor 1.9, Text Edit 1.2.

i don’t have a million bucks so any wisdom you can extend would be greatly and thankfully appreciated.

Kim

The Safari selection scripts were just to illustrate how to grab the selection and the URL. The second two links show how to save that content to a file without the use of any other application. As it says in those links, many new scripters don’t realize that you can create, read, & write files all from AppleScript. Combining the scripts to grab the content & URL then then use the code from the other links (either one, really) to write that data to a file.

Jon