Returning values from RunScript

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
claudio.junqueira
Newbie
Posts: 1
Joined: Mon Jul 30, 2012 3:43 am

Returning values from RunScript

Post by claudio.junqueira » Mon Jul 30, 2012 3:47 am

I am using the SDK to implement the MacroScript from a .NET application.
I am calling the scp file using the RunScript function, like the example bellow.

Code: Select all

        Dim x3 As New MScript.MacroScript
        x3.Init()

        'chama script para abrir o SAC
        x3.RunScript("C:\Test\test.scp", "")
        Dim str As String

I need to get a value from a variable in this script.
How can I get it?

I read in some topic that I need to use the
I tried the code bellow, but I can't get the value.
How can I do this? Is there some way to get this values?

Code: Select all

Dim str As String
        str = x3.GetVar("MACRO_RESULT")

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Aug 01, 2012 3:39 pm

If you are using the ActiveX version RunScript returns the value of the MACRO_RESULT script variable. So in your script you can set a value to this variable. e.g.:

Let>MACRO_RESULT=HELLO WORLD

And then RunScript will return the "HELLO WORLD".

If using the DLL then you can pass a string buffer to RunScript to return the value of the MACRO_RESULT variable and RunScript will return the number of characters written to the buffer.

GetVar can be used along with RunCode to return the value of a script variable as long as you call if before running Cleanup.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts