Calling a script within a script
Forums
Hi Brian,
I hope all is well with you.
I'm trying to combine two scripts as follows:
Script A is a standalone that is used regularly.
Script B will not be used often, and it's starting point is the final file produced by Script A. It is not standalone.
I will need to update Script A from time and therefore I think it is better to call it at the beginning of Script B.
(I think this is sensible, as if I paste it into the start of Script B then I would have two files to update).
I have this working fine, except for one problem.
Both Script A and Script B can take a long time to run.
At the end of Script A there is a message box and the user has to click "OK" to finish.
This message is needed when running Script A as a standalone.
However, when I am calling this from Script B this effectively is a pause in the middle, requiring user interaction (click OK)
What I would like to do is to run Script B and not have this pause.
In other words, Script B calls Script A which runs to the end, no message box appears, and Script B continues to the end. No user interaction is needed in the middle.
I am wondering if there is a way to pass the "Ok" when I call Script A?
I tried this but it didn't work (and I didn't really know what I was doing)
Client.RunIDEAScriptEX directory &"\Macros.ilb\Script A.iss", "OK", "","",""
many thanks as always
Phil
Hi Phil,You can do this with…
Hi Phil,
You can do this with the Client.RunIDEAScriptRV function.
Here is an example for Script B
Sub Main
MsgBox "This is script B"
'call script A
Arg1 = "test"
Arg2 = ""
Arg3 = ""
Arg4 = ""
Client.RunIDEAScriptRV "Macros.ILB\Script A.iss", Arg1, Arg2, Arg3, Arg4
'client.RunIDEASCript "Macros.ILB\Script A.ISS"
MsgBox "Script B back from script A"
MsgBox "Arg1: " & Arg1
End Sub
Here is an example for Script A
Sub Main
MsgBox "This is script A"
MsgBox "Arg1: " & Arg1
Arg1 = "OK"
Arg2 = ""
Arg3 = ""
Arg4 = ""
End Sub
Using the RunIDEASCriptRV you can send up to four variables between the scripts. In script B I defined Arg1 as Text and then I redefined in as Arg1 in Script A. When Script A returns to B just check is Arg1 is equal to "OK" and then you can either continue with script B or cancel the operation. Hopefully this makes sense.