View Single Post
  #29  
Old 08-06-2006, 02:53 PM
john love john love is offline
Registered User
 
Join Date: Apr 2004
Posts: 22
icon for sparseimage

The non-appearance of the new icon for the disk within the sparseimage is only temporary. This disk image with the wrong icon is still on the desktop ... when I eject the disk and then re-open the sparseimage, the new icon appears.

Not all wasted, however, because in the process of discovering this "feature" I developed a straight AppleScript to effect the same thing:

=====

-- "set_icon_scpt.scpt"
--
-- run after SuperDuper's 'Copy All Files to "iMac_Internal_DU"'

property theSrc : "iMac Internal HD"
property theDest : "iMac_Internal_DU"

property ICONS : "Volume Icons"
property theICON : ".VolumeIcon.icns"

copyAllFiles(theSrc, theDest)

on copyAllFiles(srcDisk, destDisk)

tell application "Finder"
activate

set destDMG to destDisk & ".sparseimage"

set iconFolder to folder ICONS in home
set newIconFile to document file (destDisk & theICON) in iconFolder

set restoreFolder to get original item of (item "Restore" in desktop)

open information window of newIconFile

tell application "System Events"
keystroke tab
keystroke "c" using command down

delay 0.2 -- a tad extra time for copying to complete
end tell

close front window -- info window of newIconFile

open document file destDMG of restoreFolder

repeat until exists disk destDisk
delay 0.2
end repeat

open information window of disk destDisk

tell application "System Events"
keystroke tab
keystroke "v" using command down

delay 0.2 -- a tad extra time for pasting to complete
end tell

close front window -- info window of destDisk

eject disk destDisk
end tell

end copyAllFiles

=====

The reason for the keystroke calls is that according to Apple's AppleScript forum http://bbs.applescript.net/, the:

get info for ...
set icon to icon of it

is broken; so the keystroke approach is necessary until Apple fixes this.

Before I go, is there a way to pass the srcDisk and destDisk parms from SuperDuper to the above AppleScript using $3 and $4, rather than my hard coding them?

***
***

Last edited by john love; 08-07-2006 at 12:19 PM. Reason: shorten script a bunch
Reply With Quote