Jump to content
Sign in to follow this  
dickep

Return value to another application

Recommended Posts

dickep

Is it possible to have an application call a compiled AutoIT script and return a value back?

Example from C++:

if (AutoITScriptValue == 1) then do this;

Thanks

E

Share this post


Link to post
Share on other sites
PsaltyDS

Is it possible to have an application call a compiled AutoIT script and return a value back?

Example from C++:

if (AutoITScriptValue == 1) then do this;

Thanks

E

Put an exit code on your Exit statement:

; Test1.au3, compiled to Test1.exe
Exit 3oÝ÷ Ù§Â+a¶¬jëh×6; Test2.au3
$RET = RunWait(@ScriptDir & "\Test1.exe")
MsgBox(64, "RET", "$RET = " & $RET)

$RET = RunWait(@ComSpec & " /c " & @ScriptDir & "\Test1.exe")
MsgBox(64, "RET", "$RET = " & $RET)

Note carefully the two different results coming from two different way of running the compiled script:

In the first you get $RET = 3 as expected because you ran the compile script directly.

In the second you get $RET = 1 because that the exit code of CMD.exe (or COMMAND.com), which in turn was running the compiled script as a parameter.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  

×