Automator Confirmation Prompt Icon

Discussion in 'Mac Programming' started by sammy.d, Apr 24, 2012.

  1. macrumors regular

    Joined:
    Jun 18, 2010
    #1
    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.
     
  2. kryten2, Apr 24, 2012
    Last edited: Apr 24, 2012

    macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Use Applescript display dialog

    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 :

    Code:
    (*
    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.
    *)
    
     

    Attached Files:

  3. thread starter macrumors regular

    Joined:
    Jun 18, 2010
    #3
    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...
     

    Attached Files:

  4. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #4
    Sorry , I have no idea.
     

Share This Page