Page 1 of 1

Step thru a file one line at a time

Posted: Sat Jan 19, 2019 1:26 pm
by Dellji
I haven't been able to find a way to step thru a text file one line at a time.
The file is a windows file and contains 2.6 million lines
I would like to access each line separately
The lines vary in length up to 255 characters.

Is there a way to accomplish this?

Jim

Posted: Sun Jan 20, 2019 4:12 pm
by KDJ
Dellji

Code: Select all

var nLine    = 0; //first line
var hWndEdit = AkelPad.GetEditWnd();
var nOffset1 = AkelPad.SendMessage(hWndEdit, 3138 /*AEM_GETRICHOFFSET*/, 41 /*AEGI_RICHOFFSETFROMUNWRAPLINE*/, nLine);
var nOffset2 = AkelPad.SendMessage(hWndEdit, 3138 /*AEM_GETRICHOFFSET*/, 19 /*AEGI_WRAPLINEEND*/, nOffset1);
var sText    = AkelPad.GetTextRange(nOffset1, nOffset2);

WScript.Echo(sText);

Posted: Sun Jan 20, 2019 9:49 pm
by Dellji
KDJ wrote:Dellji

Code: Select all

var nLine    = 0; //first line
var hWndEdit = AkelPad.GetEditWnd();
var nOffset1 = AkelPad.SendMessage(hWndEdit, 3138 /*AEM_GETRICHOFFSET*/, 41 /*AEGI_RICHOFFSETFROMUNWRAPLINE*/, nLine);
var nOffset2 = AkelPad.SendMessage(hWndEdit, 3138 /*AEM_GETRICHOFFSET*/, 19 /*AEGI_WRAPLINEEND*/, nOffset1);
var sText    = AkelPad.GetTextRange(nOffset1, nOffset2);

WScript.Echo(sText);
The echo box doesn't display the first record. Its blank