?
В стандартном окне замены есть кнопка "Найти далее" и "Заменить" - для пошаговой замены (т.е. для неё необходимо ещё действие/функция), а также кнопка "Заменить всё".
var hEditWnd= AkelPad.GetEditWnd();
var v=AkelPad.TextReplace(hEditWnd, "sio", "123", 0x00000001, false);
if (v > -1)
AkelPad.TextReplace(hEditWnd, "sio", "123", 0x00400001, false);
А ещё есть такой скрипт "AkelPadMethodsView.js" от KDJ, очень полезная штука.
Posted: Mon Dec 28, 2015 8:19 pm
by KDJ
The effect of TextReplace() with bAll==false, depends on whether matching text is selected in edit window.
1. If matching text is selected, TextReplace() replaces it and searches for the next occurrence,
- if the next was found, it will be selected and TextReplace() returns position of this next match,
- else -1 is returned.
2. If matching text isn't selected, TextReplace() don't replace, only searches for the next occurrence (so it works as TextFind()),
- if the next was found, it will be selected and TextReplace() returns position of this next match,
- else -1 is returned.
Posted: Mon Dec 28, 2015 8:55 pm
by yozhic
KDJ
Спасибо, это даже на несколько миллисекунд быстрее, чем
YuS
Дык, как же без AkelPadMethodsView.js. Пользуюсь со дня публикации. Я в описании «bAll false одна замена.» немного неразобрался. Читаю «замена», значит должон заменять, а он не заменяет.
т.е. для неё необходимо ещё действие/функция
Вот эта мысль у меня смутно брезжила, но не был уверен. Теперь всё ясно, спасибо.
Posted: Wed Dec 30, 2015 3:34 am
by beotiger
KDJ wrote:The effect of TextReplace() with bAll==false, depends on whether matching text is selected in edit window.
...
KDJ! May be it should be added to AkelPadMethodsView.js, for there is no informationa of such behaviour of TextReplace with bAll == false and I got same misuse as previous authors did.
Posted: Wed Dec 30, 2015 5:43 am
by YuS
beotiger, этот скрипт в удобной форме показывает разделы содержимого файлов Script-Eng.txt/Script-Rus.txt.
В общем, это надо к Instructor-у обращаться, чтобы дополнить описание (наверное, лучше с готовыми вариантами), либо локально файл корректировать...
Posted: Thu Jan 21, 2016 6:49 pm
by KDJ
Instructor
When I try to close any modified document (from the script), then displays message box "Document was modified. Do you want to save it?" and AkelPad hangs. On Win-XP sometimes, and on Win-7 always.
Try this test:
If hWndOwner = hMainWnd - AkelPad hangs, and if hWndOwner = 0 - works properly.
Is this a bug in the script or in AkelPad?
Posted: Sat Jan 23, 2016 2:26 pm
by KDJ
Instructor
Could you add optional parameter bAll for AkelPad.TextFind:
AkelPad.TextFind(hHandle, pFindIt, nFlags, bAll);
Return Value
- if bAll is true, the return value is count of occurences.
Posted: Sat Jan 30, 2016 10:10 am
by Kley
Instructor
Пытаюсь создать, с помощью функции AkelPad.CreateDialog(), диалог с главным меню. Не получается. AkelPad постоянно вылетает.
var hMainMenu = CreateMainMenu();
...
//dwStyle=DS_SETFONT|WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_SIZEBOX|WS_MINIMIZEBOX|WS_MAXIMIZEBOX
...
AkelPad.CreateDialog(...)
В качестве эксперимента попробовал код отсюда (второй пример). Тот же результат.
Хотя так: "oSys.Call("user32::CreateWindowEx"...", все работает прекрасно.
Выложу полный код скрипта и попрошу помощи (наверное), только если у Вас ошибка не воспроизведется
Posted: Sun Feb 21, 2016 5:04 pm
by Instructor
Kley
Выложите минимальный код для воспроизведения ошибки.