Color PowerShell Comments

Description : Changes color of text starting with a single quote (#) on selected lines to green

Download

Color PowerShell Comments

You need Onetastic Add-in
for OneNote to run this macro.
Download Onetastic
Author(s) : Synx
Category : Formatting
Last Updated : February 06, 2017
Requirements : OneNote 2010 or above
Screenshot :

Color PowerShell Comments

No screenshot available for this macro.
Changelog :

February 06, 2017 (586342) - Synx
Initial Version

Comments

Name
Comment
Dan - 2017-02-19
Thank you so Much!!

YOU ARE THE BEST OMER!!
Really Good Programmer.

I really needed to highlight all these words  - as I am not very good with my eyesight and you did it for me.

I am sending you lots of good luck :)
Sorry for always hassling you with newbie code - I am trying to learn!

Thanks for making oneNote the Best
Because of you I changed from evernote to onenote!
And all the awesome macros you made
Have a great weekend!
Omer Atay - 2017-02-18
Dan: I uploaded a new macro named "Highlight Hashtags"
Dan - 2017-02-18
Hi Omer,

How can I just color the #word untill the first space.

Example only color   #hello  and not the whole paragraph.
I am trying to color some words similar to this.



<?xml version="1.0" encoding="utf-16"?>
<Macro name="Color PowerShell Comments" category="Test" description="" publishDate="00-00-00T00:00:00.000Z" version="15">
  <Comment text="----------------------------------------------------------------------------------" />
  <Comment text="    Color Powershell Comments" />
  <Comment text="----------------------------------------------------------------------------------" />
  <Expression>$color = "#358000"</Expression>
  <Comment text="Find all the selected paragraphs" />
  <ForEach var="p">
    <Array>QueryObjects("Paragraph", GetCurrentPage())</Array>
    <If>
      <Condition>$p.selection == "none"</Condition>
      <Continue>1</Continue>
    </If>
    <Comment text="Find hashes as the beginning of a comment" />
    <Expression>$hashes = QueryText($p, "#", false)</Expression>
    <If>
      <Condition>Array_Length($hashes) == 0</Condition>
      <Continue>1</Continue>
    </If>
    <Comment text="Start coloring from the first hash" />
    <Expression>$hash = $hashes[0]</Expression>
    <Expression>$hash.fontColor = $color</Expression>
    <Comment text="Get all the text in the paragraph and color the ones that are after the first hash" />
    <ForEach var="text">
      <Array>QueryObjects("Text", $p)</Array>
      <If>
        <Condition>$text.startIndex &gt; $hash.startIndex</Condition>
        <Expression>$text.fontColor = $color</Expression>
      </If>
    </ForEach>
  </ForEach>
</Macro>


I tried a lot of things but nothing works :(
thank you