Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 24, 2012, 03:45 AM   #1
sammy.d
macrumors regular
 
Join Date: Jun 2010
Automator Confirmation Prompt Icon

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.
sammy.d is offline   0 Reply With Quote
Old Apr 24, 2012, 10:28 AM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
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 :

Quote:
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.
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 Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	16
Size:	16.8 KB
ID:	337110   Click image for larger version

Name:	Picture 2.png
Views:	13
Size:	17.0 KB
ID:	337111   Click image for larger version

Name:	Picture 4.png
Views:	18
Size:	28.8 KB
ID:	337114  


Last edited by kryten2; Apr 24, 2012 at 10:33 AM.
kryten2 is offline   0 Reply With Quote
Old Apr 24, 2012, 10:39 PM   #3
sammy.d
Thread Starter
macrumors regular
 
Join Date: Jun 2010
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 Images
  
sammy.d is offline   0 Reply With Quote
Old Apr 25, 2012, 06:21 PM   #4
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Sorry , I have no idea.
kryten2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
automator, icon, prompt, service

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Automator Notification Center Icon? Benguitar OS X Mavericks (10.9) 0 Feb 25, 2014 11:50 PM
Using Automator to play audio file from within Automator made application? nobodyhome OS X 10.8 Mountain Lion 0 Jan 14, 2014 04:23 PM
Turning wifi on prompt melapple iOS 7 0 Sep 23, 2013 03:18 AM
Command Prompt Windows 8 CailinAlainn Windows, Linux & Others on the Mac 1 Aug 24, 2013 08:33 AM
iPhone: High Volume Prompt GaryRobsi Jailbreaks and iOS Hacks 9 Feb 28, 2013 02:54 AM

Forum Jump

All times are GMT -5. The time now is 04:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC