Jump to content

Newbie Q - can my AutoIT script run other AutoIT Scripts - How


Recommended Posts

Newbie here tyring to handle joining many different pieces of different scripts to form a new script.

I would like to have a master script file that launches sub scripts that need to finish (with a time out failsafe) before processing continues, ideally passing back a return code to indicate what has transpired.

Not sure what commands to use and how to structure. I have been trying to READ the Manual, but not sure what I need.

I am looking at the following possibilities: Call, Run, RunAs, RunAsWait, RunWait, ShellExecute, and ShellExecuteWait as the launch methods.

So, what are preferred methods and what problems should I be watching out for?

Thanks.

Snoopy

Snoopy=====Still trying to shoot down that Red Baron :-))

Link to comment
Share on other sites

Thanks MPH. I am trying to go through it, but it does not render properly on my system (I don't know why), so I can't see full descriptions of Exam Questions, and the Break time example (Object) did not work either.

Anyway, as I have managed to make several smaller individual scripts that I am now trying to piece together, just looking for a little guidance on best practices for joining scripts in a manner that can isolate functional processes to make it easier to handle adjustments and errors.

Essentially, do I make I HUGE (ugly) script and just brute force my way through, or can I make a pretty Master/Slave type of script to call individual apps from their respective slave process?

Thanks

Snoopy=====Still trying to shoot down that Red Baron :-))

Link to comment
Share on other sites

Well, as it happens, I did a similar script yesterday. Rather than running multiple scripts, you can run the same one multiple times, with parameters. I'll give you a script example.

Global $Output, $ProcessID
For $Repeat = 1 To $CmdLine[0];The $cmdline array is automatically set by autoit. It contains any parameters given to the program when it is run.
    ;Hold Shift and press F8 in scite to set parameters. Enter "a" into the first box, without quotes.
    MsgBox(0,"",$CmdLine[$Repeat]) ;For debug reasons - shows you what the current parameter is.
    If $CmdLine[$Repeat] = "Function1" Then
        _Function1()
    EndIf
Next
If @Compiled = 1 Then
    $ProcessID = Run(FileGetShortName(@ScriptFullPath) & " Function1", @SW_SHOW, 0x02);0x02 = $STDOUT_CHILD
Else
    $ProcessID = Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)& " Function1", @SW_SHOW, 0x02);0x02 = $STDOUT_CHILD
EndIf
Func _Function1()
    ConsoleWrite("This data should be displayed in a message box")
    Exit
EndFunc

That currently works to run the function. Unfortunately, I have no experience reading the STDOUT and I don't know how to have a script write to the stream. I will work on it though, because that's valuable information to know.

Anyway, that will get you running the function. It won't do communicatins but I don't have a clue how to do that.

Edited by Mikeman27294
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...