<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Add more style token for highlighting]]></title><description><![CDATA[<p dir="auto">Hello All,</p>
<p dir="auto">I use notepad++ to go through very large log files. Sometimes I have to go through more than 50 open files at the same time and search for more than 20 text strings and it get hard to track them down after certain time.<br />
I think more marking style will help me a lot.</p>
<p dir="auto">In the contextMenu.xml, I modified the code following other posts,</p>
<pre><code>    &lt;Item FolderName="Style token" PluginEntryName="Python Script" PluginCommandItemName="color_scheme_veb_ver_1" ItemNameAs="Using 6th Style" /&gt;
    &lt;Item FolderName="Style token" PluginEntryName="Python Script" PluginCommandItemName="color_scheme_veb_ver_2" ItemNameAs="Using 7th Style" /&gt;*
</code></pre>
<p dir="auto">Similarly for removing the style.</p>
<pre><code>&lt;Item FolderName="Remove style" PluginEntryName="Python Script" PluginCommandItemName="color_scheme_veb_ver_1" ItemNameAs="Clear 6th Style" /&gt;
	&lt;Item FolderName="Remove style" PluginEntryName="Python Script" PluginCommandItemName="color_scheme_veb_ver_2" ItemNameAs="Clear 7th Style" /&gt;
</code></pre>
<p dir="auto">Here is the code for python script:</p>
<pre><code>def clearIndicators(): 
    text_end_position = editor.getLength()
    editor.setIndicatorCurrent(8)
    editor.indicatorClearRange(0, text_end_position)

def colorize(text_to_be_painted):
    matches = []
    editor.research(text_to_be_painted, lambda m: matches.append(m.span(0)))

    for match in matches:
        editor.indicSetStyle(8,INDICATORSTYLE.ROUNDBOX)
        editor.indicSetFore(8,(0,255,0))
        editor.indicSetAlpha(8,255)
        editor.indicSetOutlineAlpha(8,255)
        editor.indicSetUnder(8,True)   
        editor.setIndicatorCurrent(8)
        editor.indicatorFillRange(match[0], match[1] - match[0])  

if editor.getProperty('has_been_styled') != '1':
    selected_text = editor.getSelText()
        if len(selected_text) &gt; 0 and selected_text.isspace() == False:    
            editor.setProperty('has_been_styled', '1')
            colorize(selected_text)
else:
    editor.setProperty('has_been_styled', '0')
    clearIndicators()
</code></pre>
<p dir="auto">Problems I am facing:</p>
<ul>
<li>randomly the scripts works, sometimes it doesn’t.</li>
<li>Sometimes it marks the text which is not even highlighted.</li>
</ul>
<p dir="auto">My objectives:</p>
<ul>
<li>Have ten style token with different colors.</li>
<li>If i mark a text string for example <strong>“my text string”</strong> in one file, then the script should color <strong>“my text string”</strong> in all the files which are opened in editor.</li>
<li>I should be able to do that in just one script instead of creating different scripts and adding them in the “PluginCommandItemName” as I am not able to find a way to send any argument while calling the script which could be used a control variable in the script for different color.</li>
</ul>
<p dir="auto">I tried the <strong>combine</strong> plugin  to merge all the opened file in one and then mark them however that plugin sometimes merge files in a random way which throws the timestamp in the logs in frenzy.</p>
<p dir="auto">I would be grateful for your help good community of notepad++.</p>
<p dir="auto">Regards,<br />
Vaibhav</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/15208/add-more-style-token-for-highlighting</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 18:50:56 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/15208.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Feb 2018 01:48:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Add more style token for highlighting on Tue, 06 Feb 2018 21:13:20 GMT]]></title><description><![CDATA[<p dir="auto">Maybe you want to have a look at <a href="https://sourceforge.net/projects/analyseplugin/" rel="nofollow ugc">https://sourceforge.net/projects/analyseplugin/</a>, also it helps you in logfile analysis just for a single file at a time.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30096</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30096</guid><dc:creator><![CDATA[chcg]]></dc:creator><pubDate>Tue, 06 Feb 2018 21:13:20 GMT</pubDate></item><item><title><![CDATA[Reply to Add more style token for highlighting on Tue, 06 Feb 2018 15:24:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vaibhav-solanki" aria-label="Profile: vaibhav-solanki">@<bdi>vaibhav-solanki</bdi></a></p>
<p dir="auto">MY random thoughts:</p>
<ul>
<li>
<p dir="auto">You can continue to use <code>editor.research()</code> in your code, but you need some code ahead of it to “escape” any special regex characters that might occur in your search string.</p>
</li>
<li>
<p dir="auto">There isn’t a great way to pass arguments to Pythonscripts, especially from the the right-click context menu.  The earlier suggestion of a “dialog” (to get user input for what color) is good and might be best implemented using the <code>notepad.prompt()</code> functionality.</p>
</li>
<li>
<p dir="auto">A clean implementation may be to do the buffer-activated callback (as suggested), and you may also want to go ahead and implement an update-UI callback.  This will allow you to colorize only what is currently on-screen; if you are working with “very large” files and you colorize the whole document, you could noticeably slow-down editor performance (such as when moving around in a log file).</p>
</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/30066</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30066</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Tue, 06 Feb 2018 15:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to Add more style token for highlighting on Tue, 06 Feb 2018 00:21:35 GMT]]></title><description><![CDATA[<p dir="auto">Claudia,</p>
<p dir="auto">I am going to take a lot of time going through all this since I am a newbie.<br />
Thanks for the guidance. :)</p>
<p dir="auto">Regards,<br />
Vaibhav Solanki</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30038</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30038</guid><dc:creator><![CDATA[vaibhav solanki]]></dc:creator><pubDate>Tue, 06 Feb 2018 00:21:35 GMT</pubDate></item><item><title><![CDATA[Reply to Add more style token for highlighting on Mon, 05 Feb 2018 20:35:32 GMT]]></title><description><![CDATA[<p dir="auto">Hello Vaibhav,</p>
<p dir="auto">the python script plugin comes with a help file, see plugins-&gt;python script-Context help.<br />
Which gives a good overview of the wrapped functions as well as the usage.</p>
<p dir="auto">More detailed about the scintilla component at <a href="http://www.scintilla.org/ScintillaDoc.html" rel="nofollow ugc">http://www.scintilla.org/ScintillaDoc.html</a><br />
and regarding styling at <a href="http://www.scintilla.org/ScintillaDoc.html#Styling" rel="nofollow ugc">http://www.scintilla.org/ScintillaDoc.html#Styling</a></p>
<p dir="auto">Examples of scripts here in the forum and at <a href="https://sourceforge.net/p/npppythonscript/discussion/1199074/" rel="nofollow ugc">https://sourceforge.net/p/npppythonscript/discussion/1199074/</a></p>
<p dir="auto">Tip: concerning callbacks, use the synchronous version if possible</p>
<p dir="auto">Happy coding</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30032</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30032</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Mon, 05 Feb 2018 20:35:32 GMT</pubDate></item><item><title><![CDATA[Reply to Add more style token for highlighting on Mon, 05 Feb 2018 19:37:21 GMT]]></title><description><![CDATA[<p dir="auto">Hello Claudia,<br />
Thanks you for the reply.<br />
I would appreciate if you could point me towards some documentation regarding the same.<br />
Thank you,<br />
Vaibhav</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30029</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30029</guid><dc:creator><![CDATA[vaibhav solanki]]></dc:creator><pubDate>Mon, 05 Feb 2018 19:37:21 GMT</pubDate></item><item><title><![CDATA[Reply to Add more style token for highlighting on Mon, 05 Feb 2018 11:09:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vaibhav-solanki" aria-label="Profile: vaibhav-solanki">@<bdi>vaibhav-solanki</bdi></a></p>
<p dir="auto">a couple of thoughts,<br />
if you want to have more styles you need to define them, you current solution<br />
defines only one and then you might provide a dialog which color/style<br />
should be used before executing the code.</p>
<p dir="auto">research is a regular expression search which means if you select text which<br />
has regex specific chars in it, like for example the dot, question mark, backslash …<br />
then it won’t treat it as pure text, instead uses it as a regular expression.<br />
You may think about using searchintarget or findtext instead.</p>
<p dir="auto">If you want to have the same text colored in different documents you need to find a way to execute the script automatically when the doucment(buffer) changes.<br />
The most obvious way would be to register a callback for bufferactivated<br />
(is a notepad callback, not a scintilla one) and then act accordingly to your needs.</p>
<p dir="auto">If there is anything unclear the us know.<br />
Happy coding.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/30012</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/30012</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Mon, 05 Feb 2018 11:09:32 GMT</pubDate></item></channel></rss>