Scripts discussion (1)

Discuss and announce AkelPad plugins
Locked
  • Author
  • Message
Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

Добавлено: шаблоны в SearchReplace.js.

Added: templates to SearchReplace.js.

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

Post by FeyFre »

Instructor
Хорошо бы на окно где-то сбоку добавить мануальчик по регулярным выражениям(список ключей), а то бывает как приспичит что-то поискать, так и с головы вылетает синтаксис... Ну или путается с другими движками(перловский, пхп-шный, Microsoft-овский, другие не столь популярные, но используемые), попробуй уследи за ними...

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

Post by Infocatcher »

Instructor
Отлично!
А теперь самое время или навелосипедировать читалку ini-файлов, или встроить ее в плагин.

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

Post by FeyFre »

Infocatcher
Читалка(и даже писалка) есть встроенная в редактор см. AKD_INIOPEN(по моему я где-то это уже писал)

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

Post by Infocatcher »

FeyFre
Мне по-прежнему кажется, что должен быть простой интерфейс, чтобы в каждом скрипте не нужно было плодить функции-обертки (и чтобы не было зависимостей от скриптов-модулей).

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

Post by KDJ »

cnnnc wrote:2KDJ
FileInfo.js is very good. But when I change the pString into Chinese, the result of stats isn't align like before.
Because of Chinese Character is DoubleByteChar, it seem a Chinese-Char's width equal two latin's.
I suggest one more line of code for support that, like this:

Code: Select all

function Pad(pString, nLen, pType, pChar)
{
  nLen = nLen - pString.replace(/[\u0000-\u00ff]/g,"").length;
Thank you for your interest in the script. I'm glad it can be helpful.
I do not quite understand the problem. In European languages, some characters are encoded on two bytes. For example, Polish char Ą has a code 0x104, Russian characters have codes in the range 0x401 - 0x451. But in the editor are displayed as a single character.
Maybe the problem is in the font.
You should use a fixed-width font (monospace).
But I do not know if there are such a font for Chinese.
Courier New and Lucida Console, unfortunately, do not contain Chinese characters.
Search in the internet "monospace unicode".

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

Post by Infocatcher »

KDJ

Code: Select all

WScript.Echo("abc\n\uff41\uff42\uff43");

Arial Unicode MS: Image
Courier New: Image
Segoe UI (default UI font in Win 7): Image
Segoe UI in system dialog (all other – in AkelPad): Image

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

Post by KDJ »

Instructor
What happened is that the script FontIniSize.vbs is not working properly in AkelPad 4.5.2?
In version 4.5.1 works correctly.

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

Post by KDJ »

Infocatcher
Is the font Segoe UI is a fixed width? It looks as if it was not.

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

Post by Infocatcher »

KDJ wrote:Is the font Segoe UI is a fixed width? It looks as if it was not.
No, but I don't have fixed width font with full Unicode support. Just for example. :)

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Post by opk44 »

KDJ wrote:Instructor
What happened is that the script FontIniSize.vbs is not working properly in AkelPad 4.5.2?
In version 4.5.1 works correctly.
1) Looks like condition in "If ... End If" not working at all (always TRUE). So "WScript.Quit" is always run.
2) Maybe mistake in

Code: Select all

pIniFile    = (AkelPad.GetAkelDir & "\\AkelPad.ini")
(Two slashes instead of one)

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

Post by KDJ »

opk44 wrote:
KDJ wrote:Instructor
What happened is that the script FontIniSize.vbs is not working properly in AkelPad 4.5.2?
In version 4.5.1 works correctly.
1) Looks like condition in "If ... End If" not working at all (always TRUE). So "WScript.Quit" is always run.
2) Maybe mistake in

Code: Select all

pIniFile    = (AkelPad.GetAkelDir & "\\AkelPad.ini")
(Two slashes instead of one)
1) You're right.
If (hEditWnd = 0) Then
WScript.Quit
End If
Condition is always true.
Even if hEditWnd = 6845175. So 6845175 = 0.
It's probably a bug in AkelPad. This applies script in VBS. A similar script in the JS is working properly.

2) However, when it comes to a double slash "\\AkelPad.ini", it must be. To enter the slash in the string, you must precede the slash. So they must be two slashes.

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Post by opk44 »

KDJ wrote:2) However, when it comes to a double slash "\\AkelPad.ini", it must be. To enter the slash in the string, you must precede the slash. So they must be two slashes.
I'm not sure that in VBS "it must be". Take a look, please, at that short vbs-script for example:

Code: Select all

AkelPad.MessageBox 0, AkelPad.GetAkelDir & "\\AkelPad.ini", "Test_double_slash_messagebox", 64
AkelPad.MessageBox 0, AkelPad.GetAkelDir & "\AkelPad.ini", "Test_single_slash_messagebox", 64

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

Post by KDJ »

opk44
Thank you, you're right.
This is what I wrote applies to JS, but not to VBS.
I've already fixed the script, but it still does not work.

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

Post by KDJ »

Now I see that none of the VBS scripts do not work.
Runtime error is generated:
"Variable uses an Automation type not supported in VBScript".
This also applies to Test.vbs script.
Locked