Scripts discussion (3)

Discuss and announce AkelPad plugins
  • Author
  • Message
KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

InFive wrote:Hence the question - in SearchReplace.js script, I'm used to, in the field With, write $1 for a group. in TextReplace.js script, I have to use inclined \ -it turns out that the TextReplace.js script does not support advanced regular expression syntax, or I have something mixed up?
For regular expressions SearchReplace.js script uses JScript syntax, TextReplace.js script uses AkelPad syntax.
So you should use:
\0 - entire matched text,
\1 - first captured substring in parentheses,
\2 - second captured substring,
etc.
If "Replace with function" is checked, in function body ("With") you should use:
_s0 - entire matched text,
_s1 - first captured substring in parentheses,
_s2 - second captured substring,
etc.
InFive wrote:такой вопрос - функции, которые можно использовать в скриптах по поиску/замене - есть справочная инфа, как использовать такие функции в таких скриптах? и где брать такие функции?
то есть, хочу научиться использовать функции в скриптах по поиску/замене... что может научить?
See description in TextReplace_function.js script.

Offline
Posts: 96
Joined: Tue Nov 10, 2015 4:56 am

Post by InFive »

KDJ
Thanks for the clarification.

TextReplace_test_for_498.js:
works terribly, I'm talking about the replacement by using batch files.
created a batch file, it just 24 rows. run it on the text size is 25 megabytes. so AkelPad ate up 1.7 gigs of RAM, horror takes to shake ...
just never understood how in a batch file to write a regular expression that will only remove certain text, in the string should be the flag "r", for without this flag, the regular expression is treated as plain text to search for.
I made another batch file, in which all 9 lines, the RAM took just 1 gigabyte. Unfortunately, this script for batch replacements is not suitable ...

for batch replacement I use ScriptTemplate.vbs script from Andrey_Averin ... in it I create templates for replacements for a few thousand lines and copes well and not so creepy consumes memory.

Now imagine that I will create a batch file for the TextReplace(_test_for_498).js script which will include several thousand rows? so my comp "burn".

Unfortunately, alas ...

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

InFive
Additional memory is occupied by undo buffer.
Set undo limit to 0 and check it.

Offline
Posts: 96
Joined: Tue Nov 10, 2015 4:56 am

Post by InFive »

KDJ wrote:InFive
Additional memory is occupied by undo buffer.
Set undo limit to 0 and check it.
but I'm not sure what the problem was because of this, because I have the undo limit specified in the value "1". but well, I'll try with a value of "0".

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

InFive
I tested memory usage and speed of replacement in AkelPad and Notepad++


File for test: 400000 lines, 16800000 bytes, repeated 2 lines 200000 times:

Code: Select all

abcdefghijabcdefghijabcdefghijabcdefghij
jihgfedcbajihgfedcbajihgfedcbajihgfedcba
Test results (replace all by standard replace dialog):

Code: Select all

editor            Notepad++       AkelPad         AkelPad         AkelPad      
undo limit        no limit        1000               1               0         
run editor          9 MB             7 MB            7 MB            7 MB      
open file          43 MB            60 MB           60 MB           60 MB
replace a -> 0    160 MB/55 sec    126 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace b -> 1    274 MB/55 sec    191 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace c -> 2    453 MB/55 sec    257 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace d -> 3    503 MB/55 sec    323 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace e -> 4    crash            389 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace f -> 5                     455 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace g -> 6                     521 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace h -> 7                     586 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace i -> 8                     652 MB/2 sec    126 MB/2 sec     60 MB/2 sec
replace j -> 9                     670 MB/2 sec    126 MB/2 sec     60 MB/2 sec

Offline
Posts: 202
Joined: Sat Mar 28, 2015 2:36 pm
Location: Russia

Post by Kley »

RenameFileAs.js
Переделан. См. описание скрипта.
SessionMenu.js
Небольшая доработка скрипта.

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Infocatcher
Что-то я затупил: как можно в winMergeTabs.js добавить ключи запуска WinMerge?
Типа /x, /s, возможно, и /u будет кому-нибудь интересно.

Offline
Posts: 1862
Joined: Mon Aug 06, 2007 1:07 pm
Contact:

Post by Infocatcher »

Skif_off
Ну да, можно, по аналогии с примером из комментариев в коде:

Code: Select all

Call("Scripts::Main", 1, "winMergeTabs.js", '-path="%COMMANDER_PATH%\TOTALCMD.EXE" -cmd="<exe> /S=C <f1> <f2>"')
(-path, если автоматика справляется, можно не передавать)

Offline
Posts: 1161
Joined: Sun Oct 20, 2013 11:44 am

Post by Skif_off »

Infocatcher
Спасибо, смутило
set custom command line for any other compare tool
:)

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Kley wrote:KDJ
AkelPadManualSettings.js
Простите пожалуйста, если повторяюсь.
Мои действия: Default all -> Apply ->

Code: Select all

AkelPad manual settings
---------------------------
Set all parameters to default values?
-> ОК

Code: Select all

AkelPad
---------------------------
Changes will be reflected upon restarting the program.
Akelpad больше не отвечает.
AkelPadManualSettings.js
Fixed: after changing some settings, if appears the message "Changes will be reflected upon restarting the program.", AkelPad hangs.
Required: Scripts plugin v.18.5.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

AkelPadDocsView.js
PluginText.js
Fixed: if you try to close modified document, then appears the message "Document was modified. Do you want to save it?" and AkelPad hangs.
Required: Scripts plugin v.18.5.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

InFive wrote:TextReplace_test_for_498.js:
works terribly, I'm talking about the replacement by using batch files.
created a batch file, it just 24 rows. run it on the text size is 25 megabytes. so AkelPad ate up 1.7 gigs of RAM, horror takes to shake ...
Here is new test version TextReplace_test_for_498.js: KDJ.zip.
Check it with 'Disable "Undo"' option.

Offline
Posts: 96
Joined: Tue Nov 10, 2015 4:56 am

Post by InFive »

KDJ wrote: Here is new test version TextReplace_test_for_498.js: KDJ.zip.
Check it with 'Disable "Undo"' option.
ok, thanks

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Translator.js
Added languages:
Google - Punjabi, Tamil,
Bing - Bosnian, Croatian,
Yandex - Irish, Galician, Haitian Creole, Hindi, Latin, Punjabi, Swahili, Tamil, Urdu.

Offline
Posts: 1862
Joined: Mon Aug 06, 2007 1:07 pm
Contact:

Post by Infocatcher »

KDJ wrote:Translator.js

Code: Select all

aLangs[42][1] = "Панджаби";

aLangs[53][1] = "Тамильский";
Locked