Sunday, December 17, 2017

#1 2017-08-28 08:48:41 am

Kiel
Member
Registered: 2009-09-18
Posts: 1

Setting color of color well

I'm trying to convert an ancient ASS app to ASobjC

Beside other problems I struggle to get/set color of color wells.
The old

Applescript:

set fColor to color of fColorWell
set color of fColorWell to fColor

won't work.

Thanks

Offline

 

#2 2017-08-28 08:57:46 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: Setting color of color well

First of all color is a reserved AppleScript term so you have to put it in pipes.

Second of all a property getter is treated as a handler so you have to add a pair of parentheses

Applescript:

set fColor to |color|() of colorWell
set redColor to current application's NSColor's redColor()
set |color| of colorWell to redColor


regards

Stefan

Offline

 

#3 2017-08-28 06:35:57 pm

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

Re: Setting color of color well

And I'd change that last line to:

Applescript:

colorWell's setColor:redColor

Setting Cocoa properties like AppleScript properties doesn't always work, so I reckon it's better to use the setter form consistently.


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

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)