Jump to content

au3record generated code is not runnable

Recommended Posts

I've used autoit before, but always coded from scratch.  I decided to try to run au3record, and I bet this is a 'dumb question', but why does write code that doesn't pass syntax check?

+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Owner\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Owner\AppData\Local\AutoIt v3\SciTE 
#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000409)  ---

Run('C:\Program Files (x86)\spacemonger\SpaceMonger.exe')
_WinWaitActivate("About SpaceMonger","SpaceMonger Version ")
#endregion --- Au3Recorder generated code End ---

That is exactly what the recorder created.  All the stuff on the first line causes the syntax checker to go into a convulsion, so I just deleted that.

But "_WinWaitActivate"?  With an underscore at the front of it?

There must be something that's gotten completely by me.  Anyone willing to put me on the right track?

Link to comment
Share on other sites

Good question, what version are you using?  V 3.1 does not do that whereas 3.3 does appear to do it ...

In the meantime you could save the file and use string replace to swap out the function names.

It appears related to a known bug that was closed: https://www.autoitscript.com/trac/autoit/ticket/2121

This ticket was closed when running it from scite.  That version of Au3record has an option to "generate internal functions" which would create a UDF for winwaitactivate.  However, I don't see that in version 3.3 of the standalone file that ships in the Extras.  Also, the standalone version from 3.1 does not seem to have that issue (it also has no option to generate internal functions).

I updated the ticket with a link to this thread.  In the meantime, standalone version 3.1, Scite with the option to generate internal UDFs, or a string replace will fix this for you.

Oh yeah, :>, you could also just include the UDF in your script.

Func _WinWaitActivate($title,$text,$timeout=0)
    If Not WinActive($title,$text) Then WinActivate($title,$text)


Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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

  • Create New...