TomH Posted August 28, 2008 Posted August 28, 2008 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
Skruge Posted August 28, 2008 Posted August 28, 2008 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]
TomH Posted August 28, 2008 Author Posted August 28, 2008 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now