Scripts discussion (2)

Discuss and announce AkelPad plugins
Locked
  • Author
  • Message
Offline
Posts: 88
Joined: Sun Jun 03, 2012 8:15 am

Post by Visitor7 »

opk44 wrote:Зачем же так безапелляционно...parseInt('1111100111',2)
Я говорил об "опознавании" двоичных чисел, а не "принудительном указании".
opk44 wrote:префиксы позволяют обойтись без второго параметра, лишь для трех оснований: 8, 10 и 16.
Вроде как да, но...

Code: Select all

var string = "011";
Math.floor(string); //11
parseInt(string); //9
+string; // 11
а...
var string = "0xF";
Math.floor(string); //15
parseInt(string); //15
+string; // 15

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

Post by Instructor »

KDJ wrote:I noticed strange behavior. After executing following script, CodeFold disappears...
Fixed. Will be available after 4.7.7 release.
Andrey_A_A wrote:

Code: Select all

If AkelPad.SaveFile(0, File) < 0 Then Call AkelPad.SaveFile(0, File, 65001, 1)
всё равно вылетает окно. Может есть метод, чтобы этого избежать?
См. AKD_SETCMDLINEOPTIONS + CLO_MSGSAVELOSTSYMBOLSNO.

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

Post by Andrey_A_A »

См. AKD_SETCMDLINEOPTIONS + CLO_MSGSAVELOSTSYMBOLSNO.
К сожалению я не так всё это хорошо знаю, мне бы конкретный пример...

Offline
Posts: 88
Joined: Sun Jun 03, 2012 8:15 am

Post by Visitor7 »

Andrey_A_A AkelDLL.h и AkelEdit.h - довольно мощный справочник с примерами. Не всегда полными и сразу понятными, но в данном случае все явно.

Code: Select all

//Command line
#define AKD_GETCMDLINEOPTIONS      (WM_USER + 121)
#define AKD_SETCMDLINEOPTIONS      (WM_USER + 122) = 1146
#define AKD_PARSECMDLINEW          (WM_USER + 125)
.........
//Command line options
#define CLO_MSGSAVELOSTSYMBOLSYES 0x40  //Silently save file, even if symbols will be lost.
#define CLO_MSGSAVELOSTSYMBOLSNO  0x80  //Don't save file, if symbols will be lost.
.........
AKD_SETCMDLINEOPTIONS
_____________________

Set command line options.

(DWORD)wParam == see CLO_* defines.
lParam        == not used.

Return Value
 Zero.

Example:
 SendMessage(pd->hMainWnd, AKD_SETCMDLINEOPTIONS, CLO_MSGOPENCREATENO|CLO_MSGOPENBINARYNO, 0);

Вроде как для сохранения без предупреждения о потере символов:
AkelPad.SendMessage(hMainWnd, 1146 /*AKD_SETCMDLINEOPTIONS*/, 64 /*CLO_MSGSAVELOSTSYMBOLSYES*/, 0);
А молча не сохранять если символы теряются:
AkelPad.SendMessage(hMainWnd, 1146 /*AKD_SETCMDLINEOPTIONS*/, 128 /*CLO_MSGSAVELOSTSYMBOLSNO*/, 0);

Code: Select all

var saveValue = AkelPad.SendMessage(hMainWnd, 1145 /*AKD_GETCMDLINEOPTIONS*/, 0, 0); //сохранить
AkelPad.SendMessage(hMainWnd, 1146 /*AKD_SETCMDLINEOPTIONS*/, (saveValue|64 /*CLO_State|CLO_MSGSAVELOSTSYMBOLSYES*/), 0); //добавить флаг "не спрашивать о потере, сохранять молча"
...
AkelPad.SendMessage(hMainWnd, 1146 /*AKD_SETCMDLINEOPTIONS*/, saveValue, 0); //восстановить

или

AkelPad.SendMessage(hMainWnd, 1146 /*AKD_SETCMDLINEOPTIONS*/, (AkelPad.SendMessage(hMainWnd, 1145 /*AKD_GETCMDLINEOPTIONS*/, 0, 0)|64), 0);
...
AkelPad.SendMessage(hMainWnd, 1146 /*AKD_SETCMDLINEOPTIONS*/, (AkelPad.SendMessage(hMainWnd, 1145 /*AKD_GETCMDLINEOPTIONS*/, 0, 0)&(~64)), 0);

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

Post by KDJ »

MapNetDrive.js

Changed:
In AkelPad window allows other scripts running.
Scripts icon on dialog header (if running from command line).

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

Post by KDJ »

In the following script does not work SetEditWnd() method.
Why is this happening?

Code: Select all

if (AkelPad.IsMDI())
{
  //To eliminate conflict with Templates plugin: lParam=1
  AkelPad.SendMessage(AkelPad.GetMainWnd(), 273 /*WM_COMMAND*/, 4101 /*IDM_FILE_NEW*/, 1);
  var hWndEdit1 = AkelPad.GetEditWnd();

  AkelPad.SendMessage(AkelPad.GetMainWnd(), 273 /*WM_COMMAND*/, 4101 /*IDM_FILE_NEW*/, 1);
  var hWndEdit2 = AkelPad.GetEditWnd();

  AkelPad.SetEditWnd(hWndEdit1);
  WScript.Echo("hWndEdit1:   " + hWndEdit1 + "\n" + "hWndEdit2:   " + hWndEdit2 + "\n" + "GetEditWnd: " + AkelPad.GetEditWnd());
}

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

Post by Instructor »

KDJ
PMDI has only one edit window handle.

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

Post by KDJ »

Instructor
I have done this in MDI mode, not PMDI.

Result:
hWndEdit1: 196648
hWndEdit2: 2163364
GetEditWnd: 2163364

Should be:
GetEditWnd: 196648

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

Post by Instructor »

KDJ
Scripts-Eng.txt wrote:AkelPad.SetEditWnd
...
hHandle
Edit window handle. If zero or hHandle is not AkelEdit/RichEdit20 window or hHandle is standard edit window, then handles management is taken by program and zero is returned.

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

Post by KDJ »

Thanks, Instructor. I have not read this before.


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

Post by Infocatcher »

jsBeautifier-test.js (mirror)
Fixed "Already updated" detection.
Used "updated" date from https://github.com/einars/js-beautify/c ... aster.atom.

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

Post by KDJ »

ScreenView.js

Uptade for LineBoard plugin v9.2
Fixed: external call with code 1.

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

Post by KDJ »

FileInfo.js
Added:
- Vertical Tab and Form Feed chars,
- statistics of chars with code 1-32 (details),
- hex code of chars (details),
- lines terminated by whitespaces,
- empty lines with whitespaces (details),
- detect bad NewLine format,
- second argument, which reduces the amount of displayed information (chars, words, lines - "CWL").
Fixed:
- work in Word Wrap mode,
- Carriage Return and Line Feed are counted exactly.

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

Post by Andrey_A_A »

Подскажите такую вещь.
Я вставляю текст методом AkelPad.ReplaceSel("MyText")
но мне надо, чтобы документ не перепрыгивал вправо, а оставался на месте вместе с курсором.
Для себя я сделал один вариант, но документ "дёргается", может кто предложит вариант без моргания
Locked