bowain Posted October 16, 2008 Share Posted October 16, 2008 Okay, is it possible to use file handles in _FileReadToArray or not? I've scoured the forum and re-re-re-read the help file description and have only come to the conclusion that you must use a string as in $MyFile="c:\windows\notepad.exe" _filereadtoarray ($MyFile,$MyArray) or literally put the file path in the line as in _filereadtoarrray ("c:\windows\notepad.exe",$MyArray) After the week I have had so far I just want to make sure I'm not losing it somewhere. Also hoping this might help some other poor frazzled coder in his quest for greatness... (apologies in advance if this has already been answered) #include <sincere_apology.au3> Link to comment Share on other sites More sharing options...
YellowLab Posted October 16, 2008 Share Posted October 16, 2008 (edited) Just a clarification: $MyFile="c:\windows\notepad.exe" Is not a file handle - it is a string and as such: _filereadtoarray ($MyFile,$MyArray) is the same as _filereadtoarrray ("c:\windows\notepad.exe",$MyArray) The file handle would be: $hFile=FileOpen("c:\windows\notepad.exe") I don't know how filereadtoarray or fileopen would handle .exe's A quick way would be to write a script using both handles and paths to see if the arrays are the same. Bob Edited October 16, 2008 by YellowLab You can't see a rainbow without first experiencing the rain. Link to comment Share on other sites More sharing options...
bowain Posted October 16, 2008 Author Share Posted October 16, 2008 Just a clarification:$MyFile="c:\windows\notepad.exe"Is not a file handle - it is a string and as such:_filereadtoarray ($MyFile,$MyArray)is the same as_filereadtoarrray ("c:\windows\notepad.exe",$MyArray)The file handle would be:$hFile=FileOpen("c:\windows\notepad.exe")I don't know how filereadtoarray or fileopen would handle .exe'sA quick way would be to write a script using both handles and paths to see if the arrays are the same.BobYeah guess not the best example . Try this...$FileToOpen=FileOpen("c:\any.txt",0)_FileReadToArray($fileToOpen,$MyArray)The above does not work, but...$FileToLookAt="c:\any.txt)_FileReadToArray($FileToLookAt,$MyArray)this way does as does (and to your point this being essentially the same)..._FileReadToArray("c:\any.txt",$MyArray) Link to comment Share on other sites More sharing options...
Developers Jos Posted October 16, 2008 Developers Share Posted October 16, 2008 Yeah guess not the best example . Try this...$FileToOpen=FileOpen("c:\any.txt",0)_FileReadToArray($fileToOpen,$MyArray)The above does not work, but...$FileToLookAt="c:\any.txt)_FileReadToArray($FileToLookAt,$MyArray)this way does as does (and to your point this being essentially the same)..._FileReadToArray("c:\any.txt",$MyArray)The first example doesn't work because the _FileReadToArray() needs a filename as input.The Notepad.exe will also not work as this UDF bexpects a regular text file.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
bowain Posted October 16, 2008 Author Share Posted October 16, 2008 The first example doesn't work because the _FileReadToArray() needs a filename as input.The Notepad.exe will also not work as this UDF bexpects a regular text file.JosYeah caught that and reposted with better example, sorry I'm just a bit discombobulated, but the main question still bugs me, can a file handle be used in _readfiletoarray. I know it's a nit picky thing but it's like an itch you can't reach, ya know? Link to comment Share on other sites More sharing options...
Developers Jos Posted October 16, 2008 Developers Share Posted October 16, 2008 (edited) Yeah caught that and reposted with better example, sorry I'm just a bit discombobulated, but the main question still bugs me, can a file handle be used in _readfiletoarray. I know it's a nit picky thing but it's like an itch you can't reach, ya know?You mean that the first line I typed and the helpfile aren't explicit enough ? EDIT: you can of cource copy the standard UDF and modify it to your needs.Jos Edited October 16, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 16, 2008 Share Posted October 16, 2008 (edited) I'm utterly confused. I guess I caused some weirdness passing a handle as the file path string... Edited October 16, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
bowain Posted October 17, 2008 Author Share Posted October 17, 2008 You mean that the first line I typed and the helpfile aren't explicit enough ? EDIT: you can of cource copy the standard UDF and modify it to your needs.JosMaybe it gets lost in translation As for editing the UDF, wheres the fun in that? That would be like *gasp* work!!!! Much easier just to complain and get things fixed (at least that's the way the end users at my job think) (It would be a good exercise I guess, but far too much to do at the moment)Seriously thanks for the information and help, I'll be crawling back under the rock I oozed out from until another itch needs scratched. 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