DaProgrammer Posted March 7, 2008 Share Posted March 7, 2008 i am in need to read a massive 242MB text file it comes from the stock exchange at a rate of 20 strings per second hence its size. i was thinking of using rile read line and read a specific anout of lines (say 1000) and them jump to the next 1000 but the file doesnt have line breaks file read with an amount of chars also has a problem since it has to read the file from the begining if i want chars 10000-11000 anyone has any suggestins on how this can be done ? or has something like this already has been written ? p.s. i found external programs but still want to create something in autoit Link to comment Share on other sites More sharing options...
martin Posted March 7, 2008 Share Posted March 7, 2008 i am in need to read a massive 242MB text fileit comes from the stock exchange at a rate of 20 strings per second hence its size.i was thinking of using rile read line and read a specific anout of lines (say 1000) and them jump to the next 1000 but the file doesnt have line breaks file read with an amount of chars also has a problem since it has to read the file from the begining if i want chars 10000-11000 anyone has any suggestins on how this can be done ?or has something like this already has been written ?p.s. i found external programs but still want to create something in autoit Perhaps randallc's TailRW might do what you want. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
DaProgrammer Posted March 7, 2008 Author Share Posted March 7, 2008 ty m8 helped alot heres the result : reads 250,000 chars at a time and lets you move a page forward/backwards uses the API you refered me to. expandcollapse popup#include <APITailRW.au3> Opt("GUIOnEventMode",1) Global $File Global $Page = 0 Global $Count = 250000 $FilePath = FileOpenDialog("Please Select a text file",@DesktopDir,"All (*.*)") Global $File = _FileOpenAPI($FilePath) $Line = _FileReadAPI($File, $Count-1, 0) Global $GUI = GUICreate("LTF Viewer",600,360,-1,-1) Global $GUI_Edit = GUICtrlCreateEdit($Line,10,10,580,280) GUICtrlCreateButton("Next Page",10,310,80,30) GUICtrlSetOnEvent(-1,"NxtPage") GUICtrlCreateButton("Previous Page",100,310,80,30) GUICtrlSetOnEvent(-1,"PrvPage") Global $Gui_Page = GUICtrlCreateLabel("Page: " & $Page,200,310,120,20) GUISetState() While 1 Sleep(1000) WEnd Func NxtPage() $Page = $Page + 1 $Line = _FileReadAPI($File, $Count-1, $Page*($Count-1)) GUICtrlDelete($GUI_Edit) Global $GUI_Edit = GUICtrlCreateEdit($Line,10,10,580,280) GUICtrlDelete($Gui_Page) Global $Gui_Page = GUICtrlCreateLabel("Page: " & $Page,200,310,120,20) EndFunc Func PrvPage() $Page = $Page - 1 If $Page < 0 Then $Page = 0 $Line = _FileReadAPI($File, $Count-1, $Page*($Count-1)) GUICtrlDelete($GUI_Edit) Global $GUI_Edit = GUICtrlCreateEdit($Line,10,10,580,280) GUICtrlDelete($Gui_Page) Global $Gui_Page = GUICtrlCreateLabel("Page: " & $Page,200,310,120,20) EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now