Page 29 of 97

Posted: Tue Aug 10, 2010 12:09 pm
by VladSh
Изменил названия объектов на oCh и oStr, в следствие чего изменились все скрипты этого списка.

Posted: Tue Aug 10, 2010 7:41 pm
by KDJ
cnnnc wrote:When InsertText.js do with column selection In each of Selected, the result same as normal selection.
When InsertText.js do with column selection In Selection, the result is diffterent to normal selection.
My NumberCount.js can insert text and/or number to every selected line even column selection. but there are some bugs I unable to fix. :(
Thank you for your attention, I'll try to fix it.
I agree, your script NumberCount.js is much better than mine.
Good idea with the numbers of lines. Congratulations. :)

Posted: Thu Aug 12, 2010 7:46 pm
by KDJ
I fixed InsertText.js script and I added support for the columnar selection.

Posted: Sat Aug 14, 2010 7:20 pm
by KDJ
Hi, I have a question.
I have done the columnar selection outside the text (after end of line)
How to read the begin and the end of selection and the caret offset?.
Methods AkelPad.GetSelStart and AkelPad.GetSelEnd fail in this case.

Posted: Mon Aug 16, 2010 9:49 am
by Instructor
VladSh wrote:Instructor
Только заметил, что скрипт GetFirstVisibleChar.js исчез. Задача всё та же (что по ссылке).

Code: Select all

var hWndEdit=AkelPad.GetEditWnd();

WScript.Echo("" + GetOffset(hWndEdit, 10 /*AEGI_FIRSTVISIBLELINE*/));

function GetOffset(hWndEdit, nType /*AEGI_*/)
{
  var lpIndex;
  var nOffset=-1;

  if (lpIndex=AkelPad.MemAlloc(12 /*sizeof(AECHARINDEX)*/))
  {
    AkelPad.SendMessage(hWndEdit, 3130 /*AEM_GETINDEX*/, nType, lpIndex);
    nOffset=AkelPad.SendMessage(hWndEdit, 3136 /*AEM_INDEXTORICHOFFSET*/, 0, lpIndex);
    AkelPad.MemFree(lpIndex);
  }
  return nOffset;
}

Posted: Mon Aug 16, 2010 9:59 am
by Instructor
KDJ wrote:How to read the begin and the end of selection and the caret offset?.

Code: Select all

var hWndEdit=AkelPad.GetEditWnd();

WScript.Echo("" + GetCharInLine(hWndEdit, 5 /*AEGI_CARETCHAR*/));

function GetCharInLine(hWndEdit, nType /*AEGI_*/)
{
  var lpIndex;
  var nCharInLine=-1;

  if (lpIndex=AkelPad.MemAlloc(12 /*sizeof(AECHARINDEX)*/))
  {
    AkelPad.SendMessage(hWndEdit, 3130 /*AEM_GETINDEX*/, nType, lpIndex);
    nCharInLine=AkelPad.MemRead(lpIndex + 8, 3 /*DT_DWORD*/);
    AkelPad.MemFree(lpIndex);
  }
  return nCharInLine;
}
But working with AECHARINDEX it is not easy like text offsets.

Posted: Mon Aug 16, 2010 6:38 pm
by KDJ
Thanks Instructor. You helped me very much. This function gives the column number of the caret.
My guess, to read the line number, I should use:
AkelPad.MemRead(lpIndex, 3 /*DT_DWORD*/).
And to know the coordinates of selection, I must use AEGI_FIRSTSELCHAR and AEGI_LASTSELCHAR.

Posted: Thu Aug 26, 2010 5:23 pm
by KDJ
CalculatorJS.js now has a variable size window.

Posted: Thu Aug 26, 2010 6:10 pm
by FeyFre
KDJ, I think script should validate such cases:
Image

Posted: Thu Aug 26, 2010 7:33 pm
by KDJ
FeyFre wrote:KDJ, I think script should validate such cases:
Of course you're right, already corrected.

Posted: Fri Aug 27, 2010 8:01 am
by DV
KDJ wrote:CalculatorJS.js
Amazing!
Just one little correction: under Windows 7, the width of lpOutXYWH causes the Output Edit to intersect the Output type Combo. So I've changed this width from 471 to 469.
... and the function average seems to not working... It says 'Average' is undefined.

Posted: Fri Aug 27, 2010 10:03 am
by KDJ
DV thanks, I fixed it.

Posted: Sat Aug 28, 2010 10:33 am
by DV
KDJ wrote:DV thanks, I fixed it.
Great!
Just for information: a remarkable ability of the calculator engine powered by JScript is to use local or global variables anywhere in your calculations.
E.g.

Code: Select all

var a = 10, b = 5, x = a + b; sin(x)/x
for local variables a, b and x.
Or just

Code: Select all

c = 100
to define a global variable c (within current instance of the calculator).

Posted: Sat Aug 28, 2010 12:25 pm
by KDJ
In CalculatorJS, variables x, X, y, Y, z, Z are defined as global.
They are used to store cache memory of the calculator.
You can use them in calculations such as: 15*x+y-Z/12.
But you can not use to manual assignment eg.: x=50.
To change the contents of memory x, you must type as the expression 50 and use the button "Result to X". Then the value of 50 will be assignment to the variables x and X, and will be displayed in the window memory.

Posted: Sat Aug 28, 2010 12:48 pm
by kadvlad
Приветствую.

Пробую запустить InsertTextLN.js от KDJ -- получаю ошибку 800A1391 ("AkelPad" - определение отсутствует) в строке

Code: Select all

var hMainWnd     = AkelPad.GetMainWnd(); 
Версия программы 4.1.10
В чём моя ошибка, подскажите, пожалуйста.