Discussion:
[notepad-plus - Help] Erroneous execution of macro in Notepad++
(too old to reply)
SourceForge.net
2009-08-24 06:21:02 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7579744
By: ycc-swe

Thanks a lot for keeping up the excellent program Notepad ++.

However. When I record and execute a macro, the execution will not produce the
same actions as the recording. My feeling is that it maybe has to do with the
cursor positioning being different during the execution.

I apologize for not supplying a complete example of the problem. If that is
needed I will naturally do so. However, the problem occurs so often, almost
more often than not, so my question is: Is there a problem with the macro function
in Notepad++ or is there some setting or basic fact I have neglected. (I have
used macros in many editors since the 1980's so I think I can say that I have
a basic idea what should happen.)

Thanks again for all work being put into the project.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-24 08:26:22 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7579923
By: cchris

Macros record basic Scintila actions, and don't always keep the semantics (the
editor level action). This is the basic issue, and its correction will take
time. But there are plans to arrange this.

In the meantime, if you can post a short macro with undesired behaviour, it
will help.

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-25 04:31:39 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7581788
By: ycc-swe

Thanks a lot for taking the time, Chris.



Illustrating possible bug in Notepad++ macrofunction.
The bug is maybe related to cursorpositioning in macros?
The execution of the macro will not yield the same result as is obtained during
the recording.

This file originally contained the following three similar groups
of characters:
ab cd ef
gh ij kl
mn op qr

ab cd ef
gh ij kl
mn op qr

ab cd ef
gh ij kl
mn op qr



The cursor was put on the first line of the second group of characters (starting
ab) and macro recording started.
The purpose of the macro was to exchange the first character in each pair of
characters to an X.
Only the arrow-keys and the delete key were used to replace these characters
by X.
I jumped a little randomly around, using the arrowkeys.
The correct final result is seen in the second group of characters:
Xb Xd Xf
Xh Xj Xl
Xn Xp Xr

After that (the cursor was correctly put in the corresponding first position
on the first line of the next group of characters) and stopped recording and
executed.
The third group of characters is widely different from the expected second
group:
XX cXXef
ghXij Xl
Xn Xp qr



Thanks a lot for all the work you put into this project.
Notepad++ is really a good product.

Y Lo







The file finally looked like this:

ab cd ef
gh ij kl
mn op qr

Xb Xd Xf
Xh Xj Xl
Xn Xp Xr

XX cXXef
ghXij Xl
Xn Xp qr


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-25 08:23:08 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7582144
By: cchris

Could you open shortcuts.xml, copy the definition of your macro - it starts
with <Macro name=mymacro_name ... and ends at the firsy </Macro> - and post
it here? email it to cchris if there is any issue in posting it I think the
problem magistrally illustrate my earlier point, but I'd like to be sure. As
I said, the cure is not an easy fix.

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-26 05:54:40 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7584654
By: ycc-swe

I opened shortcuts.xml. As I understand, only the macro "Trim Trailing and save"
is saved there. The macros I have made are not mentioned here. (But they are
stored somewhere, since I can close np++ and they are available when I reopen
the pgm. I can also find the macros under "Shortcut mapper"

I need more instructions if I should be able to find where my macro is
recorded.

Thanks for taking interest.



shortcuts.xml

<Macros>
<Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes"
Key="83">
<Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
</Macros>


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-26 07:02:48 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7584720
By: ycc-swe

Maybe I should clarify:
When I open np++ I can find the "pre-recorded" macro "Trim Trailing and save"
together with the macros I have recorded under the menu "Macros". However, rather
unexpected to me, in shortcuts.xml, I think only "Trim Trailing and save" is
stored, not the macros recorded by me. If I should supply this information,
please inform me how to find the complete information about the content of the
macros recorded by me.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-26 08:26:36 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7585072
By: cchris

You have two shortcutsxml, and opened the rong one One is alongside notepad++exe,
one is in %APPDATA%\Notepad++\ You'll find the macros by opening the other file
It's not a good idea imho to have two sets of config files, but this happens
when not careful or consistent in installing - hard to avoid

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-27 03:40:24 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7588295
By: ycc-swe

I am sorry, I just can't find where the entire keystroke-combinations of stored
macros are stored. I can only find the following folders relating to notepad++

C:\Program Files\Notepad++
this folder contains shortcuts.xml (and also the np++ application etc)
shortcuts.xml is included in its whole below

C:\Documents and Settings\All Users\Start Menu\Programs\Notepad++
f.ex. containing a shortcut to np++ application

When I set the system to search for shortcuts.xml it will only turn up one version
of the file.

I don't know how to find the %APPDATA% folder. I can find the following folder:
C:\Documents and Settings\All Users\Application Data
It does not contain a np++ folder though.

(I am currently using an old XP pro 2002 sp2 system at an Internetcafe)

If I find them, I will come back, naturally.



shortcuts.xml

<NotepadPlus>
<InternalCommands />
<Macros>
<Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes"
Key="83">
<Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
<Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
</Macro>
</Macros>
<UserDefinedCommands>
<Command name="launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes"
Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command>
<Command name="launch in IE" Ctrl="yes" Alt="yes" Shift="yes"
Key="73">iexplore &quot;$(FULL_CURRENT_PATH)&quot;</Command>
<Command name="Get php help" Ctrl="no" Alt="yes" Shift="no"
Key="112">http://www.php.net/%20$(CURRENT_WORD)</Command>
<Command name="Google Search" Ctrl="no" Alt="yes" Shift="no"
Key="113">http://www.google.com/search?q=$(CURRENT_WORD)</Command>
<Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no"
Key="114">http://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Co
mmand>
<Command name="open file" Ctrl="no" Alt="yes" Shift="no"
Key="116">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD)</Command>
<Command name="open in another instance" Ctrl="no" Alt="yes" Shift="no"
Key="117">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession
-multiInst</Command>
<Command name="Open containing folder" Ctrl="no" Alt="no" Shift="no"
Key="0">explorer $(CURRENT_DIRECTORY)</Command>
<Command name="Open current dir cmd" Ctrl="no" Alt="no" Shift="no" Key="0">cmd
/K cd $(CURRENT_DIRECTORY)</Command>
</UserDefinedCommands>
</NotepadPlus>


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-27 08:31:02 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7588713
By: cchris

For me, the %APPDATA% Notepad++ folder is at C:\Documents and
Settings\Propriétaire\Application Data\Notepad++ . NP++ looks for shortcuts.xml
only there and in its own folder - and it find your macro, so it really must
be there.

I can't see why the file would be hidden, but perhaps. Did you try finding
shortcuts.xml in the whole of Docs and Settings and its subfolders?

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-28 03:49:20 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7591455
By: ycc-swe

I don't know where the appdata is in this system. I searched the harddisks from
the top for shortcuts.xml.

There is an option during installation "Do not use %appdata%". I chose this
and now the macros I make store in the np++ "program files" folder.

This is the chunk of text I wish to process with the example macro (macro named
ycc_test_00):

ab cd ef
gh ij kl

I wish to put the cursor at "a" and move around with the arrows exchanging the
first letter of every pair to capitals. I only use arrowkeys, deletekey and
corresponding upper case letter key.

The result of the macro should be like this:

Ab Cd Ef
Gh Ij Kl

During recording of the macro everything is OK, but during execution the following
garbled result is obtained:

Ab Cd EfGghIijKkl



The macro is recorded like this:

<Macro name="ycc_test_000" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="A" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="C" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="E" />
<Action type="0" message="2300" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="K" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="I" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2304" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="G" />
</Macro>


I interpret the "message" parameter like this:
2180 delete-key
2306 R-arrow
2300 D-arrow
2304 L-arrow

As I see it the macro is correctly recorded (exactly like I went through it
during recording) and the garbling must occur later, during the execution.


______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-28 03:54:40 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7591466
By: ycc-swe

It seems the macro-engine loses track of its position (one step left) when I
step down one line? It starts erasing the blanks instead of the first letters
of the pairs.
(If I delete with backspace instead I get the same result))

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-28 04:00:06 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7591470
By: ycc-swe

I made some further experiments. Could this problem have to do with HOW NEW
LINE IS REPRESENTED. I have seen similar things happening my own programs. New
line is represented differently in f.ex. Linux and Windows. If new line
is represented by either one or two characters will make a difference for where
the cursor is positioned.

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-28 16:15:21 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7593474
By: cchris

I'd suggest recording this:
delete
insert 'A'
next word right (ctrl+right)
delete
insert 'C'
next word right
delete
insert 'E'
home
line down
delete
insert 'G'
...

Better?
The automatic uppercasing is something a script language will do, not a macro.

CChris

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754
SourceForge.net
2009-08-29 02:42:37 UTC
Permalink
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=7594508
By: ycc-swe

As I understand there is a bug in the macro-function. I hope it has come to
the developers' attention through this thread.

Thanks for all good work being put into Notepad++

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=331754

Continue reading on narkive:
Loading...