Ah, thank you for pointing that out. I actually didn't think anybody would really use that thing. I was bored though so I fleshed it out and added a bunch of new features:
- retrieve icon list from bundle itself - set display rate - choose icon from list - browse through icons using previous & next buttons - generate dialog code - edit dialog code- copy code to clipboard - reveal icon in finder
I think I made all the changes I needed to. Feel free to reuse/retool/repost with credit.
-- contact_mike("Compose_Dialog_Icon_0.1.1") -- composes mail to the author and cancels script tell application "Finder" to set core_icons to the name of every item of (((path to library folder from system domain as string) & "CoreServices:CoreTypes.bundle:Contents:Resources:") as alias) whose name extension is "icns" set icon_delay to 1 set x to 0 set an_icon to "" set delay_msg to "Enter a number of seconds to pause between icons:" repeat display dialog delay_msg default answer icon_delay buttons {"Quit", "Choose Icon", "Start"} cancel button 1 default button 3 tell result to set {icon_delay, nav_button} to {text returned, button returned} try set icon_delay to icon_delay as integer exit repeat on error set delay_msg to "Error: Number of seconds must be a positive integer." end try end repeat if nav_button is "Choose Icon" then repeat set an_icon to (choose from list core_icons default items an_icon) as string if an_icon is "false" then error number -128 repeat with z from 1 to the length of core_icons if item z of core_icons is an_icon then exit repeat end repeat set x to z set an_icon to item x of core_icons set nav_button to button returned of (display dialog "Icon Title:" with title "Display Dialog" default answer an_icon with icon (path to resource an_icon in bundle ((path to library folder from system domain as string) & "CoreServices:CoreTypes.bundle")) as alias buttons {"Quit", "Choose Icon", "Start"}) if nav_button is "Start" then set x to x - 1 exit repeat else if nav_button is "Quit" then exit repeat end if end repeat end if if nav_button is "Start" then repeat set x to x + 1 if x is greater than the length of core_icons then set x to 1 set an_icon to item x of core_icons set nav_button to button returned of (display dialog "Icon Title:" with title "Display Dialog" default answer an_icon with icon (path to resource an_icon in bundle ((path to library folder from system domain as string) & "CoreServices:CoreTypes.bundle")) as alias giving up after icon_delay buttons {"Quit", "Previous", "Pause"} default button 3) if nav_button is not "" then repeat if nav_button is "Previous" then set x to x - 1 if x is 0 then set x to the length of core_icons set nav_button to pause_view(item x of core_icons) else if nav_button is "Next" then set x to x + 1 if x is greater than the length of core_icons then set x to 1 set nav_button to pause_view(item x of core_icons) else if nav_button is "Pause" then set nav_button to pause_view(item x of core_icons) else if nav_button is "Resume" then set x to x - 1 exit repeat else if nav_button is "Quit" then exit repeat end if end repeat if nav_button is "Quit" then exit repeat end repeat if nav_button is "Quit" then handle_quit(item x of core_icons) on pause_view(an_icon) button returned of (display dialog "Icon Title:" with title "Display Dialog" default answer an_icon with icon (path to resource an_icon in bundle ((path to library folder from system domain as string) & "CoreServices:CoreTypes.bundle")) as alias buttons {"Resume", "Previous", "Next"} default button 1) end pause_view on handle_quit(an_icon) set icon_code to "display dialog \"\" with title \"\" default answer \"\" with icon (path to resource \"" & an_icon & "\" in bundle ((path to library folder from system domain as string) & \"CoreServices:CoreTypes.bundle\"))" display dialog "Sample code for " & quoted form of an_icon default answer icon_code buttons {"Quit", "Reveal Icon in Finder", "Copy Code to Clipboard"} cancel button 1 default button 3 tell result to set {icon_code, copy_option} to {text returned, button returned} if copy_option is "Reveal Icon in Finder" then set icon_path to ((path to library folder from system domain as string) & "CoreServices:CoreTypes.bundle:Contents:Resources:" & an_icon) as alias tell application "Finder" activate set icon_window to make new Finder window tell icon_window set target to icon_path set current view to icon view set toolbar visible to false end tell tell icon view options of icon_window set arrangement to arranged by name set shows icon preview to true set icon size to 128 end tell reveal icon_path end tell else if copy_option is "Copy Code to Clipboard" then set the clipboard to icon_code end if end handle_quit to contact_mike(script_revision) error number -128 end contact_mike
On Nov 28, 2005, at 20:57:57, Michelle Steiner wrote:
On Nov 28, 2005, at 6:30 PM, Mr Tea wrote: I had problems running your 'slideshow' script, Michael, with the following error:
Can't make "Mezzanine!:System:Library:CoreServices:CoreTypes.bundle" into type file.
There was an "as alias" missing from inside the final close parenthesis.
|