Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A set of AppleScripts to create a scrapbook in Safari Web Browsers
As mentioned in a recent hint, it would be nice in Safari to have a scrapbook function like in Microsoft IE. I have created just such a feature, and you can download the scripts that I use in 10.2.8 for yourself.

WARNING: The scripts are for 10.2.8. I'm not on Panther - yet (hear that, Santa?). For 10.2.8, you must download GUI scripting addition from Apple. I understand that Panther has GUI scripting built-in but I'm not sure about the syntax, so maybe a scripter could edit the script and repost for 10.3 (if needed)?

[robg adds: Read the rest of the hint for the instructions; I haven't tested this one, but it seems like it would be quite handy.]

INSTRUCTIONS BEFORE USE:
  1. Make a new folder in your Safari config folder called Scrapbook (i.e in /Users -> UserName -> Library -> Safari -> Scrapbook).
  2. Save the two scripts to your script directory. (i.e /Users -> UserName -> Library -> Scripts). This way you can access them with the dropdown menu. Must be saved as applications without startup page.
  3. In Safari, make a new bookmark folder called "SCRAPBOOK" and another called "Seed for SCRAPBOOK" - must be exactly as shown - caps and all.
  4. Use your scheduler (cron, anacron, etc) to run the "Delete from Scrapbook" script at some appropriate interval. I use weekly at 1:00 am. You'll have to judge your usage rate.
  5. Go to your home page (or any page - doesn't matter). Press home and then save a new bookmark for that page to bookmark folder "Seed for SCRAPBOOK." The page you use for the new bookmark doesn't matter because all you're trying to do is force Safari to create a new bookmark that you must now edit. Flip to the bookmark window and navigate to the bookmark you just created. Edit the bookmark to read "BLANK PAGE" and the URL to "http://blank%20page/". Again exactly as shown.
TO USE:
When you want to save a page, simply click on "Add to Scrapbook" script. The page is saved as HTML and a bookmark pointing to the file is created in bookmark folder "SCRAPBOOK." The file can be retrieved and viewed in Safari by clicking on the bookmark in the usual way. Additional folders can be created with the bookmark folder "SCRAPBOOK" and the bookmarks moved into them without loss of function. In fact the bookmark can be moved to any part of the bookmark library without any problem.

To delete a file, simply delete the bookmark in Safari. That's all you need to do. When the "Delete from Scrapbook" script next runs, it compares the file list for the Scrapbook folder with the bookmarks, and deletes any file that does not have a bookmark pointing to it. Thus deleting the bookmark ensures that the file is eventually deleted. The whole bookmark database is searched, so even if the bookmark is moved, the script should still find it (if it exists.)

WARNING: Do not put any other files in your scrapbook folder for any other reason -- or you will lose them!

Finally I've added notes to the scripts to indicate what everything does.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[12,114 views]  

A set of AppleScripts to create a scrapbook in Safari | 28 comments | Create New Account
Click here to return to the 'A set of AppleScripts to create a scrapbook in Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A set of AppleScripts to create a scrapbook in Safari
Authored by: syko on Dec 04, '03 11:48:31AM

Very nice!

Now, to see if I can get this to work in Camino (:



[ Reply to This | # ]
Help: A set of AppleScripts to create a scrapbook in Safari
Authored by: venner on Dec 04, '03 06:54:19PM

Can you tell me what kind of set up do you have?
I am using 10.2.8 on a pbTi (paint flecks everywhere) and it isn't working. It appears to be doing something when I run the script but nothing shows up in the SCRAPBOOK folder.

thanks



[ Reply to This | # ]
follow up
Authored by: venner on Dec 04, '03 07:11:39PM

on further investigation, it is saving the page to the local folder but it isn't adding a bookmark to the SCRAPBOOK folder.



[ Reply to This | # ]
follow up
Authored by: paulrob on Dec 05, '03 04:17:29AM

Do you have GUI scripting installed? You MUST have this for the scripts to work. If you don't then use the link I've given in an answer to TimBonnici



[ Reply to This | # ]
I'm probably just being lame but...
Authored by: TimBonnici on Dec 04, '03 03:10:21PM

Does anyone have a link to the GUI Scripting Additions download? I can't find it anywhere on Apple's site.



[ Reply to This | # ]
I'm probably just being lame but...
Authored by: paulrob on Dec 04, '03 03:56:58PM

No, you're not being lame. Clearly, Apple has "moved on" and deleted the links to the orginal GUI scripting addition. Now only info for 10.3 is shown.

However, playing with a couple of old links shows that the file can still be downloaded from:-

http://www.apple.com/applescript/GUI/UIscriptingbeta.sit

Better be quick ...!



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 05, '03 11:33:25AM

Thanks to those people who gave me some feedback. I think the teething problems have been hammered out. If you revisit the above link you can obtain more details of bug fixes etc.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: polymathic on Dec 06, '03 01:00:13PM

This is a great set of scripts. The scrapbook function was the only thing I missed from IE.

I do have one problem, though. I get this error:

NSReceiverEvaluationError:4

What to do? The pages are saved in the Scrapbook folder; but nothing in the bookmarks. I'm running 10.3.1.

Thanks for any advice.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: adipoos on Dec 06, '03 06:52:57PM

I'm having the same problem in 10.2.8, so if anyone can suggest a solution it would be brilliant...



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: bluehz on Dec 06, '03 06:58:17PM

I am getting the same NSReceiver error using Panther. I know that GUIScripting is in Panther - but not sure if you have to activate it or not.

Also - a page was saved into my Scrapbook folder and upon looking at it I noticed that its straight html, but when you view it the images etc are pulled from the server they relate to. While this is cool, it would be even nicer if the images were embedded and required no online connection to view in its entirety. Much like IE does when saving a web page - it embeds the images directly into the file.

Maybe a better solution would be to use the above system but scrapbook the files as PDF's instead. Unfortunately unless you create PDF's through Acrobate Web Capture you will not get the clickable links - unless someone else knows a solution.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 09, '03 06:38:04PM

Yes but first you have to be able to GUI script the print dialogue in Safari (or any app.) I've not spotted a way in yet. Also saving files in pdf does not seem to be possible with Applescript through Safari.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: alajuela on Dec 08, '03 02:24:07PM

This is a really nice piece of work, but I am having an interesting experience. A couple of observations: (1) the instructions as written on this hint page are in conflict with the author's Readme file on his website. On this page, "scrapbook" is not capitalized, but in the ReadMe it is; similarly, the ReadMe says to save the scripts as Applications *with* a startup screen, but this hint page says the opposite [and seems to make more sense] and (2) instead of creating the bookmarks in the bookmark folders, it is creating them as standalone bookmarks in my bookmark toolbar. The Scrapbook folder in my home directory is getting the pages, but they aren't being placed in the bookmark folders.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: alajuela on Dec 08, '03 02:30:16PM

Well, I discovered that the "capitalization inconsistency" in my previous post is not correct. When I searched for this hint, looking for "safari scrapbook," a summary of this hint was returned, and when I clicked on the summary, the full text was displayed. Of course, my hint search terms were highlighted in yellow, along with the code which creates capitalization & quote marks. When viewed without those effects, the hint correctly instructs the proper capitalization. My fault. Sorry. But the rest of my comments stand.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: alajuela on Dec 08, '03 03:00:06PM

Well, duh. I've been trying to make this work inside my Bookmarks Menu Bar. But it doesn't work there. It does work, and just about flawlessly, when you create the folders correctly in the Bookmarks Collections List [lefthand column of the Bookmarks page]. Only other request: revise the script to load up fully embedded pages with images and links. That would be outstanding; right now, it is merely excellent. ;-)



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 09, '03 05:49:33AM

What version of Mac OSX are you running? If you are running 10.3 could you tell me what the version number of Safari you are using? I've seen a posting elsewhere that says 10.3 uses Safari 1.1 and not 1.0.1. This might explain why people trying this on 10.3 can't make it work.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: polymathic on Dec 09, '03 04:04:59PM

I'm using Safari 1.1.1 in OS X 10.3.1

Hope you can work this problem out. Such a good script idea!



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 12, '03 10:02:38AM

Hello again!

I've recovered from the flu - and had a chance to get on a machine running 10.3.1 - and made a new script for 10.3 only that works on the two machines I've tried.

Follow the link as before and read the "SCRAPBOOK notes.rtf" file for further details.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: dpwk on Dec 12, '03 05:21:29PM

STILL doesn't work. NSReceiverEvaluationScriptBlahBlah #4 or somesuch.

---
gigabling megashiznit



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: polymathic on Dec 12, '03 07:33:17PM

Hmmm. I can't seem to save "Add to scrap..." as an app. Says there is some error about expected end of line but finding: "

It's here:
tell attribute "AXFocused"

Looking forward to trying this script once it works!



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: polymathic on Dec 13, '03 03:16:47AM

Okay... I managed to compile the script. For some reason, it began working when the name was changed. But, unfortunately, I still get the same error: NSReceiverEvaluationScript #4

:-(

I'm running 10.3.1



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: palnudb on Dec 22, '03 12:16:22AM

OK I am trying to get the scrapbook scripts for 10.3 to run but, I can't get the "enable access for assistive devices" to turn on you click on it and it flashes the check mark and disappears. I am running 10.3.1 on a g4 agp. I searched around the apple support KB but it does show any similar problems.

Any ideas?

TIA
palnudb

---
--Those who like to work on there computers buy a PC. Those who like to do work on there computers buy Macs.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 13, '03 08:05:32AM

OK. Sigh. Try again. Thanks to polymathics response, I've managed to trace a serious error caused by the different setup that other people are using in Safari. There is more in the "You must READ this" file on my site. I'm trying not to take up too much space here.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: dpwk on Dec 13, '03 12:45:45PM

wooo, it works! thanks paulrob for all your patient bug-squashing!



---
gigabling megashiznit



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: polymathic on Dec 13, '03 03:11:03PM

It works now! Good job... but there is still one glitch: using the Add... script removed my Bookmarks Bar, and I have to switch it back on.

Almost there!



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 13, '03 03:53:01PM

OK, I included a toggle to turn this feature on for users would did not have the book bar on, or the address bar. I was getting pretty obsessed about all the different ways that people could set up Safari, which I knew was causing the problem.

In retrospect most people probably have both features on anyway. And it appears to be turning the address bar and book bar off when it's alreadyon!

Go into the editor, use the "find" option to search for the line: -

keystroke "i" using command down

Back up 2 lines to: -

tell application "System Events"

and delete the following set of lines below: -

tell application "System Events"
tell process "Safari"
keystroke "i" using command down
keystroke "b" using command down
end tell
end tell

This should solve the problem for those who have downloaded already. I'll straighten things out with the scripts. If anybody gets an error, it's probably because with your setup you need the address bar and bookmark bar to be on. You can toggle these in the menu bar.

P.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: polymathic on Dec 15, '03 02:51:08AM

Works great now. Thanks a lot for the efforts and the scripts!



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Dec 15, '03 03:24:45PM

OK. 10.2 version is ready. Do read my "You must READ this.rtf" for more.



[ Reply to This | # ]
A set of AppleScripts to create a scrapbook in Safari
Authored by: paulrob on Feb 11, '04 10:25:52AM

Users of Safari 1.2 will notice that although the SCRAPBOOK code still runs nothing is being saved in the scrapbook folder. A revised script is on my site.



[ Reply to This | # ]