Jump to content
Sign in to follow this  
TomH

How to get UDF Return values from shell command line calls to AutoIT?

Recommended Posts

TomH

Anybody know how to call an AutoIT UDF function from a shell command line?

I'm using Python as a controller for making AutoIT script calls, and that works fine until I want to get a return value from a function call, specifically, an array, where I want to get the array out of AutoIT and further process it in Python.

I tried putting a Return statement at the end of my au3 script that I called from Python, but AutoIT flagged "Return" as an invalid keyword, assumably because Returns aren't allowed in scripts.

I wrote AutoIT UDFs that do some processing, then return an array, but when I try to call those functions from outside AutoIT, I get the error "Unknown function name". This is what I'm doing:

C:\AutoIt3.exe /AutoIt3ExecuteLine "_MyUDFThatReturnsAnArray()"

Any ideas on how to make this work?

Thanks!

Tom

Share this post


Link to post
Share on other sites
Skruge

For UDF-dependent calls, write a script to build a quick .Au3 with the proper includes, and use /AutoIt3ExecuteScript with the desired parameters.

Also, Return is allowed only within functions. Use Exit to terminate with a return code.

You can only get a numeric value this way. To move array data, you'll need another method. (eg. Write to a file)


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites
TomH

For UDF-dependent calls, write a script to build a quick .Au3 with the proper includes, and use /AutoIt3ExecuteScript with the desired parameters.

Also, Return is allowed only within functions. Use Exit to terminate with a return code.

You can only get a numeric value this way. To move array data, you'll need another method. (eg. Write to a file)

Thanks for your reply, Skruge.

Drat! I need to move an array out of AutoIT, but don't want to write a file. Does anyone know if AutoIT's COM extensions can handle this scenario?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.