Arketh Posted January 5, 2008 Share Posted January 5, 2008 Opening and reading files is easy enough so far, but what I want to do is work with the latest data, in as close as I can get to real time. Here's what I'm trying to do: Read line from file --> determine which (if any) substring exists in the line --> preform action based on substring ---> repeat Here's the issues I'm having: - Determining where the starting point (aka end of the file is) when the script begins. For the life of me, I can't find an easy way to determine the length of a file in lines with AutoIt. -Speed. It's a factor. The larger the file, the longer it takes to get the data at the end of the file. I can work at minimizing the length of the file to begin with, but what's the most efficient way to handle the process? I've poked around but can't find anything quite on this subject. the closest I've found is the EQ2 bot that goes through the log file... but wipes it clean every cycle. Link to comment Share on other sites More sharing options...
The Ape Posted January 5, 2008 Share Posted January 5, 2008 (edited) $sFilePath = "somefile.txt" Do Dim $aArray = "" _FileReadToArray($sFilePath, $aArray) $EndOfFile = $aArray[0];number of lines in file $Line = $aArray[$EndOfFile];Read line from array If StringInStr($Line, "some string") = 0 Then;determine which (if any) substring exists in the line ;perform action based on substring... if it's not found Else ;perform action based on substring... if it's found EndIf Until ?????;repeat --- conditional... The "Until ?????" needs to be defined. Without any code... I don't know the conditions that the loop needs. Right now, this will loop until you terminate the script... obviously. This is untested. Edited January 5, 2008 by The Ape FixJaw.comTriad-Art.com Link to comment Share on other sites More sharing options...
ptrex Posted January 5, 2008 Share Posted January 5, 2008 @ArkethIf speed is an issue you should move over to MS LogParserregards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
randallc Posted January 5, 2008 Share Posted January 5, 2008 Opening and reading files is easy enough so far, but what I want to do is work with the latest data, in as close as I can get to real time.Here's what I'm trying to do:Read line from file --> determine which (if any) substring exists in the line --> preform action based on substring ---> repeatHere's the issues I'm having:- Determining where the starting point (aka end of the file is) when the script begins. For the life of me, I can't find an easy way to determine the length of a file in lines with AutoIt. -Speed. It's a factor. The larger the file, the longer it takes to get the data at the end of the file. I can work at minimizing the length of the file to begin with, but what's the most efficient way to handle the process? I've poked around but can't find anything quite on this subject. the closest I've found is the EQ2 bot that goes through the log file... but wipes it clean every cycle.Hi,Or , if you don't want to have to install or register anything, try the UDFs and examples in link in my signature to "TailRW"; reads and writes to lines at the end of a file, defined by you.Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Arketh Posted January 5, 2008 Author Share Posted January 5, 2008 Thanks for the guidance. I've got the basic setup working for me now, using The Ape's code. I'll look at the other, faster options in the future, for now I can use this to iron out my system. Just for anyone refering to this thread for similar information, there's one problem with the Code as written. If StringInStr($EndOfFile, "some string") should be If StringInStr($Line, "some string") 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