Scripts discussion (4)
- Author
- Message
-
Offline
- Posts: 1879
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts discussion (4)
DV
Просьба в GoToAnything.js добавить ограничение по размеру файла, пролистал соседние файлы, наткнулся на объемный криптоконтейнер без расширения, и AkelPad заругался на нехватку памяти, порекомендовал завершить работу и в итоге упал.
Я думаю, (настраиваемого) лимита в 100-200 Мбайт хватит всем.
А еще у меня (периодически?) не закрывается временная вкладка, которая использовалась для предварительного просмотра. Если закрыть окно GoToAnything.js крестиком или через Esc – временная вкладка закрывается. А если через двойной клик по другому файлу или Enter – остается.
Просьба в GoToAnything.js добавить ограничение по размеру файла, пролистал соседние файлы, наткнулся на объемный криптоконтейнер без расширения, и AkelPad заругался на нехватку памяти, порекомендовал завершить работу и в итоге упал.
Я думаю, (настраиваемого) лимита в 100-200 Мбайт хватит всем.
А еще у меня (периодически?) не закрывается временная вкладка, которая использовалась для предварительного просмотра. Если закрыть окно GoToAnything.js крестиком или через Esc – временная вкладка закрывается. А если через двойной клик по другому файлу или Enter – остается.
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
Added in 0.7.2.Infocatcher wrote:Просьба в GoToAnything.js добавить ограничение по размеру файла
F1 ?Infocatcher wrote:А еще у меня (периодически?) не закрывается временная вкладка, которая использовалась для предварительного просмотра. Если закрыть окно GoToAnything.js крестиком или через Esc – временная вкладка закрывается. А если через двойной клик по другому файлу или Enter – остается.
-
Offline
- Posts: 1879
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts discussion (4)
Спасибо!
Справку-то я читал.
Вопрос в ожидаемом поведении.
Вот я открыл список файлов, полистал/поискал в поисках нужного, нашел, нажал Enter.
Но если нужный файл уже был открыт, то временную вкладку правильнее закрыть.
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
А! Тепер зрозумів. Так, це мій недогляд, виправлю.Infocatcher wrote: ↑Tue Feb 20, 2024 9:18 pmНо если нужный файл уже был открыт, то временную вкладку правильнее закрыть.
Fixed in 0.7.4.
https://github.com/d0vgan/AkelPad-Scrip ... nything.js
-
Offline
- Posts: 1879
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts discussion (4)
Спасибо, теперь работает как надо.DV wrote: ↑Wed Feb 21, 2024 11:38 am Fixed in 0.7.4.
https://github.com/d0vgan/AkelPad-Scrip ... nything.js
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
GoToAnything 0.7.5 is available!
Here is something you surely wanted but hesitated to ask
A new static option "ExcludePreviewedFilesFromRecentFiles" to not update the Recent Files while previewing.
Also, you may be interested in playing with the static options "SelTextColor_ThemeVar" and "SelBkColor_ThemeVar" if you haven't already.
Here is something you surely wanted but hesitated to ask
Also, you may be interested in playing with the static options "SelTextColor_ThemeVar" and "SelBkColor_ThemeVar" if you haven't already.
-
Offline
- Posts: 49
- Joined: Thu May 05, 2022 5:38 am
Re: Scripts discussion (4)
VerticalMarkup.js v1.1
Добавлено: Левый отступ автоматически устанавливается равным нулю.
Добавлено: Восстанавливает изначальный фон и левый отступ.
Добавлено: Левый отступ автоматически устанавливается равным нулю.
Добавлено: Восстанавливает изначальный фон и левый отступ.
-
Offline
- Posts: 47
- Joined: Sat Jul 05, 2008 11:30 am
- Location: Odesa, Ukraine
Re: Scripts discussion (4)
How to find a pair of slashes (/something-in-between/) and replace it with a pair of square brackets ([something-in-between]) within a line excluding ones (slashes) that are part of a URL (such as https://, etc.)?
Example target text:
Expected result:
Now I do it this way:
Indeed, the above code replaces all the pairs of slashes indistinguishably, so I have to use the second pass to repair the square brackets within URLs replacing them back with slashes (as a "workaround", name it).
Of course, I hate that so-called "workaround" and would prefer a straightforward approach, but I just could not find it.
I have tried a 'negative lookbehind search' method, that could work somewhere (https://regex101.com/r/RedAmd/1), but not in AkelPad since AkelPad doesn't accept .* in (?<!http.*) (as in https://regex101.com/r/RedAmd/1).
Example target text:
Code: Select all
Lorem // ipsum
https://www.google.com/search?q=lorem+ipsum
/lorem:ipsum/[A][B][C] ( nnn { ggg { nnn
consecteur /adipiscing/ eu/turpis//velit/ ut/rhoncus
tincidunt/ eget/ nibh nam/ facilisis/ ligula/ laciniaCode: Select all
Lorem [] ipsum
https://www.google.com/search?q=lorem+ipsum
[lorem:ipsum][][][] (nnn {ggg {nnn
consecteur [adipiscing] eu[turpis][velit] ut/rhoncus
tincidunt[ eget] nibh nam[ facilisis] ligula/ laciniaCode: Select all
var $hashTable = {
"/(.*?)/":"[\\1]" // slashes to square brackets
}
$mode = 0x002C0000;
for(var $key in $hashTable)
AkelPad.TextReplace(0,$key,$hashTable[$key],$mode,0x1);Of course, I hate that so-called "workaround" and would prefer a straightforward approach, but I just could not find it.
I have tried a 'negative lookbehind search' method, that could work somewhere (https://regex101.com/r/RedAmd/1), but not in AkelPad since AkelPad doesn't accept .* in (?<!http.*) (as in https://regex101.com/r/RedAmd/1).
-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
The simpler, the better
-
Offline
- Posts: 47
- Joined: Sat Jul 05, 2008 11:30 am
- Location: Odesa, Ukraine
Re: Scripts discussion (4)
Thanks for the hint.
At first, I split the text line by line; then I applied the indexOf() method to each line, doing find/replace for the lines that did not include 'http', and it worked:
Code: Select all
$start=AkelPad.GetSelStart();
$end=AkelPad.GetSelEnd();
if ($start == $end)
AkelPad.SetSel(0,-1);
$text=AkelPad.GetSelText(); //WScript.Echo($text);
$line=$text.split(/\r\n|\n|\r/gm); //WScript.Echo($line.length);
for (var $i = 0; $i < $line.length; $i++) { //WScript.Echo($line[$i]);
if ($line[$i].indexOf("http") == -1) {
$swap=$line[$i].replace(/\/(.*?)\//gm,"[$1]");
$text=$text.replace($line[$i],$swap);
}}
AkelPad.ReplaceSel($text);
AkelPad.SetSel($start,$start);-
Offline
- Posts: 1294
- Joined: Thu Nov 16, 2006 11:53 am
- Location: Kyiv, Ukraine
Re: Scripts discussion (4)
In general, you may still want to apply some find/replace to the same line where "http" is located. I mean, if you had a situation similar to the following:
Code: Select all
pre-text http://some_url post-textOr, in even more general case, you may have something like this:
Code: Select all
pre-text http://some_url sub-text https://other_url post-textBut the level of the complexity is completely determined by the actual needs
-
Offline
- Posts: 47
- Joined: Sat Jul 05, 2008 11:30 am
- Location: Odesa, Ukraine
Re: Scripts discussion (4)
2DV
Funny/sad thing, while distinguishing 'pre-text http://some_url', and 'sub-text https://other_url' parts is a piece of cake (since 'http*' part clearly indicates the boundaries, where the next part starts, and the previous part ends), parting 'http://some_url mid-text', and 'http://some_url post-text' could be tricky, if possible at all (outside of mark-ups with apparent delimiters, such as htmls, xmls, etc) in case of plain texts where URLs include whitespace(s).
Luckily, my use case doesn't imply such issues.
Funny/sad thing, while distinguishing 'pre-text http://some_url', and 'sub-text https://other_url' parts is a piece of cake (since 'http*' part clearly indicates the boundaries, where the next part starts, and the previous part ends), parting 'http://some_url mid-text', and 'http://some_url post-text' could be tricky, if possible at all (outside of mark-ups with apparent delimiters, such as htmls, xmls, etc) in case of plain texts where URLs include whitespace(s).
Luckily, my use case doesn't imply such issues.
-
Offline
- Posts: 47
- Joined: Sat Jul 05, 2008 11:30 am
- Location: Odesa, Ukraine
Re: Scripts collection
xOleg,
Great script. The best AkelPad's calculator so far. Thank you.
When its first version rolled out, I had to change it a bit (four lines) to fit my needs.
Now it works that way just out of the box (now I change only two default variable values).
-
Offline
- Posts: 5
- Joined: Tue Nov 12, 2024 10:28 pm
Re: Scripts discussion (4)
Спасибо за отзыв. Давно хотел сделать что-то такое. Пользоваться стандартным калькулятором, как по мне, не сильно удобно, а MathCAD слишком громоздкий, чтобы его запускать, если нужно к трем прибавить два.