Jump to content

Using arrays and For loops


Recommended Posts

My esteemed Autoits I need your help once again.

I'm trying to figure out how to create a loop that gets 1 value from an array and repeats until each value from the array has been used. I have never used arrays before and I know once I learn more things should get easier for me. 

Here is what Im trying to do:

-Have an array of values that determine what application i log into. ex: app1, app2, app3, app4 etc.

-Have a loop that repeats a process sequentially using each value in the array to finish the process for each app1, app2, app 3 and so forth. I have 30 apps that I need to update on a regular basis and getting this sorted out is what I perceive to be the best way to do it.

Here is my feeble attempt that obviously fails:

#include <msgboxconstants.au3>
#include <Constants.au3>
#include <array.au3>

Login()
Func Login()
    local $array[30] = ["10", "11", "12",etc etc]
    ;;Local $site = InputBox("ERx Site","What site do you want to login as?","","")
    Local $userid = InputBox("ERx Login", "What is your username?", "", "")
    Local $Passwd = InputBox("Security Check", "Enter your UAT password.", "", "*")

for $1 = 1 to 30(I need to do the same steps in 30 different apps)
run("Z:launch.exe")
WinWaitActive("Input")
Send (Sequential ARRAY VALUE HERE)
Send("{ENTER}")
WinWaitActive("window")
Send($userid)
Send("{TAB}")
send($Passwd)
Send("{ENTER}")
WinWaitActive("[CLASS:SunAwtDialog]")
Sleep(500)
WinClose("Home Page")
Next
EndFunc
 

your help is greatly appreciated.

Thanks for your time

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

×
×
  • Create New...