Greenseed Posted December 2, 2005 Share Posted December 2, 2005 this simple script do not know why??? im unable to readfile error is set to -2 by fileread() in the help file, nothing tel me that fileread can set error to -2 #include <file.au3> $texttosearch = InputBox("Find Texte","Le Text Rechercher","boot","",200,80,200,200) ;Set Global Path $_fspath = "c:" ;List File To Array $FileList=_FileListToArray($_fspath,"*",1) ;if error msgbox If Not IsArray($FileList) and @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf for $x = 1 to $filelist[0] Local $_fsfhandle Local $_fsreadfile $_fsfilesize = FileGetSize($_fspath & "\" & $filelist[$x]) if $_fsfilesize < 10000000 Then $_fsfhandle = fileopen($_fspath & "\" & $filelist[$x], 0) $_fsreadfile = fileread($$_fspath & "\" & $filelist[$x]) MsgBox(262144,'Debug line ~26','Selection:' & @lf & '$_fsreadfile' & @lf & @lf & 'Return:' & @lf & $_fsreadfile & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX if stringinstr($_fsreadfile,$texttosearch) Then msgbox(0,"StringFound" , $filelist[$x]) fileclose($_fsfhandle) EndIf Next GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You. Link to comment Share on other sites More sharing options...
herewasplato Posted December 2, 2005 Share Posted December 2, 2005 fileread($$_fspath [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
odklizec Posted December 3, 2005 Share Posted December 3, 2005 (edited) BTW, isn't there a problem with Count parameter? I just faced the problem with FileRead and it looks, the Count is not "optional"? At least not in the latest AutoIt 3.1.1.92. I had to use "Count" argument in my script, otherwise it doesn't work. Edited December 3, 2005 by odklizec Link to comment Share on other sites More sharing options...
Valuater Posted December 3, 2005 Share Posted December 3, 2005 good catch plato i have the beta AutoIt 3.1.1.92. it says FileRead ( filehandle or "filename" [, count] ) and the demo works 8) Link to comment Share on other sites More sharing options...
odklizec Posted December 3, 2005 Share Posted December 3, 2005 (edited) Strange, after using this code..$chars = FileRead("E:\temp\test.txt")I got this error.. FileRead() [built-in] called with wrong number of args."while this works OK..$chars = FileRead("E:\temp\test.txt",FileGetSize("E:\temp\test.txt"))But if I understand the FileRead function correctly, the COUNT argument should not be required if I need to read entire file?It looks another user already confirmed this FileRead problem here.. Edited December 3, 2005 by odklizec Link to comment Share on other sites More sharing options...
LxP Posted December 4, 2005 Share Posted December 4, 2005 (edited) Yes, there are currently problems with the beta's FileRead(), however you are receiving the error you mention because you are running the release version.To fix this you need to run Start > Programs > AutoIt v3 > Beta > Toggle AU3 Beta.Edit: Typo. Edited December 4, 2005 by LxP Link to comment Share on other sites More sharing options...
Greenseed Posted December 4, 2005 Author Share Posted December 4, 2005 many Thx! this solve my probleme! GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You. Link to comment Share on other sites More sharing options...
themax90 Posted December 4, 2005 Share Posted December 4, 2005 There are also many issues wrong with BETA FileRead()Via this post:http://www.autoitscript.com/forum/index.php?showtopic=18697 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