The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   AppleScripting Omni Apps (http://forums.omnigroup.com/forumdisplay.php?f=46)
-   -   Scripting Bridge & OOP namedStyles (http://forums.omnigroup.com/showthread.php?t=10424)

oopFan 2008-11-03 02:46 PM

Scripting Bridge & OOP namedStyles
 
Hello fellow scripters...

Has anyone gotten very far with Scripting Bridge and OmniOutliner Pro?

I'm trying to add a named style to the style of an attribute run, which works fine in AppleScript:

add named style id myStyle to named styles of style of last attribute run of text 1 of cell 2 of myRow

But in Scripting Bridge, creating a new named style with initWithProperties does not seem to work:

NSDictionary* props = [NSDictionary dictionaryWithObject:@"myStyle" forKey:@"name"];
OmniOutlinerNamedStyle* newNS = [[[ooApp classForScriptingClass:@"named style"] alloc] initWithProperties:props];
[[newAttRun.style namedStyles] addObject:newNS];

Because I get the error message: "Inherited styles must be named." Same if I try to initialize with the ID of a document's named style.

If I try to set the name or id of a just-pseudo-initialized named style, I get the error message "object has not been added to a container yet"

If I try to add an existing document named style to my attribute run, I get "can't add an object that already exists." even though my attribute run contains no named styles.

Any hints *greatly* appreciated!


All times are GMT -8. The time now is 06:49 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.