PDA

View Full Version : Automator Confirmation Prompt Icon




sammy.d
Apr 24, 2012, 02:45 AM
Hi,
I have created a service in Automator which uses an 'Ask for Confirmation' prompt. The whole thing runs fine except when the confirmation prompt appears, it has the basic application icon in the dialog box (the blank documents with the pencil A of pencils/ruler on top). How can I change that icon to something of my own, or even the Automator robot icon?

(when running the service from within Automator, the little robot bloke appears in the prompt. the problem comes when running the service outside of automator)

Cheers.



kryten2
Apr 24, 2012, 09:28 AM
You can click to change the icon in the Ask for Confirmation action. I tried dropping an icns file onto the icon to change it but that didn't work. I'm still on Leopard perhaps it works on SL or Lion. If you want custom icons replace the Ask for Confirmation action with a run Applescript action.

From the AppleScript Language Guide :

with icon (text | integer)
The resource name or ID of the icon to display.
with icon (stop | note | caution)
The type of icon to show. You may specify one of the following constants:
stop (or 0): Shows a stop icon
note (or 1): Shows the application icon
caution (or 2): Shows a warning icon, badged with the application icon
with icon (alias | file)
An alias or file specifier that specifies a .icns file.


(*
Using dialog with title in Automator

The cause of the problem is that Automator imports the terminologies of
Applescript Studio, which redefines redefines display dialog as part of the
Panel Suite; that version doesn't have the with title parameter. You can
check that by opening Automator using the Applescript editor. (Use
File→Open Dictionary...) I agree that this is a stupid decision by Apple :(

You can circumvent this problem by using
*)
set myIcon to ("///Users/test/Downloads/powerb/PowerButton.icns") as POSIX file -- set custom icon if you like
using terms from application "Finder"
display dialog "A simple dialog with a custom icon" buttons
{"Cancel", "Sleep", "Shut Down"} default button 3
with title "Shut down or sleep Mac mini" with icon myIcon -- if using custom icon
end using terms from
(*
from inside Automator; this tells Applescript's compiler to make the display
dialog command call the standard definition.
*)

sammy.d
Apr 24, 2012, 09:39 PM
I changed the "Ask for Confirmation' action to a 'Run Applescript' action like you said and now I get the icon working fine. Thanks for that.

Do you have any idea why it wasn't working before? I have attached the images below, the robot appears when the service is run from Automator but the generic icon appears when run from anywhere else...

kryten2
Apr 25, 2012, 05:21 PM
Sorry , I have no idea.