Jump to content

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


TomH
 Share

Recommended Posts

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...