JustDoIt Posted September 8, 2007 Share Posted September 8, 2007 Can someone tell me how to in AutoIt read the name of a file (not the content of the file) into a string ??? TIA. Link to comment Share on other sites More sharing options...
Kram3r Posted September 8, 2007 Share Posted September 8, 2007 (edited) Explain better. If you dont know the file name, where are the file ? How do you know the file that you want to know the name ? Dim $file Dim $tmp $file="test.txt" $tmp=fileread($file) msgbox(0,"test","This are file contents"&$tmp&" and this are the file name "&$file) Edited September 8, 2007 by Kram3r To all the Devs: Thkx for AutoIt To all Mods: Thkx for the quality forum Link to comment Share on other sites More sharing options...
JustDoIt Posted September 8, 2007 Author Share Posted September 8, 2007 Explain better. If you dont know the file name, where are the file ?How do you know the file that you want to know the name ?Files are created from the run of an application. File name's format is already specified inside the program but the files' names vary depending on the workload. So, I would like to check the names (of the files that are generated after the program's run) to see they are in expected format. Link to comment Share on other sites More sharing options...
JustDoIt Posted September 8, 2007 Author Share Posted September 8, 2007 (edited) Dim $file Dim $tmp $file="test.txt" $tmp=fileread($file) msgbox(0,"test","This are file contents"&$tmp&" and this are the file name "&$file) It returns the file name as "1", while it's actually "test.txt" Edited September 8, 2007 by JustDoIt Link to comment Share on other sites More sharing options...
Kram3r Posted September 8, 2007 Share Posted September 8, 2007 (edited) You can use for your case: _FileListToArray () Description: Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch) PS: In my environment the above example returns "test.txt" for the file name. Edited September 8, 2007 by Kram3r To all the Devs: Thkx for AutoIt To all Mods: Thkx for the quality forum Link to comment Share on other sites More sharing options...
JustDoIt Posted September 8, 2007 Author Share Posted September 8, 2007 _FileListToArray () is what I need. Thanks. Link to comment Share on other sites More sharing options...
Kram3r Posted September 8, 2007 Share Posted September 8, 2007 You welcome, glad to help you. To all the Devs: Thkx for AutoIt To all Mods: Thkx for the quality forum 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