Scripts plugin

Discuss and announce AkelPad plugins
  • Author
  • Message
Offline
Posts: 2248
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

KDJ
Find for description of message edit window message AEM_GETSEL in AkelEdit.h in source of AkelPad.

Offline
Site Admin
Posts: 6403
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

VladSh wrote:5. TextFind...
Все работает.

Offline
Site Admin
Posts: 6403
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

Добавлено: метод GetTextRange() для получения заданного диапазона текста.
Добавлено: в методе SaveFile() теперь кодировка и BOM являются не обязательными параметрами.
Добавлено: тип DT_BYTE для методов MemCopy и MemRead, а также тип DT_WORD теперь равен 4.

Added: method GetTextRange() for retrieving a specified range of text.
Added: in method SaveFile() now encoding and BOM are not required parameters.
Added: type DT_BYTE for methods MemCopy and MemRead, and also the type DT_WORD now equal to 4.


Scripts plugin v6.5

Offline
Posts: 3234
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

Instructor wrote:
VladSh wrote:5. TextFind...
Все работает.
У меня здесь не работало.

Код изначально был такой:

Code: Select all

AkelPad.TextFind(AkelPad.GetEditWnd(), pSearchText, 0x00200000 /*FR_DOWN|FR_BEGINNING*/);

for (var n = nCycles - 1; n > 0; n--)
{
   AkelPad.TextFind(AkelPad.GetEditWnd(), pSearchText, 0x00000001 /*FR_DOWN*/);
}
Баг видно, когда файл с докой не открываешь, а вызываешь доку (этот же скрипт) повторно несколько раз - начинает искать не то вхождение. Потому и пришлось отказаться от такого способа в пользу AkelPad.SetSel(0, 0); перед каждым поиском.

Instructor wrote:Scripts plugin v6.5
Здорово! Теперь и FeyFre поднимет настроение :wink:

Offline
Site Admin
Posts: 6403
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

VladSh
0x00200000 != /*FR_DOWN|FR_BEGINNING*/
0x00200001 == /*FR_DOWN|FR_BEGINNING*/

Offline
Posts: 3234
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

Instructor
Я это из Scripts-Rus.txt скопировал.
Теперь понятно...

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

Post by KDJ »

FeyFre wrote:Find for description of message edit window message AEM_GETSEL in AkelEdit.h.
There is written:
#Define AEM_GETSEL (WM_USER + 2101).
I do not know what value is AEM_GETSEL and WM_USER.
Can I use the function:
SendMessage(hWndEdit, AEM_GETSEL, WPARAM, LPARAM)?
What value should have the arguments:
AEM_GETSEL, WPARAM, LPARAM?

Offline
Posts: 2248
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

KDJ
1. Read carefully, and you will find sample snippets.
2. If there something you cannot find or understand first of all you should read official WINAPI documentation from Microsoft(start here http://msdn.microsoft.com/en-us/library ... S.85).aspx)

Offline
Site Admin
Posts: 6403
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ wrote:I have a question, maybe someone knows how to do it.
How to read, and then set the vertical selection?
Give a concrete example.

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

Post by KDJ »

FeyFre wrote:1. Read carefully, and you will find sample snippets.
2. If there something you cannot find or understand first of all you should read official WINAPI documentation from Microsoft...
This is reading for professionals. I am a novice amateur.
In the AkelPad source files I not found WM_USER declaration.
My guess is, that it is 0x400, which is equal 1024.
If "# Define AEM_GETSEL (WM_USER + 2101)", does it mean that AEM_GETSEL==3125 ?
But still I do not know, what the value of WPARAM, LPARAM use.

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

Post by KDJ »

Instructor wrote:
KDJ wrote:I have a question, maybe someone knows how to do it.
How to read, and then set the vertical selection?
Give a concrete example.
Is the selected text vertically, eg. 3 columns, 6 rows.
I need select another piece of text, with the same size - 3x6 (not copy).

Image

When the selection is normal (not verticaly), it can be done like this (shift selection of 100 characters):
var nMinSel = AkelPad.GetSelStart() + 100;
var nMaxSel = AkelPad.GetSelEnd() + 100;
AkelPad.SetSel(nMinSel, nMaxSel);

How to do it in the script:
1. Check whether the selection is normal or vertical.
2. Select a different text vertically with the same size (3x6) - shifted on 100 characters or 8 columns to the right and 3 rows below.

The problem occurs for example in the script textStatistics.js (written by Infocatcher) which does not restore vertical selection.

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

Post by Infocatcher »

KDJ wrote:script textStatistics.js (written by Infocatcher)
Oh, I forgot about unused copyResult variable (Ctrl+C works fine for results dialog). Script updated.

Offline
Posts: 3234
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

Infocatcher, это ссылка на обновлённый скрипт? Я смотрю, что номер версии и дата не изменились...

Offline
Site Admin
Posts: 6403
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ
Here is simple way to do this:

Code: Select all

var hWndEdit=AkelPad.GetEditWnd();
var nSelStart;
var nSelEnd;

if (AkelPad.SendMessage(hWndEdit, 3127 /*AEM_GETCOLUMNSEL*/, 0, 0))
{
  nSelStart=AkelPad.GetSelStart();
  nSelEnd=AkelPad.GetSelEnd();
  AkelPad.SetSel(nSelStart + 1, nSelEnd + 1);
  AkelPad.SendMessage(hWndEdit, 3128 /*AEM_UPDATESEL*/, 0x1 /*AESELT_COLUMNON*/, 0);
}

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

Post by Infocatcher »

VladSh wrote:Infocatcher, это ссылка на обновлённый скрипт? Я смотрю, что номер версии и дата не изменились...
Так и код не изменился – я убрал фрагмент, который не использовался.
Post Reply