Jump to content

Declaring a value based on entry in text file


 Share

Recommended Posts

Hello,

Have a script that will run in a loop. Script will have a variable in it called $fname. $fname is the name of the directory that the script will act on for some file conversions. Each time the script loops and starts over the &fname variable will need to change. Is it possible to pull the $fname value from a text file with all the directory names in it? In other words, I would have a text file with the following in it:

Dir 123

Dir 478

Dir 467

Dir 2000

The first time the script runs the $fname would be declared as Dir 123, the second time it would pull the value of Dir 478. and so on down the line. Is there a way to do this with a text file or otherwise? Thanks.

Link to comment
Share on other sites

If it's an ini file in ini format.

Yep, filereadline did the trick. Script ended up looking something like:

$file = FileOpen("test.txt", 0)

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

Then I just use the $line variable wherever I need it. The script continues to loop until the end of the file is reached. Awesome!!! It works. Thanks.

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...