Jump to content

newbee: Can't get simple Au3Recorder's generated code to work


dekaya
 Share

Recommended Posts

Hi

I am brand new

made a couple of very simple hand entered scripts. and I can see the potential is unlimited.

However I missed the answer to my question in the FAQ's.

I must have some sort of compatibility mix-up because the recorder generated code is not the

same code that the autoit engine recognizes.

Here are the facts:

Here is the sample code of an extremely simple script.

Click on a desktop program and start it!

That's it.

//----------------------------------------------

;System:

;WinXP SP2

;Using:...

;SciTE

;Version 2.28

; Aug 7 2011 13:34:43

;by Neil Hodgson.

; Updated: Valik & Jos

;Check the SciTE4AutoIt3 Homepage for Updates

;December 1998-June 2011.

;The latest AutoIt3 Ver 3.3.8.0

; hand entered Code below works

Run("D:Download XPSecurityHouse and CarRVH1016 H264Remote DesktopDVRemoteDesktop.exe")

WinWaitActive("Login")

ControlSend("Login", "", "[CLASS:Edit; INSTANCE:1]", "192.168.1.252")

; The AU3Recorder's generated code below doesn't work.

;Obviously there are syntax differences.

;But this is just an example

;There are many things that don't work with the recorder

#region ---Au3Recorder generated code Start (v3.3.7.0) ---

_WinWaitActivate("Program Manager","")

MouseClick("left",122,583,2)

#endregion --- Au3Recorder generated code End ---

//----------------------------------------------

Can anyone give me guidance.

Thanks

Dekaya

Edited by dekaya
Link to comment
Share on other sites

The recorder is simplistic in that it goes by the text in window titlebars to identify the window. The code you wrote is more accurate and will work better. I think the recorder is just form complete newbies who don't know what they are doing.

#include <ByteMe.au3>

Link to comment
Share on other sites

For anyone else who might wonder on the further details of the differences between the hand-coded script and recorded script:

Along with what sleepydvdr mentioned about the title bar, and possibly the most trouble-prone part of the recorder's script in this case, is the MouseClick. What coordinate a control happens to sit at when it's clicked on is what the recorder can capture but that changes every time the window is moved around and can often not be predicted with any accuracy from one launch of an application to the next. The basic and more accurate methods of direct interaction with the control (depending on the need, but likely ControlClick for a simple mouse click if that left click was clicking on a button) require information like the window title or captured current handle of a window (if identified earlier in the script) and control's identifier or captured handle in order to directly interact with them (as in your example where you have utilized ControlSend with the window title text and controlID).

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...