AppleScript - Change all app icons in a directory -
i have folders containing applications. want able select folder apple script, , have script go through each app file in directory, changing icons me.
i want have icon set image stored in script directory.
i'd appreciate because i've been trying make work while. progress far:
property appcurrentcount : 0 on run set thefolder (choose folder prompt "select start folder") dosomethingwith(thefolder) end run on dosomethingwith(afolder) tell application "finder" set subapps every file of afolder repeat eachfolder in subapps -- replace icon here somehow end repeat end tell display dialog "count " & appcurrentcount & "." end dosomethingwith
the script bellow want. explained before, icon file must type icns. add filter directly in choose file command.
the selected icon replace icons in each contents/resources folder of applications in selected folder. replacement done preserving name of icns in place.
warning : there no 'undo' command. old icons overwritten !!
set myicon choose file prompt "select icns copied in every application of folder" of type "com.apple.icns" set myfolder choose folder prompt "select folder applications changed" set source posix path of myicon -- convert path unix form tell application "finder" set myapps every item of myfolder name extension "app" display dialog "count apps=" & count of myapps repeat anaps in myapps -- loop each app set icnfolder ((anaps string) & ":contents:resources:") alias set myicns (every item of icnfolder name extension "icns") display dialog "count of icn in " & alaps & " = " & (count of myicns) repeat oneicon in myicns -- loop each icns set destination posix path of (oneicon string) try shell script "cp " & (quoted form of source) & " " & (quoted form of destination) end try end repeat -- loop each icns end repeat -- loop each app end tell
Comments
Post a Comment