Scripts discussion (3)

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

Post by KDJ »

TextMarker.js
Added:
- markers list,
- current marks list,
- find marks.

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

Post by Instructor »

KDJ
Great!

Few notes:
When I try to ignore text color or background color assigning 0, I get error "Incorrect background color code."

Code: Select all

    sTextColor = RGBToHex(lpMarkItem + (_X64 ? 44 : 28) /*offsetof(AEMARKTEXTITEMW,crText)*/);
    sBkColor   = RGBToHex(lpMarkItem + (_X64 ? 48 : 32) /*offsetof(AEMARKTEXTITEMW,crBk)*/);
crText and crBk could be -1 (see first note), but RGBToHex convert -1 to "#FFFFFF" (it should convert to 0 or "0").
Example:

Code: Select all

"Cyan" Call("Coder::HighLight", 2, 0, "#9BFFFF", 1, 0, 11)
When I mark selection with 0 in text color and try to find it with "Find up/down" button, script not found anything because it searches ["#FFFFFF", "#9BFFFF"] instead of [0, "#9BFFFF"].

Code: Select all

  if (nMarkID >= 1000001 /*MARKID_AUTOMIN*/)
    nMarkID = -1;

  AkelPad.Call("Coder::HighLight", 4, nMarkID, sTextColor, sBkColor, bUp);
When you know ID you can find mark directly by ID (and from Coder plugin v13.9 also marks with ID assigned automatically):

Code: Select all

  AkelPad.Call("Coder::HighLight", 4, nMarkID, 0, 0, bUp);
In "Current marks" tab unable to copy info from text fields. It could be useful making fields read-only instead of disabling them.

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

Post by KDJ »

Instructor
Thank you for your notes.
It seems to me that I fixed everything: TextMarker.js

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

Post by Instructor »

KDJ
All is OK, thanks.

Code: Select all

  SendMessage(aDlg[IDTCOLORE].HWND, 0x00CF /*EM_SETREADONLY*/, nTab, 0);
  SendMessage(aDlg[IDTCOLORE].HWND, 1091 /*EM_SETBKGNDCOLOR*/, !nTab, oSys.Call("user32::GetSysColor", 15 /*COLOR_BTNFACE*/));
  SendMessage(aDlg[IDBCOLORE].HWND, 0x00CF /*EM_SETREADONLY*/, nTab, 0);
  SendMessage(aDlg[IDBCOLORE].HWND, 1091 /*EM_SETBKGNDCOLOR*/, !nTab, oSys.Call("user32::GetSysColor", 15 /*COLOR_BTNFACE*/));
  SendMessage(aDlg[IDTEXTE].HWND,   0x00CF /*EM_SETREADONLY*/, nTab, 0);
  SendMessage(aDlg[IDTEXTE].HWND, 1091 /*EM_SETBKGNDCOLOR*/, !nTab, oSys.Call("user32::GetSysColor", 15 /*COLOR_BTNFACE*/));
?

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

Post by KDJ »

Instructor
Oh yes, so it looks better.

TextMarker.js
Changed: backgroud color in the read-only edit controls (in "Current marks" tab).

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

Post by Skif_off »


Фигасе, "небольшое GUI" попросил :))

KDJ
I just now took the new version and I'm impressed: I requested a small GUI, but now we have a great tool :)) Thanks again :)

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

Post by Instructor »

KDJ
In "Current marks" tab "Font style:" not changed if mark has non-zero font style.

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

Post by KDJ »

Instructor
Fixed: TextMarker.js

Offline
Posts: 670
Joined: Thu Jun 03, 2010 8:47 am
Location: Сочи, Хоста
Contact:

Post by Andrey_A_A »

Подскажите как с помощью скрипта TabSwitch.js

Code: Select all

-"Список вкладок" Call("Scripts::Main", 1, "TabSwitch.js", `-Next=-1 -CtrlTab=false -RightLeft=true -MinTabs=1 -WindowLeft=%bl -WindowTop=%bb -FontStyle=1`)
Отображать в менюшке только имена файлов (без полного пути)?

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

Post by Instructor »

Andrey_A_A
TabSwitch.js

Offline
Posts: 670
Joined: Thu Jun 03, 2010 8:47 am
Location: Сочи, Хоста
Contact:

Post by Andrey_A_A »

Instructor
Спасибо

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

Post by KDJ »

LineBoardBookmarks.js
Fixed: show menu on caret position.

Offline
Posts: 366
Joined: Mon Jan 10, 2011 5:28 pm
Contact:

Post by Lenchik »

KDJ
Can you please add to SortLines.js ability to take signs of set count not from beginning, but from end of line?
Не могли бы вы добавить возможность отсчета символов с конца строк?

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

Post by Skif_off »

KDJ
For the Russian language in LineBoardBookmarks.js not missing two lines:

Code: Select all

    sTxtShowPanel     = "Show panel";
    sTxtShowRuler     = "Show ruler";

Code: Select all

  else if (AkelPad.GetLangId(0 /*LANGID_FULL*/) == 1049 /*Russian*/)
  {
    sTxtInvalidArg    = "Неверный параметр: ";
    sTxtCut           = "Вырезать строки";
    sTxtCopy          = "Копировать строки";
    sTxtOpenInTab     = "Открыть в новой вкладке";
    sTxtPasteTo       = "Вставить в (переписать) строки";
    sTxtReplace       = "Заменить строки";
    sTxtDelete        = "Удалить строки";
    sTxtSelection     = "Выделенные строки";
    sTxtBookmarkLines = "Снабдить строки закладками";
    sTxtUnmarkLines   = "Убрать закладки";
    sTxtInverseBooks  = "Инвертировать закладки";
    sTxtGoTo          = "Перейти к";
    sTxtNext          = "Следующая";
    sTxtPrevious      = "Предыдущая";
    sTxtShowPanel     = "Показать панель";
    sTxtShowRuler     = "Показать линейку";
    sTxtLBSettings    = "Настройки плагина LineBoard...";
    sTxtBookLinesAll  = "С закладками";
    sTxtUnLinesAll    = "Без закладок";
    sTxtBookLinesSel  = "С закладками в выделенном";
    sTxtUnLinesSel    = "Без закладок в выделенном";
    sTxtExpand        = "Расширить к ближайшей закладке";
    sTxtExpandTop     = "Расширить вверх к предыдущей закладке";
    sTxtExpandBottom  = "Расширить вниз к следующей закладке";
    sTxtReduce        = "Уменьшить к ближайшей закладке";
    sTxtReduceTop     = "Уменьшить сверху к следующей закладке";
    sTxtReduceBottom  = "Уменьшить снизу к предыдущей закладке";
    sTxtAll           = "Все";
    sTxtInSel         = "В выделенном";
    sTxtReplaceWith   = "заменить на:";
  }




В параллельной теме есть проблема со скриптом сохранения/восстановления закладок BookmarksPlus.vbs от Andrey_A_A: после сохранения закладок файл с этими самыми закладками открывается в новой вкладке, так понимаю, дело в функции

Code: Select all

Function SaveTextFile(File,xText)
  If InStr(File, "%") > 0 Then File = GetPath(File)
  With CreateObject("Scripting.FileSystemObject")
    If .FileExists(File) Then .DeleteFile File
  End With
  With AkelPad
    MainWnd = .GetMainWnd()
    Call SetRedraw(MainWnd, False)
    Call .SendMessage(.GetMainWnd(), 273, 4101, 0)
    Call .ReplaceSel(xText)
    Call .SaveFile(0, File, 65001, 1, 1)
    Call SetRedraw(MainWnd, True)
    Call .SendMessage(.GetMainWnd(), 273, 4104, 0)
  End With
End Function

Не совсем понимаю, что происходит: если файл есть, то при сохранении закладок он удаляется и создается новый? Т.е. нельзя без открытия файла в окне AkelPad грохнуть его содержимое и записать содержимое переменной? И остается только заменить

Code: Select all

    Call .SendMessage(.GetMainWnd(), 273, 4104, 0)
  на
    Call .SendMessage(.GetMainWnd(), 273, 4324, 0)
чтобы его закрыть?

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

Post by KDJ »

Lenchik wrote:KDJ
Can you please add to SortLines.js ability to take signs of set count not from beginning, but from end of line?
Не могли бы вы добавить возможность отсчета символов с конца строк?
I don't understand your request. Can you describe it in more detail. Give an example of how it should work.
Locked