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!
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!