Sign in to follow this  
Followers 0
inthewayboy

Scan For AU3 Files And Execute All

8 posts in this topic

I'm almost done with my new version of our companies RIS images. I'm using AutoIT to help install all the applications silently and to also help configure things after the install. I've got all the initial program scripts setup and tested, and now I need to find a way to automate the installation of them all.

We have several different images, each with it's own set of specific installation needs. My idea was to have main 'install' script that would check a certain directory (C:\Install) for all AU3 files and then take the results and execute each one systematically.

For instance, on one RIS Image I might have ten applications that needed to be loaded, but on another I might only have five. So instead of setting up a unique install sequence for each one I would like to have only one application started...the main 'install' script...which in turn would execute all the images AU3 installs. That way I don't have to edit the config file for each image, I can just put the appropriate AU3 files in the correct folder and let the script handle the dirty work.

Problem is that crosses the line of what I know how to do...I can handle the simple functions and such, but things like setting up arrays and loops and such are just out of my current scope of knowledge.

However, I don't expect anyone to write it all for me, I just need to be pointed in the right direction.

Also, since there are certain applications that need to be installed in a particular order, would there be any way to include a variable/number in each AU3 that would give it a relative install order?

I know there are other programs that are designed to do this...I hang out at MSFN a lot and have used WPI and xplode...but, I'm really hot on the idea of doing it all in house. Thanx in advance!!!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

That's my next script attempt once I finish the one I am working on now. Our PC Techs spend a lot of time loading different apps and setting up the same options over and over on each PC. Others will surely have better options, but my first thought was to setup an INI file with all the different scripts and then let the main script pull from the ini file. I could have different ini files for different area, and still put one together fairly quickly for the oddball special circumstance.

Check out the IniReadSection from the help menu and see if maybe that would suit your needs. I am a total noob with this stuff so I hope it makes sense.

Edited by MuffinMan

Share this post


Link to post
Share on other sites

I actually do the same. I have one script that installs from all au3 files from a preset directory. My deployment script remains uncompiled and runs from Cmdlines.txt. It is an easy method to maintain as you just need to drop your software and au3 scripts into that one folder to install without updating anything else.

Below is some basic code for you to learn from. It will search a folder as set with $path and execute each in sequence. As for order, AutoIt will execute in the similar order as you see in explorer. Just add a prefix to make a filename execute before another.

3.1.1 code thats works uncompiled.

$path = @ScriptDir & '\$OEM$\Software'
$handle = FileFindFirstFile($path & '\*.au3')
If $handle <> -1 Then
    For $i = 1 To 500
        $script = FileFindNextFile($handle)
        If @error Then ExitLoop
        RunWait(@AutoItExe & ' "' & $path & '\' & $script & '"')
    Next
    FileClose($handle)
EndIf

Beta code that works uncompiled or compiled.

$path = @ScriptDir & '\$OEM$\Software'
$handle = FileFindFirstFile($path & '\*.au3')
If $handle <> -1 Then
    For $i = 1 To 500
        $script = FileFindNextFile($handle)
        If @error Then ExitLoop
        RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & $path & '\' & $script & '"')
    Next
    FileClose($handle)
EndIf

Here is my deployment script, if it will help with ideas:

_Deployment.html

Share this post


Link to post
Share on other sites

Nice to see you here MHZ...great minds think alike huh?

As for the replies, I'm gonna tinker with both...the ini file is nice and easy, but would still require a little more preconfiguring. However, it should address the install order issue very nicely...with me manually placing them in order in the ini of course!

MHZ is nice, but I don't see how I can order the installs...I'll look into your Deployment script and see if there is any gems that I can pull from it.

Thanx again!!!

Share this post


Link to post
Share on other sites

Nice to see you here MHZ...great minds think alike huh?

As for the replies, I'm gonna tinker with both...the ini file is nice and easy, but would still require a little more preconfiguring. However, it should address the install order issue very nicely...with me manually placing them in order in the ini of course!

MHZ is nice, but I don't see how I can order the installs...I'll look into your Deployment script and see if there is any gems that I can pull from it.

Thanx again!!!

Hi guys, i created a script recently that does a dos based DIR cmd and pipes the info to the txt file, then reads that text file to an array, with DIR you can tell it which order to set, ie name, date etc.

_RunDOS( "dir *.log /b /o-e /od > logs.txt" )

this example would show the following in logs.txt - notice the /b - this doesnt display any other info apart from the file names.

j0000001.log

j0000002.log

j0000003.log

j0000004.log

j0000005.log

j0000006.log

j0000007.log

these log files were orderd by the date they were created but its not that hard to order by name

or the other option you can use is this

#include <File.au3>
_FileListToArray($sPath [, $sFilter [, $iFlag]])

apparently this lists the files the same as doing a dir /b command but you dont have the extended features of the dir command, ie sorting by name or date etc.

Share this post


Link to post
Share on other sites

Nice to see you here MHZ...great minds think alike huh?

As for the replies, I'm gonna tinker with both...the ini file is nice and easy, but would still require a little more preconfiguring. However, it should address the install order issue very nicely...with me manually placing them in order in the ini of course!

MHZ is nice, but I don't see how I can order the installs...I'll look into your Deployment script and see if there is any gems that I can pull from it.

Thanx again!!!

Ini files would need to be updated when you change the software with a newer version or another software. This means constant updating of the file and manually ensuring that it is correct. I could see an ini as being good for paths if the main script is compiled or some other reason. If possible, the main script should do the work of searching for au3 scripts without a list, executing as found, log times and exit codes or whatever else to accomplish what you want.

As to order files, options are available to use. You could have more then 1 folder to search, so your early installs can go into a folder for the first seach and be exected and the same for the latter folder.

You can also use certain prefixes to the filenames to change the order. All of my install scripts start with an underscore. This makes them different to the installer name, so an accidental execution of the script itself will not happen. Using an underscore allows for the following character to be a method to change order.

This is a natural search order for AutoIt.

_AAA.au3
_BBB.au3

But, adding a period infront of the 1st B will alter the search order as a period comes before A does.

_.BBB.au3
_AAA.au3

You could also use numbers instead of the period concept, thus allowing for a priority concept to be used which would enable search'n'install groups.

_1DDD.au3
_1EEE.au3
_2CCC.au3
_3AAA.au3
_3BBB.au3

The number 1 goal for scripting and automation is to let the script do all the work possible. With my current deployment script, no need to update anything as I just make a install script and add it, as well as the installer, into the folder and all is done. If you need to use an ini to keep setting of folder paths or any other configuration setting, then so be it. But plan on the script to do the work rather then you. You should just need to do the initial work of the main script creation.

Share this post


Link to post
Share on other sites

Ris images are not very automated at all, wouldnt you be better off using something like BDD from microsoft. i create 1 image for about 10 different models of laptops and desktops. these are all windows xp so its easy for me to manage but you can create a couple of different platform images, all using the same install apps etc.

the laptops all require different apps to make power options etc work but that is all controlled by BDD. i just say where the app is located and the silent install string that apps uses.

my 2 cents worth (not that we have 2 cent coins in NZ anymore haha)

Share this post


Link to post
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
Sign in to follow this  
Followers 0