Monday, November 19, 2018

#1 2018-09-07 11:55:34 pm

Neophyte
Member
From:: Canberra, ACT, Australia
Registered: 2017-08-20
Posts: 25
Website

Using applet icons in "display dialog"

I have an applet which includes a "icns" file in the "Resources" folder of its bundle.  That file contains images of a logo for the applet.  I use the logo in a "display dialog" statement:

Applescript:

set custom_icon_file to (path to resource "applet.icns")
display dialog "Alert text" with title "Title" buttons {"OK"} with icon custom_icon_file

This code seems to work.  But, I've realised that I should be using "with icon file".  Yet, the "StandardAdditions" library says that "with icon" can be followed by "text or integer".  Have I accidentally done that ?

Interestingly, the 2013 AppleScript Language Guide only mentions  "with icon" followed by any of a resourceSpecifier, iconTypeSpecifier or fileSpecifier.  It does not mention "with icon file"

So, I'm confused.  Can anyone help ?


Public servants are people too

Offline

 

#2 2018-09-08 12:22:58 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5471

Re: Using applet icons in "display dialog"

Neophyte wrote:

But, I've realised that I should be using "with icon file".



There's no file in there -- it means a file as in a reference of some sort.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2018-09-08 12:56:39 am

Neophyte
Member
From:: Canberra, ACT, Australia
Registered: 2017-08-20
Posts: 25
Website

Re: Using applet icons in "display dialog"

Shane, many thanks.  I think I get it although I feel a bit thick.

I have a related question: If I use "with icon note" I don't get the "Note" icon in the dialog.  Instead, I get the applet icon (ie. my logo).  If I use "with icon stop", I get the "Stop" icon but with the applet icon in the bottom right hand quarter.  I guess the only way to get the "Note" icon to show is to reset the applet icns file (ie. remove the custom icon file).  I'm happy with showing the logo but, I just wonder how it all works.

Cheers.


Public servants are people too

Offline

 

#4 2018-09-08 01:33:51 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5471

Re: Using applet icons in "display dialog"

There is no "note" icon. Those names all date from pre-OS X. When it was updated, they've mapped those choices to new icons, and there is no equivalent of the old note icon.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)