Jump to content
Sign in to follow this  
SreeJayakumar

Crash on using Au3_Controlgettext

Recommended Posts

SreeJayakumar

Hi,

I am using AutoItx3.dll with Java.

But while using Au3_Controlgettext i am getting a JVM crash.

Code is as below:

public void AU3_ControlGetText(WString szTitle, WString szText, WString szControl,byte [] szControlText, int nBufSize);

autoitx.INSTANCE.AU3_ControlGetText( szTitle, szText, szControl,szControlText,nBufSize);

usage:

 byte[] controltext =  new byte[1024];
 autoitx.INSTANCE.AU3_ControlGetText( Title,Text,new WString("[CLASS:Edit;INSTANCE:52]"),controltext,1024);

can someone help me on this?

Edited by SreejaJayakumar

Share this post


Link to post
Share on other sites
wangzhengbo

Hi,

I am using AutoItx3.dll with Java.

But while using Au3_Controlgettext i am getting a JVM crash.

Code is as below:

public void AU3_ControlGetText(WString szTitle, WString szText, WString szControl,byte [] szControlText, int nBufSize);

autoitx.INSTANCE.AU3_ControlGetText( szTitle, szText, szControl,szControlText,nBufSize);

usage:

 byte[] controltext =  new byte[1024];

 autoitx.INSTANCE.AU3_ControlGetText( Title,Text,new WString("[CLASS:Edit;INSTANCE:52]"),controltext,1024);

can someone help me on this?

/**
     * Retrieves text from a control.
     * 
     * When using a control name in the Control functions, you need to add a
     * number to the end of the name to indicate which control. For example, if
     * there two controls listed called "MDIClient", you would refer to these as
     * "MDIClient1" and "MDIClient2".
     * 
     * @param title
     *            The title of the window to access.
     * @param text
     *            The text of the window to access.
     * @param controlId
     *            The control to interact with.
     * @return Returns text from a control if success, returns null if failed.
     */
    public static String getText(final String title, final String text,
            final String controlId) {
        final int bufSize = CONTROL_GET_TEXT_BUF_ZIZE;
        final CharBuffer controlText = CharBuffer.allocate(bufSize);
        getAutoItX()
                .AU3_ControlGetText(stringToWString(defaultString(title)),
                        stringToWString(text),
                        stringToWString(defaultString(controlId)), controlText,
                        bufSize);

        return hasError() ? Win32.getControlText(Control.getHandle_(title,
                text, controlId)) : Native.toString(controlText.array());
    }

Share this post


Link to post
Share on other sites
ManojThennarasu

Am Also facing the same prob while using ControlGetText command.. can anyone help us on this....

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  

×