Jump to content

Loop Function and Excel


Recommended Posts

Hi,

Obviously i am new to Autoit and scripting, hopefully i can get some help to start me off. I created an autoit script that automates an installation of an application. I would like this script to be scheduled on every computer through scheduletask. I have a list of computer names in an excel spreadsheet, how do i loop a command line for scheduletask but replacing the computer name each time so that it schedules the task on each different computer base on the excel file. Thank you so so much in advance and if you need further clarification please let me know.

currently i have to put this into command prompt and change the workstation name for each and every workstation i would like to schedule the task on. Is there a way to change it so that it loops through but changing the "workstation" name base on an excel cell.

schtasks /create /tn task1 /tr \\executebalefile.exe /sc Once /st hh:mm:ss /s \\workstation /u domain\username /p password /ru domain\username /rp password

Link to comment
Share on other sites

The Autoit script should use the Excel UDF to read each line in increment, and then execute your command, replacing the computername with the value read from the excel sheet.

you make it sound so simple, but I am the noobiest of all noobs with autoit, sorry in advance. Could you provide me with an example? thanks

Link to comment
Share on other sites

you make it sound so simple, but I am the noobiest of all noobs with autoit, sorry in advance. Could you provide me with an example? thanks

Check the helpfile under user defined function (UDF)

Excel Management

Read some examples to know how to use _ExcelBookOpen and _ExcelReadArray

Then read up on how to make a FOR loop to look through the Array you created with _ExcelReadArray

Then on each pass of the loop, do a RUNAS or something to that effect

Link to comment
Share on other sites

Check the helpfile under user defined function (UDF)

Excel Management

Read some examples to know how to use _ExcelBookOpen and _ExcelReadArray

Then read up on how to make a FOR loop to look through the Array you created with _ExcelReadArray

Then on each pass of the loop, do a RUNAS or something to that effect

UDF has a lottt in it to be learned. First two i understood, but when gets to writing the loop which calls on the arry i am lost. I learn better from seeing examples, I will keep reading. thank you for your help.

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