Исправлено: остановка при ошибке и метод WScript.Quit в Windows 11 24H2 (jscript9Legacy.dll).
Fixed: stopping on error and WScript.Quit method in Windows 11 24H2 (jscript9Legacy.dll).
Scripts plugin v19.2
Scripts plugin
- Author
- Message
-
Offline
- Site Admin
- Posts: 6430
- Joined: Thu Jul 06, 2006 7:20 am
Re: Scripts plugin
Исправлено: обходное решение для jscript9Legacy.dll, который игнорирует одиночный AddRef для объекта IDispatch в методе oSys.RegisterCallback.
Fixed: workaround for jscript9Legacy.dll that ignore single AddRef for IDispatch object in oSys.RegisterCallback method.
Scripts plugin v19.3
Fixed: workaround for jscript9Legacy.dll that ignore single AddRef for IDispatch object in oSys.RegisterCallback method.
Scripts plugin v19.3
-
Offline
- Posts: 3248
- Joined: Wed Nov 29, 2006 1:19 pm
- Location: Киев, Русь
- Contact:
Re: Scripts plugin
Instructor
Скрипт чтения настроек скрипта
даёт ошибку в случае отсутствия ini-файла для скрипта (проверял на Win11):
Думаю, нужно обработчик добавить на отсутствие файла, и возвращать значение по умолчанию в случае его отсутствия.
Скрипт чтения настроек скрипта
Code: Select all
var oSet = AkelPad.ScriptSettings();
oSet.Begin(WScript.ScriptBaseName, 0x1 /*POB_READ*/);
var value = oSet.Read("param", 3 /*PO_STRING*/, "defaultString");
AkelPad.MessageBox(AkelPad.GetMainWnd(), value, WScript.ScriptName, 0 /*MB_OK*/);
oSet.End();Если добавить пустой файл, то работает норм.---------------------------
Scripts plugin
---------------------------
Script: C:\Portable\AkelPad\AkelFiles\Plugs\Scripts\test.js
Line: 3
Symbol: 1
Error: Недостаточно памяти
Code: 800A0007
Source: Ошибка выполнения JavaScript
---------------------------
Да Нет
---------------------------
Думаю, нужно обработчик добавить на отсутствие файла, и возвращать значение по умолчанию в случае его отсутствия.
-
Offline
- Posts: 1881
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
Re: Scripts plugin
Так, вроде, так и задумано, в примере делается проверка возвращаемого oSet.Begin() значения:VladSh wrote: ↑Thu Nov 20, 2025 10:43 am Скрипт чтения настроек скриптадаёт ошибку в случае отсутствия ini-файла для скриптаCode: Select all
var oSet = AkelPad.ScriptSettings(); oSet.Begin(WScript.ScriptBaseName, 0x1 /*POB_READ*/); var value = oSet.Read("param", 3 /*PO_STRING*/, "defaultString"); AkelPad.MessageBox(AkelPad.GetMainWnd(), value, WScript.ScriptName, 0 /*MB_OK*/); oSet.End();
Code: Select all
Пример (прочитать настройки скрипта):
var oSet=AkelPad.ScriptSettings();
if (oSet.Begin("", 0x1 /*POB_READ*/))
{
pString=oSet.Read("String", 3 /*PO_STRING*/);
bMultiline=oSet.Read("Multiline", 1 /*PO_DWORD*/);
oSet.End();
}-
Offline
- Posts: 3248
- Joined: Wed Nov 29, 2006 1:19 pm
- Location: Киев, Русь
- Contact:
Re: Scripts plugin
Infocatcher
Ясно.
Ясно.
-
Offline
- Posts: 3248
- Joined: Wed Nov 29, 2006 1:19 pm
- Location: Киев, Русь
- Contact:
Re: Scripts plugin
Instructor
El Sanchez написал:
El Sanchez написал:
ошибка в коде AkelPad здесь.
При nDataSize = 0, второй параметр SysAllocStringLen будет равен -1, но у функции тип этого параметра беззнаковый, и (UINT)-1 = 0xFFFFFFFF = 4294967295 байт.
-
Offline
- Site Admin
- Posts: 6430
- Joined: Thu Jul 06, 2006 7:20 am
Re: Scripts plugin
VladSh
См. Scripts v19.5
См. Scripts v19.5
-
Offline
- Site Admin
- Posts: 6430
- Joined: Thu Jul 06, 2006 7:20 am
Re: Scripts plugin
Исправлено: AkelPad.ScriptSettings().Read ошибка выделения памяти при попытке чтения пустого дескриптора.
Fixed: AkelPad.ScriptSettings().Read memory allocation error when trying to read empty handle.
Scripts plugin v19.5
Fixed: AkelPad.ScriptSettings().Read memory allocation error when trying to read empty handle.
Scripts plugin v19.5
-
Offline
- Posts: 64
- Joined: Sat Jul 05, 2008 11:30 am
- Location: Odesa, Ukraine
Re: Scripts plugin
It is well known and documented how to run user scripts from the "AkelPad\AkelFiles\Plugs\Scripts" directory.
Then, is there a way (and how) to execute a user script that is designed for and currently being edited in the AkelPad, but located in an arbitrary place outside of AkelPad's dedicated tree?
It would be pretty useful to have such an option for testing, but I couldn't figure out how to do that.
For instance, I have tried "run currently edited.js" Call("Scripts::Main",1,"%f") ContextMenu command, but it adds "AkelPad\AkelFiles\Plugs\Scripts" to %f and fails.
The RunMe.js by DV looked very promising with a call like this: "runMe currently edited.js" Call("Scripts::Main", 1, "RunMe.js", "%f")
Unfortunately, it turned out, in its vanilla form, RunMe.js runs only the simplest scripts (those I can launch just from the Windows Explorer as well) and fails to execute more complex scripts (e.g., containing any of the AkelPad.* AkelPad's window related methods), and I couldn't elaborate on how to customize it for that task (if it's even possible).
So, essentially, how to run from AkelPad an AkelPad's user script that is currently being edited in AkelPad, with full support of AkelPad's functions/methods, as if it is located in "AkelPad\AkelFiles\Plugs\Scripts", even though it is located elsewhere?
Then, is there a way (and how) to execute a user script that is designed for and currently being edited in the AkelPad, but located in an arbitrary place outside of AkelPad's dedicated tree?
It would be pretty useful to have such an option for testing, but I couldn't figure out how to do that.
For instance, I have tried "run currently edited.js" Call("Scripts::Main",1,"%f") ContextMenu command, but it adds "AkelPad\AkelFiles\Plugs\Scripts" to %f and fails.
The RunMe.js by DV looked very promising with a call like this: "runMe currently edited.js" Call("Scripts::Main", 1, "RunMe.js", "%f")
Unfortunately, it turned out, in its vanilla form, RunMe.js runs only the simplest scripts (those I can launch just from the Windows Explorer as well) and fails to execute more complex scripts (e.g., containing any of the AkelPad.* AkelPad's window related methods), and I couldn't elaborate on how to customize it for that task (if it's even possible).
So, essentially, how to run from AkelPad an AkelPad's user script that is currently being edited in AkelPad, with full support of AkelPad's functions/methods, as if it is located in "AkelPad\AkelFiles\Plugs\Scripts", even though it is located elsewhere?