Add scriptable property to Cocoa application derived from NSObject?

Up vote 0 down vote favorite share g+ share fb share tw.

Can someone point me to an example of this working. I just want to set a property value via AppleScript. I have gone through all of the scriptable examples, which are setup differently.

The header file: // header @interface MyDelegate : NSObject { WebScriptObject *scriptObject; WebView *webView; NSWindow *window; NSInteger myInt; } // implementation - (BOOL)application:(NSApplication*)sender delegateHandlesKey:(NSString*)key { return key isEqualToString:@"myInt" || key isEqualToString:@"circleText";; } -(NSInteger)myInt { NSInteger myInteger = 42; return myInteger; } -(void)setMyInt:(NSInteger*)newVal { // do nothing right now NSLog(@"SETTER CALLED"); } // Applescript attempt to set property "myInt" tell application "BrowserConfigClient" set myint to 7 properties end tell Ultimately, the delegateHandlesKey method is called, I am able to return a value for the property, but the setter is never called. Thanks in advance... objective-c cocoa applescript link|improve this question edited 10 mins ago asked 3 hours agoBrad Bittiker11.

At a guess, KVC may be introspecting your -setMyInt: method, seeing that it takes an NSInteger* parameter and failing because that's not something it can coerce an NSNumber* into. So, it may be falling back to direct instance variable access. Your method should just take an NSInteger, not a pointer to one.

You might also consider routinely overriding +accessInstanceVariablesDirectly to return NO in your classes to rule out this sort of thing. – Ken Thomases 26 mins ago.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions