I gather this can be done through terminal, but I’m not a terminal geek. Hoping AS might be able to do it.
I’d like a script that will work on a “.webloc” file on my desktop and apply a thumbnail image of the web page as a custom icon. I’ve been doing this for some time now with an Automator script and an old piece of shareware called “Webseecon”. But it’s no longer working under Snow Leopard, and I’m doubtful that Webseecon is going to be upgraded to support SL. So now need a new way of doing it.
Can anyone suggest an applescript approach?
Model: macbook2.13
Browser: Safari 531.9
Operating System: Mac OS X (10.6)
Thanks very much, Tom. But if that app does what I want, then I’m failing to see it. As far as I can tell Micon adds existing images to files or folders as icons. But what I need is something that will load a tiny image of a live webpage, and apply that to the (webloc) file as it’s icon. Does Micon do that? It doesn’t appear to …
Hi Lance, I place an image on a folder with Img2icns 1.2.1 and then drop the folder on Micon’s left window.
The xxx.webloc file would be dropped on the right window (you knew that).
I like Micon because it stores a history and I fine that convenient.
Here’s an example you can download… http://www.tomx-applescripts.hostzi.com/000/Micon-Example.zip
Hmm … OK. But can that operation be automated? I’m talking about something I do frequently, and the scripted process I had working with webseecon before SL was totally automated - i.e. I click a shortcut to place a webloc of my browser’s current front window on my desktop, and by a combination of applescript, webseecon and a Hazel rule, I get a webloc filed in a specific folder with a custom icon taken from the webpage.
What you’re describing sounds like a manual process which would be pretty functional if you do it now and then. But I’m talking about a frequent workflow.
Let’s try something else.
Download ToyViewer (freeware) and open an image.
From the File menu select ‘Attach Custom Icon’ – then select the xxx.webloc file.
Maybe you can script ToyViewer?
No joy there either I’m afraid, Tom. (But thanks heaps for following through with me anyway.)
ToyViewer wouldn’t / couldn’t do anything with the webloc. With the app initially running, the ‘Attach Custom Icon’ command is greyed out. If I try dragging the webloc over the TV dock icon, nothing happens. If I try opening the webloc from within TV, the webloc file is greyed out and so can’t be selected.
By chance, I’ve discovered that I’m actually dealing with a bug in SL, which others have reported to Apple. Any drag-n-drop operation with a webloc file in SL causes the default browser to hijack the process and open the URL. I gather Apple are aware of it …
So I guess this is now a non issue, apart from waiting for Apple to fix it.
Fascinating! Here’s an AppleScript application that lets you select a .webloc file to set a thumbnail as its icon, or drop one or more .webloc files on the application to set the thumbnail as the icon for each. After compiling the AppleScript, create a folder named Files in the Resources of folder of the application, and copy setWeblocThumb inside it.
-- Set Webloc icon
-- uses Ali Rantakari's setWeblocThumb:
-- http://hasseg.org/setWeblocThumb
-- Applescript by Edward Mendelson wpdos.org
on run
set filesPosix to my setPaths()
set myLoc to (choose file of type "webloc")
my setIcon(myLoc, filesPosix)
end run
on open theDrop
set filesPosix to my setPaths()
repeat with i from 1 to count of theDrop
set myLoc to item i of theDrop
my setIcon(myLoc, filesPosix)
end repeat
end open
on setPaths()
set thisApp to (path to me) as text
set resourcesFolder to (thisApp & "Contents:Resources:") as text
set filesPosix to POSIX path of resourcesFolder & "Files/"
return filesPosix
end setPaths
on setIcon(myLoc, filesPosix)
tell application "System Events" to set myName to POSIX path of myLoc
do shell script quoted form of (filesPosix & "setWeblocThumb") & space & quoted form of myName
tell application "Finder" to reveal file myLoc
end setIcon