Description | : | Changes color of text starting with a single quote (') on selected lines to green |
Download |
---|---|---|---|
Author(s) | : | Omer Atay | |
Category | : | Formatting | |
Last Updated | : | October 17, 2016 | |
Requirements | : | OneNote 2010 or above | |
Screenshot | : | ||
![]() Color VB Comments No screenshot available for this macro. |
|||
Changelog | : | October 17, 2016 (E9FA79) - Omer Atay |
what if I wrapped my word at both ends eg %Hello% would a macro be able to isolate or identify that word using the index of characters?
If string contains characters start position?
I would like to Change the Font Color of words that have a % in front of them,
I know this is a lot to ask but I would be really grateful, please please can you help me to adapt this so I can color my words.
<Macro name="Color VB Comments -Omer" category="TEST" description="Changes color of text starting with a single quote (') on selected lines to green" publishDate="00-00-00T00:00:00.000Z" version="15">
<Comment text="----------------------------------------------------------------------------------" />
<Comment text=" Color Words" />
<Comment text="----------------------------------------------------------------------------------" />
<Expression>$color = "#FF0099"</Expression>
<Comment text="Find all the selected paragraphs" />
<ForEach var="p">
<Array>QueryObjects("Text", GetCurrentPage())</Array>
<Comment text="Find quotes as the beginning of a comment" />
<Expression>$quotes = QueryText($p, "%", false)</Expression>
<If>
<Condition>Array_Length($quotes) == 0</Condition>
<Continue>1</Continue>
</If>
<Comment text="Start coloring from the first quote " />
<Expression>$quote = $quotes[0]</Expression>
<Expression>$quote.fontColor = $color</Expression>
<Comment text="Get all the text in the paragraph and color the ones that are after the first quote" />
<ForEach var="text">
<Array>QueryObjects("Text", $p)</Array>
<If>
<Condition>$text.startIndex > $quote.startIndex</Condition>
<Expression>$text.fontColor = $color</Expression>
</If>
</ForEach>
</ForEach>
</Macro>
I have been trying for months and cant make it work :( :(
I have left the original as above as I cant work out how to isolate the words with a % in front of them.
Normally I have to copy and paste to word - and then paste back and I have too many pages to do everyday
When ever you have a chance thank you so much