Well, I really appreciate you all taking the time to think about my problem. Please don’t be angry that I’ve decided to take a slightly different route. As you will have realised, I am an absolute Applescript beginner. Thanks to your encouragement, I have got where I wanted (I think) and I feel I’ve achieved something, even though it’s trivial by your advanced standards.
(The original problem and reason for wanting to write the script is in a previous post.)
When I first realised that Camino was lovely to browse with, but not good for my saving needs, I thought I’d use Automator. I’ve been using Macs for nearly twenty years because they’re “easy to use”. I recall Steve Jobs’ MacWorld presentation of Automator and thinking, “That looks easy and useful.” But it isn’t, and the couple of things I thought I might do, I couldn’t.
When I tried to write an Automator script to do what I wanted here, I discovered you can copy to the clipboard, but there’s no action ‘paste from clipboard’. You have to put an Applescript step in to do this, I found after a couple of hours on the Intenet. Anyway, I eventually tracked down an Applescript which did more or less what I wanted, and adapted it for Camino. Then I wrote an Automator script which is also mostly Applescript, to get my stuff with formatting from Safari to TextEdit. The pair worked fine on the G4, but the periods in the mail address didn’t appear on the iBook.
So, after the patches Adam Bell suggested didn’t work, I went back to Automator, and tried to find a way to get the clipboard contents to the message area of a new mail. Eventually, I realised that if I pasted into TextEdit (an Applescript step), and then used the Automator Action ‘Get Contents of Text’, I should be able to do this. I had to get an action (Create Mail Message) I found at an Automator site on the Internet to get the text into Mail (New Mail Message, the Apple action, wouldn’t do this).
It then occurred to me that it would be nicer to get one mail with all the urls, instead of one mail for each. So I wrote an Applescript to append a url to a text file (it took me two hours on the Internet to find out how to put a return into TextEdit - Apple’s online help for their own product being, as usual, just a long advertisement for the product and useless as help). I append the script below.
Then I wrote an Automator script to send the text by Mail. The only reason for sending to Mail is that inside a mail the urls are now linked to the sites, whereas in TextEdit, they are just text.
Although it sounds a bit of a mess (with one Applescript application and two Automator applications), it’s nice to use.
I use Camino to browse - it’s really smoother, and nicer to look at than Safari, and it handles adverts and Javascript better.
The script to save the links (below) is quick, and almost invisible. My reading is almost uninterrupted by copying, pasting, etc,
The send to mail Automator application is also quick, and gives me one page with links.
During the ‘select’ phase, I can review my choices, whereas before I saved everything I might want ‘just in case’.
I still have the Automator application to copy the selection from Safari, and paste it with formatting into TextEdit in one click.
I have to wonder how beginners to Mac react when they realise how complicated some of the ‘easy’ things are. I’ve used Macs for a long time, and I’m not innumerate, or put off by code - simply I have never done it because I’ve never needed to. It’s taken me two full days to get this far. I hope Apple don’t upgrade Safari so I like it more than Camino!
So, thanks again.
Here’s what I finished up with:
tell application "System Events"
tell application "Camino" to activate
tell process "Camino" to keystroke "l" using command down
tell process "Camino" to keystroke "c" using command down
tell application "TextEdit" to activate
tell process "TextEdit" to keystroke "v" using command down
set process "TextEdit"'s frontmost to true
keystroke return
keystroke return
tell process "TextEdit" to keystroke "h" using command down
end tell