Jump to content

Read the name of a file into a string ?


JustDoIt
 Share

Recommended Posts

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 by Kram3r

To all the Devs: Thkx for AutoIt To all Mods: Thkx for the quality forum

Link to comment
Share on other sites

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

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 by JustDoIt
Link to comment
Share on other sites

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 by Kram3r

To all the Devs: Thkx for AutoIt To all Mods: Thkx for the quality forum

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...