Jump to content
hemal

Call another script

Recommended Posts

hemal

How can I call another script from the existing one.

Share this post


Link to post
Share on other sites
Xandy
Posted (edited)

Compile SomeScript to exe and ShellExecute("SomeScript.exe").  If opening a script also executes it on your machine may be able to use ShellExecute("SomeScript.au3").

Run("SomeScript.exe") probably works too.

If you need inter-process communication you can read from: stdout using $pid returned from Run()

Edited by Xandy

Share this post


Link to post
Share on other sites
hemal
Posted (edited)

Thanks for prompt reply. . . :)

Edited by hemal
  • Like 1

Share this post


Link to post
Share on other sites
kylomas

hemal,

The scripts do not have to be compiled although they certainly can be.  Script 1 calls script 2 below...

; script 1

#include <MsgBoxConstants.au3>

msgbox($mb_ok,'Script 1',"Hi, I'm script 1" & @crlf & 'Hit Enter to call script 2')

ShellExecute('C:\Users\Tom\Documents\AI Help Scripts\script 2.au3')

 

; script 2

#include <MsgBoxConstants.au3>

msgbox($mb_ok,'Script 2',"Hi, I'm script 2")

There are other ways to do this also.  All of them described in the Help file.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
aa2zz6

I use this piece so it calls for another script and it waits for that called script to finish before it moves on.

RunWait(@AutoItExe & ' "' & @ScriptDir & "\Scripts\" & 'Setup.au3"')

 

Share this post


Link to post
Share on other sites
Juvigy

Mind that it depends what is the default action for .au3 files. For example the bellow line could have different outcomes depending on that.

ShellExecute('C:\Users\Tom\Documents\AI Help Scripts\script 2.au3')

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

×