Andre Posted October 11, 2004 Share Posted October 11, 2004 Hi, Is there an way to find an String in an binary File ? When so, it would then be nice to stop searching when found. Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
ezzetabi Posted October 11, 2004 Share Posted October 11, 2004 Autoit does not manage binary files well. But can try to 'integrate' XVI that will do what you need.More info in this old topic... Link to comment Share on other sites More sharing options...
Andre Posted October 11, 2004 Author Share Posted October 11, 2004 Hi, Thnx, I'll give it a try. Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
Andre Posted October 12, 2004 Author Share Posted October 12, 2004 Hi, Too bad, is not what i want. I want to search the header of an binary file and pass the result to AutoIt. Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted October 12, 2004 Share Posted October 12, 2004 Hi,Too bad, is not what i want.I want to search the header of an binary file and pass the result to AutoIt.Andre<{POST_SNAPBACK}>As long as you are not looking for the null character you can loop through the binary file just like a text file. It would look something like this (untested):Func SearchBinFile( $binFile, $strSearch ) $file = FileOpen( $binFile ) While 1 $currText = FileRead( $file, StringLen($strSearch) ) If( @error = -1 ) Then Return 0 EndIf If( $currText = $strSearch ) Then ; Place code here to do when string is found Return 1 EndIf Wend EndFuncIt only tells you if it is found, but you can change it to do whatever you need. It should work. Hope it helps!*** Matt @ MPCS Link to comment Share on other sites More sharing options...
Andre Posted October 12, 2004 Author Share Posted October 12, 2004 Hi, I Changed you're code a bit and now it's working like the way i want it. expandcollapse popupIf SearchBinFile('c:\tmp\renamemaster.exe','This',9) Then MsgBox(4096,'Found','Found it!') EndIf ; ---------------------------------------------------------------------------- ; Functions ; ---------------------------------------------------------------------------- Func SearchBinFile( $binFile, $strSearch,$Inputcounter ) Dim $CurrText, $StrSearch Dim $File, $BinFile Dim $Counter, $InputCounter $file = FileOpen( $binFile,0 ) While 1 $currText = FileRead( $file, StringLen($strSearch) ) $Counter = StringLen($strSearch) + $Counter If $Counter >= $InputCounter Then Return 0 EndIf If( @error = -1 ) Then Return 0 EndIf If( $currText = $strSearch ) Then Return 1 EndIf Wend EndFunc Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! 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