Jump to content

Set focus on the current window without title and text


Recommended Posts

Hi Guys,

I have integrated autoIT with eclipse and i need to automate one desktop base application. But on the very first screen there is not title and text its a simple image with 4 fields. i need to know how can i set focus on the current window without title and text. 

Screen shot is mentioned. Please let me know how to set focus on window.

package Package;

import java.io.File;
import java.io.IOException;

import junit.framework.Assert;
import autoitx4java.AutoItX;

import com.jacob.com.LibraryLoader;

public class App
{
    public static void main( String args[] ) throws InterruptedException
    {
        String jacobDllVersionToUse;
        
        //String jacobDllVersionToUse;

        if (jvmBitVersion().contains("32"))
        {
        jacobDllVersionToUse = "jacob-1.18-x86.dll";
        }
        else {
                
            
        jacobDllVersionToUse = "jacob-1.18-x64.dll";
        }
            
        File file = new File("lib", jacobDllVersionToUse);
        System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
        
        AutoItX x = new AutoItX();    
    //Launched BRMFO application
    //    String $hWnd = "";            
        boolean i;
    
    x.run("C:\\Program Files\\Craft Silicon\\Bankers Realm MFO\\Bin\\BRealmMFO_R13_89.exe");
    Thread.sleep(1000);
    String brmfo = "x.run(C:\\Program Files\\Craft Silicon\\Bankers Realm MFO\\Bin\\BRealmMFO_R13_89.exe)";
    Thread.sleep(12000);
    x.winActivate("brmfo");
    brmfo = x.winGetHandle("[ACTIVE]");
    //Assert.assertTrue(x.winExists("brmfo"));

//    i = x.mouseMove(182, 184);
    //x.send("{ENTER}");
    System.out.println("started");
    x.controlClick("", "", "");
    x.send("TAB");
    //x.send("{ALT}n");
    System.out.println("TAB pressed");
    Thread.sleep(3000);
    x.send("8008");
    System.out.println("Enter ID");
    x.send("{TAB}");    
    Thread.sleep(3000);
    x.send("TAB");
    Thread.sleep(3000);
    x.send("112925");
    Thread.sleep(3000);
    x.send("Password0");
    Thread.sleep(3000);

        
    }    
private static String jvmBitVersion() {
    
    return System.getProperty("sun.arch.data.model");
}
    }

brmfoscreen.docx

Edited by YashShrivastava
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...