<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>pnotepad.org forums &#187; Tag: script - Recent Posts</title>
		<link>http://pnotepad.org/forums/tags/script</link>
		<description>Programmer&#039;s Notepad Forums</description>
		<language>en-US</language>
		<pubDate>Thu, 09 Feb 2012 07:27:48 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.3</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://pnotepad.org/forums/search.php</link>
		</textInput>
		<atom:link href="http://pnotepad.org/forums/rss/tags/script" rel="self" type="application/rss+xml" />

		<item>
                        <title>auto-indent Python code (fongandrew)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-10636</link>
			<pubDate>Sun, 05 Feb 2012 07:09:54 +0000</pubDate>
			<dc:creator>fongandrew</dc:creator>
			<guid isPermaLink="false">10636@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;In case anyone is stumbling on this via Google, here's a fix for the comment and multiple indentation bugs. Edit PN_dir\init.py and change the python_indent function as follows:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;import re

# Indention regex - look for colon, then optional spaces and comment
PY_INDENT_RE = re.compile(r&#38;#039;:\s*(#.*)?$&#38;#039;)

@indenter(&#38;quot;python&#38;quot;)
def python_indent(c, doc):
    sci = scintilla.Scintilla(doc)
    if c == &#38;#039;\n&#38;#039; or c == &#38;#039;\r&#38;#039;:
        pos = sci.CurrentPos
        line = sci.LineFromPosition( pos )
        prev_line = sci.GetLine(line - 1)

        # If the previous line matches regular expression above, then indent
        if PY_INDENT_RE.search(prev_line):
            indent = sci.GetLineIndentation( line )

            # The DumbIndent system may already have indented this line...
            previndent = sci.GetLineIndentation( line - 1 )
            if indent == previndent or indent == 0:
                indent += 4
                sci.IndentLine( line, indent )&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8301</link>
			<pubDate>Wed, 07 Sep 2011 15:43:19 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">8301@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Lol, it bet it indents more and more 'cause it ignores whitespace in the findPrevLineLastChar function:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;def findPrevLineLastChar(p, sci):
	while p &#38;gt; 0:
		p = p - 1
		c = chr( sci.GetCharAt(p) )

		# Look for a non-whitespace character ending the previous line.
		if not c in [&#38;#039;\n&#38;#039;,&#38;#039;\r&#38;#039;,&#38;#039;\t&#38;#039;,&#38;#039; &#38;#039;]:
			return c
	return None&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;But simply removing the white-space check won't work, nor dropping just the '\t'. It should check whether the whole previous line is white-space or comment and go back further until it fetches the right character.&#60;/p&#62;
&#60;p&#62;Or perhaps do a completely new algorithm. I made an indentation script for C++, which went all over the file and increased indentation on the next line after { (it kept track of the opening and closing braces). Dunno if this would work for Python, as there are no closing brackets or end-keyword...
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (simon)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8300</link>
			<pubDate>Wed, 07 Sep 2011 13:45:21 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">8300@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Yes, there are a couple of bugs in the python indenter. Comments is one, and the other is it will keep indenting if you add extra lines below the indent point. i.e. this:&#60;/p&#62;
&#60;p&#62;type: def monkey():&#60;br /&#62;
type: [enter]&#60;br /&#62;
type: [enter]&#60;/p&#62;
&#60;p&#62;Would be happy to accept patches for any of these issues or other indenters!
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8299</link>
			<pubDate>Wed, 07 Sep 2011 10:20:46 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">8299@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Just came to my mind:&#60;br /&#62;
Python indent won't work if you enter a comment after a colon!&#60;/p&#62;
&#60;p&#62;Example:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;if condition &#38;lt; 1: # check something
no auto-indent, as previous line&#38;#039;s last character isn&#38;#039;t a colon&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;On the other hand, it may indent for no reason, if a comment ends with a colon&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;call_function() # smiley (:
	stupid auto-indent&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8293</link>
			<pubDate>Mon, 05 Sep 2011 13:27:17 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">8293@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Here is the code:&#60;br /&#62;
PN_dir\ini.py&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;@indenter(&#38;quot;python&#38;quot;)
def python_indent(c, doc):
	sci = scintilla.Scintilla(doc)
	if c == &#38;#039;\n&#38;#039; or c == &#38;#039;\r&#38;#039;:
		pos = sci.CurrentPos
		line = sci.LineFromPosition( pos )

		lc = findPrevLineLastChar( pos, sci )

		# If the previous line ended with a colon, then indent
		if lc == &#38;#039;:&#38;#039;:
			indent = sci.GetLineIndentation( line )

			# The DumbIndent system may already have indented this line...
			previndent = sci.GetLineIndentation( line - 1 )
			if indent == previndent or indent == 0:
				indent += 4
				sci.IndentLine( line, indent )&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Next stable release should contain indenters for the most used languages out of the box, that'd be awesome!
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (simon)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8292</link>
			<pubDate>Mon, 05 Sep 2011 12:34:45 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">8292@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Indeed, and PyPN already comes with auto-indent support for Python, so you don't need to write your own indenter.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8289</link>
			<pubDate>Thu, 01 Sep 2011 19:14:36 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">8289@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;There is:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://pnotepad.org/docs/howto/automatic_indentation&#34; rel=&#34;nofollow&#34;&#62;http://pnotepad.org/docs/howto/automatic_indentation&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>auto-indent Python code (bhengh)</title>
			<link>http://pnotepad.org/forums/topic/5441#post-8288</link>
			<pubDate>Thu, 01 Sep 2011 18:44:01 +0000</pubDate>
			<dc:creator>bhengh</dc:creator>
			<guid isPermaLink="false">8288@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;I would like to use Programmer's Notepad to write Python apps.  Is there anyway to get Programmer's Notepad to auto-indent after a block statement?
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>PyPN - Defects and Enhancement requests (simon)</title>
			<link>http://pnotepad.org/forums/topic/5267#post-7984</link>
			<pubDate>Thu, 02 Jun 2011 17:34:45 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">7984@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Uh oh, the recording issue looks like a unicode translation problem. Probably crept in with 2.1 but I didn't notice. Interestingly the recording functionality is mostly written in Python (pypn\record.py) so you may be able to fix it if you fancy taking a look before I get to it!
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>PyPN - Defects and Enhancement requests (ignac)</title>
			<link>http://pnotepad.org/forums/topic/5267#post-7969</link>
			<pubDate>Sun, 29 May 2011 14:03:16 +0000</pubDate>
			<dc:creator>ignac</dc:creator>
			<guid isPermaLink="false">7969@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;After trying to record 'abcd', my script looks slightly different:&#60;/p&#62;
&#60;p&#62;import pn, scintilla&#60;/p&#62;
&#60;p&#62;@script(&#34;New Script&#34;, &#34;Recorded&#34;)&#60;br /&#62;
def RecordedScript():&#60;br /&#62;
	doc = pn.CurrentDoc()&#60;br /&#62;
	sci = scintilla.Scintilla(doc)&#60;br /&#62;
	sci.ReplaceSel(&#34;a'\xcbb'\xcbc'\xcbd'\xcb&#34;)&#60;/p&#62;
&#60;p&#62;And playing the script back now results in:&#60;/p&#62;
&#60;p&#62;a'Ëb'Ëc'Ëd'Ë
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>PyPN - Defects and Enhancement requests (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5267#post-7968</link>
			<pubDate>Sat, 28 May 2011 23:59:28 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">7968@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Interesting... i get those extra chars no matter of the line endings. Script looks like this:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;import pn, scintilla&#60;/p&#62;
&#60;p&#62;@script(&#34;New Script&#34;, &#34;Recorded&#34;)&#60;br /&#62;
def RecordedScript():&#60;br /&#62;
	doc = pn.CurrentDoc()&#60;br /&#62;
	sci = scintilla.Scintilla(doc)&#60;br /&#62;
	sci.ReplaceSel('a\x01\x01b\x01\x01c\x01\x01d\x01\x01')&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>PyPN - Defects and Enhancement requests (ignac)</title>
			<link>http://pnotepad.org/forums/topic/5267#post-7967</link>
			<pubDate>Sat, 28 May 2011 15:29:59 +0000</pubDate>
			<dc:creator>ignac</dc:creator>
			<guid isPermaLink="false">7967@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;So changing the defaults to CRLF (as opposed to CR) makes the error go away, but then a recorded script doesn't really work properly.&#60;/p&#62;
&#60;p&#62;1. I open a new document and click record&#60;br /&#62;
2. I type in abcd&#60;br /&#62;
3. I clock stop&#60;br /&#62;
4. I double click on the script to play it back and junk characters appear along with the abcd. ie:&#60;/p&#62;
&#60;p&#62;aÐbÐcÐdÐ
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>PyPN - Defects and Enhancement requests (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5267#post-7955</link>
			<pubDate>Fri, 27 May 2011 14:05:32 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">7955@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;(This is meant as a collective thread)&#60;/p&#62;
&#60;ul&#62;
&#60;li&#62;&#60;strong&#62;GetCharAt returns an int instead of a character&#60;/strong&#62;&#60;br /&#62;
&#60;code&#62;GetCharAt(self, pos) : int 	Get the character at the given position.&#60;/code&#62;&#60;br /&#62;
The PyPN API doc is right, it returns a number, which is basically what you pass to it (pos). Doesn't make much sense, it should return the character - shouldn't it?&#60;/p&#62;
&#60;p&#62;Workaround: GetTextRange(pos, pos+1)&#60;/li&#62;
&#60;li&#62;&#60;strong&#62;Stock PyPN textclip contain bad indentation&#60;/strong&#62;&#60;br /&#62;
PyPN Script File and PyPN Script Method got 4 leading spaces here:&#60;br /&#62;
&#60;code&#62;${0:pass}&#60;/code&#62;&#60;br /&#62;
The above comment line uses tab indent, leading to indentation error.&#60;/p&#62;
&#60;p&#62;Moreover, the $0 placeholder of PyPN Undo Block is at the beginning of the line, followed by a tab. Either the tab is too much or $0 should be behind it.
&#60;/li&#62;
&#60;li&#62;&#60;strong&#62;PyPN in textclip - problems with line endings and indentation&#60;/strong&#62;&#60;br /&#62;
PyPN code only works in textclips, if you set line endings of your document to Unix (LF) &#60;a href=&#34;http://code.google.com/p/pnotepad/issues/detail?id=1339&#38;amp;sort=-id&#34;&#62;issue #1339&#60;/a&#62;&#60;br /&#62;
Multi-line PyPN script in textclip doesn't work if you insert it in a line with leading whitespace via shortcut &#60;a href=&#34;http://code.google.com/p/pnotepad/issues/detail?id=1346&#38;amp;sort=-id&#34;&#62;issue #1346&#60;/a&#62;
&#60;/li&#62;
&#60;li&#62;Unfortunately, it's not possibly to combine &#60;strong&#62;PyPN in textclip and the placeholder&#60;/strong&#62; system. It would be quite useful tho. &#60;a href=&#34;http://code.google.com/p/pnotepad/issues/detail?id=1345&#38;amp;sort=-id&#34;&#62;issue #1345&#60;/a&#62;
&#60;/li&#62;
&#60;/ul&#62;</description>
		</item>
		<item>
                        <title>How to run script or bind key to script (Nux)</title>
			<link>http://pnotepad.org/forums/topic/5175#post-7690</link>
			<pubDate>Sat, 19 Feb 2011 13:05:08 +0000</pubDate>
			<dc:creator>Nux</dc:creator>
			<guid isPermaLink="false">7690@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;If PN fails to load scripts then most probably you have a syntax error in your script. You can check that by running a script with F5. Note that when your script is fine it will show you something like &#34;No module named pn&#34;. That is fine because you are not running your script in PN context.&#60;/p&#62;
&#60;p&#62;To run a script in PN context you can use this:&#60;br /&#62;
&#60;a href=&#34;http://enux.pl/download/pn2/test.py&#34; rel=&#34;nofollow&#34;&#62;http://enux.pl/download/pn2/test.py&#60;/a&#62;&#60;br /&#62;
You probably shouldn't run complete scripts with this (i.e. containg @script), but you can safely import stuff and use pn and scintilla modules e.g.:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;import os
pn.AddOutput(&#38;quot;\n&#38;quot;+os.path.abspath(__file__))
#
sct = scintilla.Scintilla(pn.CurrentDoc())
pn.AddOutput(&#38;quot;\n Number of selections:&#38;quot;+str(sct.SelectionCount))&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
                        <title>How to run script or bind key to script (cncsnw)</title>
			<link>http://pnotepad.org/forums/topic/5175#post-7679</link>
			<pubDate>Thu, 17 Feb 2011 19:48:19 +0000</pubDate>
			<dc:creator>cncsnw</dc:creator>
			<guid isPermaLink="false">7679@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Thank you, that helps considerably.&#60;/p&#62;
&#60;p&#62;One oddity: if I save my new script under a new filename in the pn2\scripts directory, then the next time I start PN, no scripts at all are available (the Alt-F10 window is blank and no Scripts options show up in the Tools -&#38;gt; Options -&#38;gt; Keyboard list.&#60;/p&#62;
&#60;p&#62;If I paste my new script definition into an existing source file (e.g. the text.py file which was installed with pypn) then it and the other scripts show up and work fine.&#60;/p&#62;
&#60;p&#62;Is there an additional step to &#34;register&#34; a new source file in the scripts directory, to make it play well with PN and the pre-existing scripts?
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>How to run script or bind key to script (Nux)</title>
			<link>http://pnotepad.org/forums/topic/5175#post-7676</link>
			<pubDate>Wed, 16 Feb 2011 07:34:17 +0000</pubDate>
			<dc:creator>Nux</dc:creator>
			<guid isPermaLink="false">7676@http://pnotepad.org/forums/</guid>
			<description>&#60;ol&#62;
&#60;li&#62;Use Alt+F10 to show scripts window. You should find your recorded script there (probably as Recorded&#38;gt;New script).&#60;/li&#62;
&#60;li&#62;In your script you will see &#60;code&#62;@script&#60;/code&#62; tag/function - you should probably change &#34;New script&#34; in it to something more descriptive ;-). You can also change a group of your script (which is &#34;Recorded&#34; by default).&#60;/li&#62;
&#60;li&#62;Now, if you save the file to &#34;path\to\PN2\scripts&#34; that should be it.&#60;/li&#62;
&#60;li&#62;After restarting PN you should see your script with the changed name.&#60;/li&#62;
&#60;li&#62;Finally, if you want to set a shortcut for your script then go to &#34;Options&#34; -&#38;gt; &#34;Keyboard&#34; and search for a group called &#34;Scripts.YourScriptGroup&#34; and command name is what you've put in first parameter of &#60;code&#62;@script&#60;/code&#62;&#60;/li&#62;
&#60;/ol&#62;</description>
		</item>
		<item>
                        <title>How to run script or bind key to script (cncsnw)</title>
			<link>http://pnotepad.org/forums/topic/5175#post-7675</link>
			<pubDate>Tue, 15 Feb 2011 23:36:21 +0000</pubDate>
			<dc:creator>cncsnw</dc:creator>
			<guid isPermaLink="false">7675@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;I have PN 2.2.0.2240 and PyPN 0.10 installed.&#60;/p&#62;
&#60;p&#62;The &#34;Record Script&#34; and &#34;Stop Recording&#34; options are enabled and produce the script in an &#34;untitled&#34; window.  I can save the contents of that window as &#34;somescript.py&#34;.&#60;/p&#62;
&#60;p&#62;How do I play back a recorded script?&#60;/p&#62;
&#60;p&#62;How do I bind a key to a recorded/saved script?&#60;/p&#62;
&#60;p&#62;There must be something simple and obvious I am overlooking....
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>New Script: Jump To... (Patabugen)</title>
			<link>http://pnotepad.org/forums/topic/5142#post-7576</link>
			<pubDate>Mon, 17 Jan 2011 21:14:36 +0000</pubDate>
			<dc:creator>Patabugen</dc:creator>
			<guid isPermaLink="false">7576@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hey,&#60;/p&#62;
&#60;p&#62;One of the features I learned to take for granted in some other editors is a Jump To File dialog, where you can enter a partial filename (such as myfile*) and be presented with a list of files found within your working directory.&#60;/p&#62;
&#60;p&#62;I have written something in PyPN to offer some of this functionality. This is my first go at Python so any feedback on, or improvements to, the code are very welcome.&#60;/p&#62;
&#60;p&#62;Rather than going into the world of GUI's I have made use of a new document within PN to display the output, I'd be interested to know how well this works for you on your systems.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://scriptshare.rocketmonkeys.com/script/30&#34; rel=&#34;nofollow&#34;&#62;http://scriptshare.rocketmonkeys.com/script/30&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;If you want suggestions for keyboard shortcuts to bind this to Netbeans uses Alt + Shift + O (for Open) and Eclipse uses Ctrl + Shift + R (for Resource). Personally I use Alt + Shift + A because it's handy.&#60;/p&#62;
&#60;p&#62;--&#60;br /&#62;
Patabugen&#60;/p&#62;
&#60;p&#62;p.s I realise this is a feature planned for PN in the future, this is intended as an interim measure.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Operating on a rectangular selection (Nux)</title>
			<link>http://pnotepad.org/forums/topic/5114#post-7511</link>
			<pubDate>Mon, 13 Dec 2010 23:38:56 +0000</pubDate>
			<dc:creator>Nux</dc:creator>
			<guid isPermaLink="false">7511@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Never mind. As seems it does work, but I have to run my function (script) with a keyboard shortcut rather then a double-click on it's name.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Operating on a rectangular selection (Nux)</title>
			<link>http://pnotepad.org/forums/topic/5114#post-7510</link>
			<pubDate>Mon, 13 Dec 2010 23:21:35 +0000</pubDate>
			<dc:creator>Nux</dc:creator>
			<guid isPermaLink="false">7510@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hi Simon.&#60;/p&#62;
&#60;p&#62;I'm having troubles with those multi-selections. I've found some docs on &#60;a href=&#34;http://docs.wxwidgets.org/trunk/classwx_styled_text_ctrl.html&#34;&#62;wxwidgets page&#60;/a&#62;, but I was unable to make AddSelection (nor SetSelectionNCaret) working right. I mean the text does get selected but the cursor is not blinking and after running:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
	sct = scintilla.Scintilla(pn.CurrentDoc())&#60;br /&#62;
	sct.SetSelectionNCaret (0, 2)&#60;br /&#62;
	sct.SetSelectionNAnchor (0, 4)&#60;br /&#62;
&#60;/code&#62;&#60;br /&#62;
A paste function is not working. Can I do something to somehow refresh the state of selections or something like that?&#60;/p&#62;
&#60;p&#62;BTW. Is there a way to refresh code (after changes) without reloading the PN? I mean when I change my python script do I have to close and open PN again?
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Operating on a rectangular selection (Nux)</title>
			<link>http://pnotepad.org/forums/topic/5114#post-7500</link>
			<pubDate>Tue, 07 Dec 2010 00:17:05 +0000</pubDate>
			<dc:creator>Nux</dc:creator>
			<guid isPermaLink="false">7500@http://pnotepad.org/forums/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;Also, if you like the Alt selection bit, try using Ctrl and clicking in multiple places - you can insert/delete into multiple places that are not all in one line.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Mind-blowing. Seriously. I was speechless when I saw the possibilities opening... It might actually be faster then RegExp sometimes :-). I can like add class to a HTML table diagonally :-).&#60;/p&#62;
&#60;p&#62;As for the API - do you know if it's something stable? I've searched a lot and haven't found any specs/docs about it.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;ReplaceSel&#60;/code&#62; method doesn't seem to work well (replaces last/main selection) and I see no new method that would work as when you do CTRL+C, CTRL+V. After some digging I'm thinking of using &#60;code&#62;SelectionCount&#60;/code&#62; with &#60;code&#62;GetSelectionNAnchor&#60;/code&#62; and &#60;code&#62;GetSelectionNCaret&#60;/code&#62;. I'm missing only one method - is there something similar to &#60;code&#62;SetTextRange&#60;/code&#62; or is there a way to replace one selection without breaking others?
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Operating on a rectangular selection (simon)</title>
			<link>http://pnotepad.org/forums/topic/5114#post-7497</link>
			<pubDate>Mon, 06 Dec 2010 14:22:46 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">7497@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hi Nux,&#60;/p&#62;
&#60;p&#62;Yes all the APIs are hopefully hanging off the Scintilla object to get what you're looking for. Have a look at &#60;code&#62;RectangularSelectionAnchor&#60;/code&#62; and &#60;code&#62;RectangularSelectionCaret&#60;/code&#62;. There are also virtual space versions of those methods too (virtual space being where the block selection includes space that's not actually in the document). To work out whether you have a rectangular selection use &#60;code&#62;SelectionIsRectangle&#60;/code&#62; or &#60;code&#62;SelectionMode&#60;/code&#62;. To see these and all the rest of the scintilla APIs try running this as a script:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;s = scintilla.Scintilla(pn.CurrentDoc())
pn.AddOutput(str(dir(s)).replace(&#38;#39;,&#38;#39;, &#38;#39;\n&#38;#39;))&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Also, if you like the Alt selection bit, try using Ctrl and clicking in multiple places - you can insert/delete into multiple places that are not all in one line.&#60;/p&#62;
&#60;p&#62;Enjoy!
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Operating on a rectangular selection (Nux)</title>
			<link>http://pnotepad.org/forums/topic/5114#post-7490</link>
			<pubDate>Sun, 05 Dec 2010 23:58:39 +0000</pubDate>
			<dc:creator>Nux</dc:creator>
			<guid isPermaLink="false">7490@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hi. I'm just wondering if it is possible to know that the selected block is a rectangular selection and how to make operations on this selection? What I would need is at least an information at which line does the selection starts and ends and probably column numbers... Or maybe simply dimensions and a starting position... But some kind of access to a collection of lines in this selection would be wonderful.&#60;/p&#62;
&#60;p&#62;I'm asking because I want to do a script that would add tags around each selected line of code in this block. Picture for example a space indented table to which you want to add an extra cell in each row or add links inside this cells...&#60;/p&#62;
&#60;p&#62;BTW. I just discovered something amazing :-). When I select few lines of code with ALT pressed I can write on few lines of code at once and even delete characters on each of these lines. This is great :D!
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>How to use ISearchOptions in PyPN-Script? (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5077#post-7439</link>
			<pubDate>Wed, 27 Oct 2010 21:34:26 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">7439@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Thank you simon, I got the SearchOptions working. Script recording is a really helpful feature, thanks for the hint!&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;# add line breaks

        opt = pn.SearchOptions()

	opt.FindText = u&#38;#39;\\{&#38;#39;
	opt.MatchWholeWord = False
	opt.MatchCase = False
	opt.UseRegExp = True
	opt.SearchBackwards = False
	opt.LoopOK = True
	opt.UseSlashes = False
	opt.ReplaceText = u&#38;#39;\\r\\n{\\r\\n&#38;#39;
	opt.ReplaceInSelection = False
	doc.ReplaceAll(opt)

	opt.FindText = u&#38;#39;\\}&#38;#39;
	opt.ReplaceText = u&#38;#39;\\r\\n}\\r\\n&#38;#39;
	doc.ReplaceAll(opt)

	opt.FindText = u&#38;#39;;&#38;#39; # TODO: take care of semicolons in quoted strings!
	opt.ReplaceText = u&#38;#39;;\\r\\n&#38;#39;
	doc.ReplaceAll(opt)

	opt.FindText = u&#38;#39;(for[ ]*\\([ ]*[^;]+;)\\r\\n([^;]+;)\\r\\n([^)]+\\))&#38;#39;
	opt.ReplaceText = u&#38;#39;\\1 \\2 \\3\\r\\n&#38;#39;
	doc.ReplaceAll(opt)&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
                        <title>How to use ISearchOptions in PyPN-Script? (simon)</title>
			<link>http://pnotepad.org/forums/topic/5077#post-7402</link>
			<pubDate>Tue, 05 Oct 2010 13:31:33 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">7402@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hi, there are two ways to do what you're looking for. The SearchOptions stuff lets you search the same way the user does. To get a new SearchOptions instance to work with do this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;so = pn.SearchOptions()
so.FindText = &#38;quot;some text&#38;quot;
pn.CurrentDoc().FindNext(so)&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;An alternative is to use a more simple python-only implementation of ReplaceAll which are added to Scintilla on initialization. Look at Scintilla.ReplaceAll and Scintilla.ReplaceAllInRange, e.g.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;editor.ReplaceAll(&#38;quot;something&#38;quot;, &#38;quot;something else&#38;quot;)&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;These methods are set up by pypn.scintillautils.MonkeyPatch which is called as part of PyPN initialization. They could be extended further to provide support for Regular Expressions fairly easily by making use of the flags parameter (currently unused).&#60;/p&#62;
&#60;p&#62;Note that a good way to find out how to do search/replace is to just record a script and do what you need. PN will spit out a PyPN script doing everything you need.&#60;/p&#62;
&#60;p&#62;Hope this helps.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>How to use ISearchOptions in PyPN-Script? (CoDEmanX)</title>
			<link>http://pnotepad.org/forums/topic/5077#post-7401</link>
			<pubDate>Mon, 04 Oct 2010 22:43:11 +0000</pubDate>
			<dc:creator>CoDEmanX</dc:creator>
			<guid isPermaLink="false">7401@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Hi simon,&#60;br /&#62;
i wrote a little python script to format some c-like code, which has all whitespace removed. Before i run it, i have to replace all appearences of:&#60;/p&#62;
&#60;p&#62;\{ &#60;strong&#62; --&#38;gt; &#60;/strong&#62; \r\n{\r\n &#60;em&#62;(add line break before and after left brace)&#60;/em&#62;&#60;br /&#62;
\} &#60;strong&#62; --&#38;gt; &#60;/strong&#62; \r\n}\r\n &#60;em&#62;(same for right brace)&#60;/em&#62;&#60;br /&#62;
; &#60;strong&#62; --&#38;gt; &#60;/strong&#62; ;\r\n &#60;em&#62;(line break after semicolon)&#60;/em&#62;&#60;br /&#62;
(for[ ]*\([ ]*[^;]+;)\r\n([^;]+;)\r\n([^)]+\)) &#60;strong&#62; --&#38;gt; &#60;/strong&#62; \1 \2 \3\r\n &#60;em&#62;(repair for-loops, they contain semicolons)&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;these regular expressions add the missing line breaks&#60;/p&#62;
&#60;p&#62;then i use my python script to add indentation:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;import pn
import string
import scintilla
from pypn.decorators import script

@script(&#38;quot;Indent (C++)&#38;quot;, &#38;quot;Script&#38;quot;)
def IndentCpp():
    editor = scintilla.Scintilla(pn.CurrentDoc())

    indentLevel = 0
    tab_width = 4
    left_brace_cur_line = False
    end = editor.Length

    editor.BeginUndoAction()

    for l in range(editor.LineCount):
        line = editor.GetLine(l)
        a = 0
        while True:
            if (a &#38;gt;= len(line)):
                if (left_brace_cur_line):
                    if (indentLevel &#38;gt; 0):
                        editor.SetLineIndentation(l,(indentLevel-1)*tab_width)
                else:
                    editor.SetLineIndentation(l,indentLevel*tab_width)
                left_brace_cur_line = False
                break
            if (line[a] == &#38;quot;{&#38;quot;):
                indentLevel = indentLevel + 1
                left_brace_cur_line = True
            elif (line[a] == &#38;quot;}&#38;quot; and indentLevel &#38;gt; 0):
                indentLevel = indentLevel - 1
            a = a + 1

    editor.EndUndoAction()&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I'd like to automate the regex stuff, but there's no replace/replaceall function python. I found IDocument.ReplaceAll and ISearchOptions.* in the PyPN API documentation but i don't know how to use the search options.&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;p = pn.CurrentDoc()&#60;br /&#62;
p.ISearchOptions ???&#60;/strong&#62;&#60;/p&#62;
&#60;p&#62;can you tell me how use it properly or tell me another way to this task?
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Hello, love the new script recorder! (Jan)</title>
			<link>http://pnotepad.org/forums/topic/583#post-2095</link>
			<pubDate>Wed, 20 May 2009 10:49:34 +0000</pubDate>
			<dc:creator>Jan</dc:creator>
			<guid isPermaLink="false">2095@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Thanks, great stuff.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Hello, love the new script recorder! (simon)</title>
			<link>http://pnotepad.org/forums/topic/583#post-2094</link>
			<pubDate>Wed, 20 May 2009 08:04:45 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">2094@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Yes, I think adding the Begin... and End... is probably the right thing to do and ignore mid-script undo. If you want this now, it's easy to add - the script recorder is mostly python code too!&#60;/p&#62;
&#60;p&#62;Open pypn\record.py in your Programmer's Notepad directory and you have the code that handles the record. In &#60;code&#62;Recorder.__init__&#60;/code&#62; you'll see the initial text used for the script (&#60;code&#62;self.script = ...&#60;/code&#62;) so you can add a call to &#60;code&#62;scintilla.BeginUndoAction()&#60;/code&#62; there. To add EndUndoAction add the line in the &#60;code&#62;Recorder.stopRecording&#60;/code&#62; method right after the call to &#60;code&#62;flushBuf&#60;/code&#62;, e.g.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;def stopRecording(self):
        &#38;quot;&#38;quot;&#38;quot;Comment is here&#38;quot;&#38;quot;&#38;quot;
        self._flushbuf()
        self.script = self.script + &#38;quot;\tscintilla.EndUndoAction()\r\n&#38;quot;
        ...&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
                        <title>Hello, love the new script recorder! (Jan)</title>
			<link>http://pnotepad.org/forums/topic/583#post-2091</link>
			<pubDate>Tue, 19 May 2009 19:36:12 +0000</pubDate>
			<dc:creator>Jan</dc:creator>
			<guid isPermaLink="false">2091@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;But what about adding Begin/EndUndoAction automatically at the beginning and at the end of the script? Recording undo doesn't make much sense to me at first sight, but undoing the sequence of actions as a whole is pretty much what I would expect the undo command to do when it comes to a macro.
&#60;/p&#62;</description>
		</item>
		<item>
                        <title>Hello, love the new script recorder! (simon)</title>
			<link>http://pnotepad.org/forums/topic/583#post-2086</link>
			<pubDate>Tue, 19 May 2009 14:45:01 +0000</pubDate>
			<dc:creator>simon</dc:creator>
			<guid isPermaLink="false">2086@http://pnotepad.org/forums/</guid>
			<description>&#60;p&#62;Yes, this was because I was considering how to add support for recording undo actions. For the moment that means neither undo grouping or recording undo is supported. The problem is that undo is not necessarily predictable - what gets undone would be based partly on what you did before running the script. You also can't perform an undo in the middle of an undo group, or at least that doesn't seem to make sense to me.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>

