Jump to content

Running through multiple scripts


MadCoder
 Share

Recommended Posts

I have 15+ installation scripts that automate the install process new workstations.

Is there a method in Autoit to monitor when 1 script is completed and can move down

the list to the next in line. What would be the method for running down the list of scripts

to run without all running at once?

Would the best method be to do something like this...

;;; Install Python

$Python = InIRead("config.ini","Python","Python","")

ShellExecute($Python, "")

WinWaitClose("Python 2.4.2 Setup")

;; Install Boost C++ Libraries

$Boost = InIRead("config.ini","Boost","Boost","")

ShellExecute($Boost, "")

WinWaitClose("Boost C++ Libraries 1.39 Setup")

AND SO ON...

Link to comment
Share on other sites

Also have one of those. Just modify it to your specific purpose.

The way I do my installations is that I have a script that runs the installation program and does the clicking and typing too. So all my launcher and runner scripts need to do is run my installation scripts. In this case, my runner doesn't have an option to indicate working directory for my installation scripts.

Edit: Oh, I also made my installation scripts use _Singleton and set it so it waits for the installation program to close before the installation script terminates. This ensures that only one installation process is active at any given time.

#include <Misc.au3>
_Singleton("Automated Launcher Script")
Opt("MustDeclareVars", 1)
HotKeySet("^!x", "_Close");Exit on Ctrl+Alt+X

Global $ininame = "_process_runner.ini"
Global $section = "Processes"

If $CmdLine[0] == 1 Then
    $ininame = $CmdLine[1]
EndIf

If Not FileExists($ininame) Then
    MsgBox(0x2030, "Error", "No """ & $ininame & """! Writing empty .ini file.")
    _CreateINI()
    Exit
EndIf
Global $list = IniReadSection($ininame, $section)
If @error == 1 Then
    MsgBox(0x2030, "Error", "Read fail for " & $ininame & "! File empty or invalid.")
    Exit
EndIf

Global $pID
For $i = 1 To $list[0][0]
    $pID = Run($list[$i][1])
    If @error <> 0 Then
        MsgBox(0x2030, "Error", "Failed to run " & $list[$i][1] & "!")
    EndIf
    ProcessWaitClose($pID)
Next

Func _CreateINI()
    Local $file = FileOpen($ininame, 2)
    FileWriteLine($file, ";INI file for Process Runner")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Key-Value pair format is: KEY = VALUE")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Note: Key can be any value.")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Sample:")
    FileWriteLine($file, ";[Processes]")
    FileWriteLine($file, ";sometext1 = someprogram.exe")
    FileWriteLine($file, ";sometext2 = .\path\someprogram.exe")
    FileWriteLine($file, ";sometext3 = D:\path\someprogram.exe")
    FileWriteLine($file, ";")
    FileWriteLine($file, ";Start entries here:")
    FileWriteLine($file, "[Processes]")
    FileClose($file)
EndFunc

Func _Close()
    Exit
EndFunc
Edited by omikron48
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...