6

I have a problem with macro in notepad++

Just needs to have value automatically changed to +1 (from current value)

So the values should be like this 1000, 1001, 1002, 1003 and so on for the coming values between the MEDIA_ID tags..

      <MEDIA>
      <MEDIA_ID>1000</MEDIA_ID>
      </MEDIA>
      <MEDIA>
      <MEDIA_ID>1001</MEDIA_ID>
      </MEDIA>

I have no idea how do this..

Could anyone help?

Thanks

user1067455
  • 61
  • 1
  • 3
  • What's the usage? You need to do this regularly? A one-off need? You could definitely do this using PythonScript and FingerText; but to what extent is it needed? Do inserts in the middle of the list need to adjust lower entries or are they always at the bottom and always sorted? – Thell Oct 14 '12 at 23:47

2 Answers2

6

1) Generate the list of numbers from 1000 to the number you want using excel and copy this into notepad++.

2) Go to the start of the file.

3) Start the macro recorder.

4) type <MEDIA>(down arrow)(HOME button)<MEDIA_ID>(END button)</MEDIA>(down arrow)(HOME button)</MEDIA>(down arrow)(HOME button)

5) repeat this macro as many times as needed.

Pradeep Vairamani
  • 4,004
  • 3
  • 36
  • 59
4

If you can align the tags vertically then you might be able to use the Column Editor to do the numbering. Say you format the XML like this:

<MEDIA><MEDIA_ID></MEDIA_ID></MEDIA>
<MEDIA><MEDIA_ID></MEDIA_ID></MEDIA>
....
<MEDIA><MEDIA_ID></MEDIA_ID></MEDIA>

Now, place your cursor betweeen the start and end tags of MEDIA_ID. Choose Column Editor... from the Edit menu (ALT+C keyboard shortcut). Change the radio button to Number to Insert with a starting value of 1001 incrementing by 1 (Decimal). Confirm using the OK button. You should end up with this:

<MEDIA><MEDIA_ID>1001</MEDIA_ID></MEDIA>
<MEDIA><MEDIA_ID>1002</MEDIA_ID></MEDIA>
....
<MEDIA><MEDIA_ID>1199</MEDIA_ID></MEDIA>

Sadly, it seems that this operations cannot be used in a macro. But maybe it helps.

Adam Hawkes
  • 7,218
  • 30
  • 57