Macro automatically adding a value to a value

I have a problem with a macro in notepad ++

You just need the value to automatically change to +1 (from the current value)

Values ​​must be 1000, 1001, 1002, 1003, etc. for the following 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 to do this.

Can anyone help?

thanks

+6
source share
2 answers

1) Create a list of numbers from 1000 to the desired number using excel and copy it to Notepad ++.

2) Go to the beginning of the file.

3) Start a macro shot.

 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 necessary.

+5
source

If you can align the tags vertically, you can use the Column Editor for numbering. Let's say you format the XML as follows:

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

Now place the cursor between the start and end tags of MEDIA_ID . Select Column Editor... in the Edit menu (shortcut ALT + C). Change the switch to Number to Insert with a starting value of 1001 increasing by 1 (Decimal). Confirm your selection with OK. You should end up with:

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

Unfortunately, it seems that these operations cannot be used in a macro. But maybe that helps.

+4
source

Source: https://habr.com/ru/post/902465/


All Articles