Page 58 of 74

Posted: Wed Dec 17, 2014 8:18 pm
by VladSh
Instructor
Scripts-Rus.txt wrote:AkelPad.IsPluginRunning
_______________________
...
Пример:
var bRunning=AkelPad.IsPluginRunning("HighLight::Main");
Надо бы Coder::HighLight.

Posted: Thu Dec 18, 2014 6:23 am
by Instructor
KDJ wrote:
Instructor wrote:Changed: message loop not necessary for subclassing.
Scripts-Eng.txt wrote:AkelPad.WindowSubClass (+ActiveX)
...
Example:
...
//Message loop
AkelPad.WindowGetMessage();
Maybe this should be removed from the example.
In this example it is necessary. OpenSaveMask.js uses WindowSubClass without WindowGetMessage.

VladSh
Поправлено.

Posted: Fri Dec 19, 2014 6:18 pm
by KDJ
Instructor
In Scripts plugin dialog would be useful a hotkey (accelerator) to script edit (eg. Alt+E).

Posted: Sun Dec 21, 2014 12:34 pm
by KDJ
Instructor
It seems to me that in x64 version, AkelPad.SetEditWnd method works incorrectly.

Posted: Tue Dec 23, 2014 5:13 pm
by Andrey_A_A
Подскажите почему код (vbs)

Code: Select all

On Error Resume Next
Folder = CreateObject("Shell.Application").BrowseForFolder(0, "Выбор папки", 0, "").Self.Path
If Err.Number <> 0 Then WScript.Quit
MsgBox "Переменная Folder =" & vbNewLine & "<" & Folder & ">"
если запустить не в AkelPad, то работает, т.е если отменяешь выбор папки, то происходит выход WScript.Quit

Если запускать этот код в AkelPad, то Err.Number не срабатывает
пробовал по разному

Code: Select all

If Err.Number <> 0 Or Len(Folder) = 0 Or Folder=vbNullChar Or Folder = "" Then WScript.Quit
не происходит выхода... раньше работало

Posted: Tue Dec 23, 2014 10:28 pm
by Andrey_A_A
Ещё одно: Если в конце пути каталога есть слеш \ , то функция GetFilePath не выдаёт родительский путь.

Code: Select all

pFile = "D:\TC IMAGE\AkelFiles\Plugs\Scripts\Include\"

Path = AkelPad.GetFilePath(pFile, 1)
MsgBox "Переменная Path =" & vbNewLine & "<" & Path & ">"

Path = CreateObject("Scripting.FileSystemObject").GetParentFolderName(pFile) ' родительский путь
MsgBox "Переменная Path =" & vbNewLine & "<" & Path & ">"

Posted: Wed Dec 24, 2014 2:55 pm
by Instructor
KDJ wrote:It seems to me that in x64 version, AkelPad.SetEditWnd method works incorrectly.
Not reproduced. Any example code?
Andrey_A_A wrote:Подскажите почему код (vbs)

Code: Select all

On Error Resume Next
...
При наличии данной строки WScript.Quit игнорируется, т.к. сейчас WScript.Quit это послание серверу сценариев специального кода возврата SCRIPT_E_PROPAGATE, который говорит серверу выйти минуя OnScriptError. Однако строка "On Error Resume Next" блокирует выход. В новой версии плагина эта ситуация учтена.
Andrey_A_A wrote:Ещё одно: Если в конце пути каталога есть слеш \ , то функция GetFilePath не выдаёт родительский путь.
Scripts-Rus.txt wrote:AkelPad.GetFilePath (+ActiveX)
______________________________

Получить часть пути файла.
CPF_DIR для "D:\TC IMAGE\AkelFiles\Plugs\Scripts\Include" корректно выдаёт "D:\TC IMAGE\AkelFiles\Plugs\Scripts\Include".

Posted: Wed Dec 24, 2014 11:24 pm
by KDJ
Instructor wrote:
KDJ wrote:It seems to me that in x64 version, AkelPad.SetEditWnd method works incorrectly.
Not reproduced. Any example code?
Examples are in the scripts TextMarker.js and RunCommand.js, functions GetTextAE() and ReplaceTextAE().
TextMarker.js generates sometimes an error reported by Skif_off here: viewtopic.php?p=27149#p27149
If you run RunCommand.js, next press "CMD ?" button and choose command from the list, it replaces all text in AkelPad edit window instead of in edit window of the script.

Posted: Sat Dec 27, 2014 1:31 pm
by Infocatcher
Если скрыть дополнительные столбцы в списке скриптов, пункт «Открыть сайт» в контекстном меню остается, но заблокирован.

И еще с дополнительными столбцами притормаживает при первом открытии. :?
Тут бы или кэширование какое, или сперва список показать, а уже потом в отдельном потоке тянуть дополнительные данные из файлов.

Posted: Sat Dec 27, 2014 4:58 pm
by Instructor
KDJ
Not reproduced, but guess I now what happens.

In currently developed Scripts plugin 6.0 implemented support for __int64 values (JScript and VBScript don't have native support for 8-byte integers). Scripts uses the next algorithm: if number larger then 0xFFFFFFFF, number converted to string and first character in this string is NULL. For example, 123 -> "\x00123". Therefore incrementing pointer must be done with _PtrAdd (see example scripts in current development version).

I have uploaded two versions. First to debug your scripts. It will convert number to string if number larger then 0xFFFF (it is almost any pointer). When scripts after editing starts running without errors/crashes, you can try current development version.

Posted: Sat Dec 27, 2014 9:16 pm
by KDJ
Instructor
Unfortunately, this did not help. I think there is an error in SetEditWnd method.

Try simple test script:

Code: Select all

var oSys     = AkelPad.SystemFunction();
var hMainWnd = AkelPad.GetMainWnd();
var hInstDLL = AkelPad.GetInstanceDll();
var sClass   = "AkelPad::Scripts::" + WScript.ScriptName + "::" + hInstDLL;
var hMyEdit;
var hButton;

AkelPad.WindowRegisterClass(sClass);
oSys.Call("user32::CreateWindowExW",
          0,                 //dwExStyle
          sClass,            //lpClassName
          "SetEditWnd test", //lpWindowName
          0x90CA0000,        //dwStyle=WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
          300,               //x
          200,               //y
          320,               //nWidth
          200,               //nHeight
          hMainWnd,          //hWndParent
          0,                 //hMenu/ID
          hInstDLL,          //hInstance
          DialogCallback);   //lpParam

AkelPad.WindowGetMessage();
AkelPad.WindowUnregisterClass(sClass);

function DialogCallback(hWnd, uMsg, wParam, lParam)
{
  if (uMsg == 1 /*WM_CREATE*/)
  {
    hMyEdit = oSys.Call("user32::CreateWindowExW",
      0,           //dwExStyle
      "AkelEditW", //lpClassName
      0,           //lpWindowName
      0x50B10004,  //dwStyle=WS_CHILD|WS_VISIBLE|WS_BORDER|WS_VSCROLL|WS_HSCROLL|WS_TABSTOP|ES_MULTILINE
      10,          //x
      10,          //y
      300,         //nWidth
      100,         //nHeight
      hWnd,        //hWndParent
      0,           //hMenu/ID
      hInstDLL,    //hInstance
      0);          //lpParam
    hButton = oSys.Call("user32::CreateWindowExW",
      0,          //dwExStyle
      "BUTTON",   //lpClassName
      0,          //lpWindowName
      0x50010000, //dwStyle=WS_CHILD|WS_VISIBLE|WS_TABSTOP
      10 ,        //x
      130,        //y
      300,        //nWidth
      25,         //nHeight
      hWnd,       //hWndParent
      0,          //hMenu/ID
      hInstDLL,   //hInstance
      0);         //lpParam

    oSys.Call("User32::SetWindowTextW", hMyEdit, "my edit window");
    oSys.Call("User32::SetWindowTextW", hButton, "Add 'Test' in my edit window");
  }

  else if (uMsg == 7 /*WM_SETFOCUS*/)
    oSys.Call("user32::SetFocus", hMyEdit);

  else if (uMsg == 256 /*WM_KEYDOWN*/)
  {
    if (wParam == 27 /*VK_ESCAPE*/)
      oSys.Call("user32::PostMessageW", hWnd, 16 /*WM_CLOSE*/, 0, 0);
  }

  else if (uMsg == 273 /*WM_COMMAND*/)
  {
    if (lParam == hButton)
      AddTextAE(hMyEdit, " Test");
  }

  else if (uMsg == 16 /*WM_CLOSE*/)
    oSys.Call("user32::DestroyWindow", hWnd);

  else if (uMsg == 2 /*WM_DESTROY*/)
    oSys.Call("user32::PostQuitMessage", 0);

  return 0;
}

function AddTextAE(hWnd, sText)
{
  AkelPad.SetEditWnd(hWnd);
  AkelPad.SetSel(-1, -1);
  AkelPad.ReplaceSel(sText);
  AkelPad.SetEditWnd(0);
}


This script works correctly in the following configurations:
- AkelPad 4.9.0 x86, WinXP x86,
- AkelPad 4.9.1 x86, WinXP x86,
- AkelPad 4.9.0 x86, Win7 x64,
- AkelPad 4.9.1 x86, Win7 x64,
- AkelPad 4.9.0 x64, Win7 x64.
Does not work correctly in:
- AkelPad 4.9.1 x64, Win7 x64 (text is added in AkelPad edit window instead of "my edit window").

Posted: Sun Dec 28, 2014 6:59 pm
by KDJ
Instructor
Furthermore I noticed that IsAkelEdit method returns an incorrect value (Scripts v.15.9 and 16.0 x64).
For my window created as "AkelEditW" (hMyEdit):
AkelPad.IsAkelEdit(hMyEdit) -> 0.
For AkelPad edit window also:
AkelPad.IsAkelEdit(AkelPad.GetEditWnd()) -> 0.
This can be a cause that SetEditWnd method not working properly.
In Scripts v15.8 x64 everything worked fine.

Posted: Sun Dec 28, 2014 7:20 pm
by Instructor
KDJ wrote:For my window created as "AkelEditW" (hMyEdit):
AkelPad.IsAkelEdit(hMyEdit) -> 0.
Not tested, but I think this is it.

Posted: Sun Dec 28, 2014 7:36 pm
by KDJ
Instructor
To test, is needed 64-bit version.

Posted: Sun Dec 28, 2014 7:39 pm
by Instructor
KDJ
x64