Jump to content

Variable Array & Do Loop


Recommended Posts

I need to declare a variable array, such as a list of names, then do a loop applying each variable to the script until all variable have been used.

For instance:

Array: John, Mary, Bob, Alice

For x=1 to number of entries in array

do processing

repeat

Also is it possible to have this "array" be an external text file that I can edit outside of the script? That would allow me to compile my script and only edit the text file to add or take away names in the array.

Any ideas?

Link to comment
Share on other sites

Look at the help file and search for _FileReadToArray which reads a specified file into an array.

This is an example from the help file:

#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("error.log",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    Msgbox(0,'Record:' & $x, $aRecords[$x])
Next
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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...