Yeah - some of those older ones are definitely showing their age, Adam. Since most of the really scruffy ones are below about 10 KB, something like the following should do the trick (although you can adjust the size filter to taste):
to show_icons over k for t
set p to (path to "csrv")'s POSIX path & "CoreTypes.bundle/Contents/Resources/"
set l to list folder POSIX file p without invisibles
set e to count l
set q to true
set b to "+"
set m to 1
repeat
set f to l's item m
set i to POSIX file (p & f)
set s to ((size of (info for i)) + 500) div 1000
if f ends with ".icns" and s > k then
set d to f's text 1 thru -6 & return & s & " KB"
if not gave up of (display dialog d buttons {"Cancel", "Pause"} default button 2 with icon i giving up after t) then ¬
set b to button returned of (display dialog d buttons {"Cancel", "-", "+"} default button b with icon i)
if q then set q to false
end if
set m to m + (b & 1)
if m > e then
if q then return beep
set m to 1
else if m < 1 then
set m to e
end if
end repeat
end show_icons
show_icons over 10 for 1 (* over size (KB), for time (seconds) *)
Just to confirm Kel’s advice, this works in Tiger: Edit: cleaned up path (see below)
display dialog "iTunes" with icon path to resource "iTunes.icns" in bundle (path to application "iTunes")
However, also in Tiger, a dialog displayed by an application (such as in Slim’s script, should automatically display that app’s Aqua icon for note/icon 1 (as Dominik mentioned earlier in this topic).
This variation of Slim’s script, for example, shows the iTunes logo in the dialog:
tell application "iTunes" to tell library playlist 1
set shuffle to not shuffle
display dialog "Shuffle O" & {"ff", "n"}'s item ((shuffle as integer) + 1) buttons "Sweet" default button 1 with icon 1
end tell
It may have something to do with the fact that I’ve been up all night (5:30 AM here), working on a project for which the deadline is due in 3 hours time - and have still been trying to squeeze in the odd reply to this forum, Qwerty. Well spotted.
Edit: On reflection (if I remember correctly), the direct reference didn’t work in an earlier version. But since it clearly does now, that simplifies things considerably.
That compile-time error is possible with a broken line, PUNCH:
display dialog "Final collection." with icon path to
resource "TheCheat.icns" in bundle (path to me)
I realise you’ve posted a single statement above - so there may be another problem involved. However, the term ‘resource’ should normally compile as a keyword, not a variable:
display dialog "Final collection." with icon path to resource "TheCheat.icns" in bundle (path to me)
Im pre-tiger so I think I need to utilise the “old fashioned way” but it may be a good resource to inject a theam or some personallity to the script interface.
I copied/pasted your line of code into a blank AS doc. Saved it as an app bundle, then I just double click the app. It displays the dialog, but doesn’t show the icon.
I then changed the name of my icon to applet.icns, and replaced the existing one in the resources folder. It DID change the icon of my app, but again, when I run the app, it displays the dialog, but no icon.
Checking into this in a little more detail, PUNCH, the release notes for AppleScript 1.10 (Mac OS X version 10.4) say:
This suggests that the ability to display alternative icons may have only been introduced in Tiger. So, for the moment, it looks like you’re stuck with the 3 standard icon options: stop (0), note (1) & caution (2). (It used to be possible to display an alternative icon by adding a new ‘cicn’ resource to an app - but things have changed a little since those days.)
This at least explains why your attempts didn’t alert us to a problem.