Scripts plugin
- Author
- Message
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
Instructor
I have a script that uses AkelEdit control.
When I run this script from command line (as ActiveX), the following metods are available:
AkelPad.SetEditWnd(),
AkelPad.GetSelStart(),
AkelPad.GetSelEnd(),
AkelPad.SetSel(),
AkelPad.ReplaceSel().
However, these methods do not work:
AkelPad.GetSelText(),
AkelPad.GetTextRange().
I looked at the source - IDocument.c.
These methods use GetTextRange() function that retrieves the text through main window (AKD_EXGETTEXTRANGEW message).
Can you do so that the text was taken directly from edit window (AEM_GETTEXTRANGEW)?
I have a script that uses AkelEdit control.
When I run this script from command line (as ActiveX), the following metods are available:
AkelPad.SetEditWnd(),
AkelPad.GetSelStart(),
AkelPad.GetSelEnd(),
AkelPad.SetSel(),
AkelPad.ReplaceSel().
However, these methods do not work:
AkelPad.GetSelText(),
AkelPad.GetTextRange().
I looked at the source - IDocument.c.
These methods use GetTextRange() function that retrieves the text through main window (AKD_EXGETTEXTRANGEW message).
Can you do so that the text was taken directly from edit window (AEM_GETTEXTRANGEW)?
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
Изменено: методы GetSelText и GetTextRange получают текст напрямую из AkelEdit контрола.
Changed: methods GetSelText and GetTextRange retrieves text directly from AkelEdit control.
Scripts plugin v12.6
Changed: methods GetSelText and GetTextRange retrieves text directly from AkelEdit control.
Scripts plugin v12.6
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
Добавлено: методы WindowRegisterDialog, WindowUnregisterDialog - зарегистрировать диалог для обработки в цикле сообщений. Используется в случае, если диалог создан без WindowRegisterClass.
Added: methods WindowRegisterDialog, WindowUnregisterDialog - register dialog for message loop. Used if dialog created without WindowRegisterClass.
Scripts plugin v12.8
Added: methods WindowRegisterDialog, WindowUnregisterDialog - register dialog for message loop. Used if dialog created without WindowRegisterClass.
Scripts plugin v12.8
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
viewtopic.php?p=9203#p9203Instructor wrote:Только DT_BYTE unsigned, остальные signed.
I think it has been changed.
It seems that DT_WORD is also unsigned.
You could add it in the documentation of AkelPad.MemRead().
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
A sample script run on x64:
Sometimes the value of hFont is negative.
In this case, there is a run-time error:
Error: Overflow
Code: 800A0006
Line: 5
Code: Select all
var hMainWnd = AkelPad.GetMainWnd();
var hEditWnd = AkelPad.GetEditWnd();
var hFont = AkelPad.SendMessage(hMainWnd, 1233 /*AKD_GETFONTW*/, 0, 0);
WScript.Echo(hFont);
AkelPad.SendMessage(hEditWnd, 48 /*WM_SETFONT*/, hFont, true);
In this case, there is a run-time error:
Error: Overflow
Code: 800A0006
Line: 5
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
I repeated following actions 10 times:Instructor wrote:Were unable to reproduce, ...
1. Run AkelPad.
2. Run sample script.
3. Close AkelPad.
On the ten trials, in three cases, I received a negative value (eg. hFont = -485881582).
This means that many scripts can not be converted into 64-bit version.//- JScript and VBScript doesn't understand __int64 in return value
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
Instructor
I think I found the problem solution.
Instead AkelPad.SendMessage method, should use User32::SendMessage function.
It seems to me that AkelPad.SendMessage method not tolerate negative value as a parameter (on x64).
I think I found the problem solution.
Instead AkelPad.SendMessage method, should use User32::SendMessage function.
Code: Select all
var oSys = AkelPad.SystemFunction();
var hMainWnd = AkelPad.GetMainWnd();
var hEditWnd = AkelPad.GetEditWnd();
var hFont = AkelPad.SendMessage(hMainWnd, 1233 /*AKD_GETFONTW*/, 0, 0);
var nObjType = oSys.Call("Gdi32::GetObjectType", hFont);
WScript.Echo("hFont: " + hFont + "\nnObjType: " + nObjType + "\n\n(6=OBJ_FONT)");
//AkelPad.SendMessage(hEditWnd, 48 /*WM_SETFONT*/, hFont, true);
oSys.Call("User32::SendMessageW", hEditWnd, 48 /*WM_SETFONT*/, hFont, true);
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
Исправлено: передача отрицательных значений методу SendMessage на Windows x64.
Fixed: passing negative values to SendMessage method on Windows x64.
Scripts plugin v12.9
Fixed: passing negative values to SendMessage method on Windows x64.
Scripts plugin v12.9