• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: way to script an icon preview?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: way to script an icon preview?


  • Subject: Re: way to script an icon preview?
  • From: Sander Tekelenburg <email@hidden>
  • Date: Mon, 14 Oct 2002 22:32:49 +0200

At 14:59 -0700 UTC, on 10/14/02, Michael Cytrynowicz wrote:

[...]

> I can open and re-save and that results in a new, nicer preview icon.
> The problem is having to do this one by one. I could do it in
> Photoshop, but then some of the files were _not_ originally saved from
> photoshop, and I don't want to change the creator.

Doesn't Photoshop have a pref to not change the creator type when saving?
Graphic Converter does, and is scriptable. I use the script below to select a
folder and have Graphic Converter create icons for files in that folder, and
in subfolders. It may requiere some adjustments here and there for your
needs. I just wrote it for my needs. Never released it, so I never bothered
to make it 'general purpose'. Looks like there's even some unused code in
there. But it should help you get started.

You can run it from ScriptMenu of course. Or you can make it into a droplet,
if you're into that sort of thing.

Beware of line breaks.

(* start script *)
global fileCount, processedFiles

set fileCount to 0
set processedFiles to 0
set ErrCount to 0
set ErrString to ""
set baseFolder to choose folder with prompt "Select a disk or folder whose
contents you want to create preview icons for"

my WalkFolders(baseFolder)

on WalkFolders(i)
tell application "Finder"
set theFolders to get every item of i
repeat with i in theFolders
if class of i is folder then
my WalkFolders(i)
else
set theFile to i as alias
my createIcon(theFile)
end if
end repeat
end tell
end WalkFolders

on createIcon(theFile)
set fileCount to fileCount + 1
try
tell application "GraphicConverter"
create icon theFile with preview
set processedFiles to processedFiles + 1
end tell
on error m number n
tell me
beep
activate
tell me to display dialog (n as text) & return & return & (m as
text) giving up after 5
end tell
end try
end createIcon

tell application "GraphicConverter" to quit
if ErrCount is not 0 then
set ErrString to " " & ErrCount & " errors were encountered."
end if
tell me
activate
display dialog (processedFiles as text) & " out of " & (fileCount as text)
& " files were given preview icons." & ErrString with icon 1 buttons {"OK"}
default button 1
end tell
(* end script *)


--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >way to script an icon preview? (From: Michael Cytrynowicz <email@hidden>)

  • Prev by Date: way to script an icon preview?
  • Next by Date: Setting the Default Download folder?
  • Previous by thread: way to script an icon preview?
  • Next by thread: Setting the Default Download folder?
  • Index(es):
    • Date
    • Thread