The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   AppleScripts questions (http://forums.omnigroup.com/showthread.php?t=16143)

jphalip 2010-05-08 12:13 AM

AppleScripts questions
 
Hi,

I've got 2 questions regarding OmniOutliner and AppleScripts:

1) Is it possible to check in an apple script if a row is numbered, and which numbering system it is using (legal, letters, numeric, etc.)?

2) Is there an elegant way of checking if a style name is applied to a given row. The only way I've found so far is a bit ugly and involves creating a temporary list of style names:

-- Ugly part begins
set theStyleNames to {}
set theNamedStyles to named styles of the style of theRow
repeat with theNamedStyle in every item of theNamedStyles
set theStyleNames to theStyleNames & (the name of theNamedStyle)
end repeat
-- Ugly part ends

if theStyleNames contains "Heading 1" then
-- do something clever here
else if theStyleNames contains "Heading 1" then
-- do something clever here
end if

Thanks a lot for your help!

Kind regards,

Julien

RobTrew 2010-05-08 11:17 AM

[QUOTE=jphalip;76911]
1) Is it possible to check in an apple script if a row is numbered, and which numbering system it is using (legal, letters, numeric, etc.)?[/QUOTE]

None of the attributes which constitute a style seem to expose the numbering setting for a row. Might be worth a suggestion through [B]Help > Send Feedback ...[/B] in OO


[QUOTE=jphalip;76911]
Is there an elegant way of checking if a style name is applied to a given row ?[/QUOTE]

A single line of the following form will return a boolean value:

[CODE]name of (named styles of style of oRow) contains strStyleName[/CODE]

([I]name of (named styles of style of oRow)[/I] yields a list of the names of all the named styles attached to oRow)

[COLOR="White"]--[/COLOR]

DerekM 2010-05-10 10:40 AM

[QUOTE=jphalip;76911]1) Is it possible to check in an apple script if a row is numbered, and which numbering system it is using (legal, letters, numeric, etc.)?[/QUOTE]

This'll tell you the type:

value of attribute "heading-type(com.omnigroup.OmniOutliner)" of style of <row>

and there's also:
"heading-suffix(com.omnigroup.OmniOutliner)"
"heading-lowercase(com.omnigroup.OmniOutliner)"
"heading-prefix(com.omnigroup.OmniOutliner)"

RobTrew 2010-05-10 02:18 PM

[QUOTE=DerekM;76992]
value of attribute "heading-type(com.omnigroup.OmniOutliner)" of style of <row>

and there's also:
"heading-suffix(com.omnigroup.OmniOutliner)"
"heading-lowercase(com.omnigroup.OmniOutliner)"
"heading-prefix(com.omnigroup.OmniOutliner)"[/QUOTE]

Thanks Derek - that's helpful.

The possible values of [B]heading-type[/B] (which can be modulated by the boolean setting of [B]heading-lowercase[/B]) seem to be:
[LIST][*]"Legal"[*]"Letters"[*]"Numeric"[*]"Roman"[/LIST]
And, for what it's worth, this is a case of Applescript reaching places which the menu system does not reach:

[B]heading-prefix[/B] and [B]heading-suffix[/B] can be set to any character, they are not limited to the plain parenthesis and period offered by the OO [B]Format > Row Numbering[/B] menu

[COLOR="White"]--[/COLOR]

DerekM 2010-05-11 10:21 AM

[QUOTE=RobTrew;77001]And, for what it's worth, this is a case of Applescript reaching places which the menu system does not reach:

[B]heading-prefix[/B] and [B]heading-suffix[/B] can be set to any character, they are not limited to the plain parenthesis and period offered by the OO [B]Format > Row Numbering[/B] menu

[COLOR="White"]--[/COLOR][/QUOTE]

You can set those through the Row: Numbering inspector :)

RobTrew 2010-05-11 02:12 PM

[QUOTE=DerekM;77039]You can set those through the Row: Numbering inspector :)[/QUOTE]

I really should use scripting less, and explore the UI which you have all crafted with such thought and care :-)

whpalmer4 2010-05-11 07:14 PM

[QUOTE=RobTrew;77052]I really should use scripting less, and explore the UI which you have all crafted with such thought and care :-)[/QUOTE]
How would the rest of us learn anything about scripting Omni apps if you did that? :-)

RobTrew 2010-05-11 10:54 PM

[QUOTE=whpalmer4;77064]How would the rest of us learn anything about scripting Omni apps if you did that? :-)[/QUOTE]

A generous thought ;-) thank you !

jphalip 2010-05-15 06:35 PM

Hey all, just wanted to say thanks! It did the trick!


All times are GMT -8. The time now is 03:54 AM.

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