Sunday, July 21, 2019

#1 2019-06-11 04:51:49 pm

Budgie
Member
From:: New Zealand
Registered: 2005-02-22
Posts: 692

error with dictionaryWithObjectsAndKeys & Mojave

Hi
I have been using the below in my project (under OSX 10.12.6) for quite a while, no issues at all, I have been testing my project in OSX 10.14.5, and it now fails, i'm really uncertain as how to fix it.

the error at build time is:

[AppDelegate awakeFromNib]: method dictionaryWithObjectsAndKeys: expected 1 arguments, got 5. (error -10000)




the code is:

Applescript:

script AppDelegate
property parent : class "NSObject"
property theWindow : missing value
property NZEnvOffSetChoice : missing value

on awakeFromNib()
set listOffsetCodes to {"Templates", "A", "B","C","D","E","F","G"}
try
NZEnvOffSetChoice's removeAllItems()
end try
NZEnvOffSetChoice's addItemsWithTitles:listOffsetCodes

repeat with i from 1 to (count listOffsetCodes)
set menuItemValue to item i of listOffsetCodes
(NZEnvOffSetChoice's addItemWithTitle:menuItemValue)
if menuItemValue is in {"A", "D", "F"} then
set currentMenuItem to NZEnvOffSetChoice's lastItem()
set stringAttributes to current application's NSDictionary's dictionaryWithObjectsAndKeys_(current application's NSColor's redColor(), current application's NSForegroundColorAttributeName, current application's NSFont's systemFontOfSize:12, current application's NSFontAttributeName, missing value)
set attributedString to (current application's NSAttributedString's alloc()'s initWithString:menuItemValue attributes:stringAttributes)
(currentMenuItem's setAttributedTitle:attributedString)
end if
end repeat

end awakeFromNib
end script


Cheers
Budgie

"There's no shame in accepting aid from others... but perhaps there is a  responsibility."    - Batman

Offline

 

#2 2019-06-11 05:54:30 pm

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

Re: error with dictionaryWithObjectsAndKeys & Mojave

It's a bug. Use a different method:

Applescript:

set stringAttributes to current application's NSDictionary's dictionaryWithObjects:{current application's NSColor's redColor(), current application's NSFont's systemFontOfSize:12} forKeys:{current application's NSForegroundColorAttributeName, current application's NSFontAttributeName}


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

Offline

 

#3 2019-06-11 06:59:34 pm

Budgie
Member
From:: New Zealand
Registered: 2005-02-22
Posts: 692

Re: error with dictionaryWithObjectsAndKeys & Mojave

thanks Shane, is it worth submitting another bug report?


Cheers
Budgie

"There's no shame in accepting aid from others... but perhaps there is a  responsibility."    - Batman

Offline

 

#4 2019-06-11 07:03:15 pm

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

Re: error with dictionaryWithObjectsAndKeys & Mojave

Budgie wrote:

is it worth submitting another bug report?



It's always worth submitting another bug report.


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)