Topic
  • 2 replies
  • Latest Post - ‏2013-11-06T11:47:32Z by ChrisGF
ChrisGF
ChrisGF
163 Posts

Pinned topic keys instead of mouse

‏2013-10-31T10:39:16Z |

Hi!

I have a lot of scripts in my RFT and would like to get and idea and maybe an exaple from you how to change my code so instead of mouse events keyboards are used.

I have already a util class

public classHelperKeySet {

public static final String F5 = "{F5}";

public static final String TAB = "{TAB}";

public static final String ENTER = "{ENTER}";

public static final String SHIFT = "+";

public static final String CTRL = "^";

public static final String ALT = "%";

 

public static final String ShiftPress(String keys) {

return SHIFT + "(" + keys + ")";

}

public static finalString CtrlAltPress(String keys) {

return CTRL + ALT + "(" + keys + ")";

}

public static finalString CtrlShiftPress(String keys) {

return CTRL + SHIFT + "(" + keys + ")";

}

 

public static final String CtrlPress(String keys) {

return CTRL + "(" + keys + ")";

}

 

public static final String AltPres(String keys) {

return ALT + "(" + keys + ")";

}

 

public static final String singlePressCtrl() {

return ALT;

}...

 

but I don't exactly know what would be the easiest way to change my existing scripts so the keyboard is triggered in the script instead of the mouse.

Any idea? Suggestion? Example?

Thank you in advance,

K

 

  • Stonger
    Stonger
    33 Posts

    Re: keys instead of mouse

    ‏2013-11-05T16:04:22Z  

    I usually use the IWindow interface if I want to use the keyboard to interact with a window.

     

    IWindow window = RationalTestScript.getScreen().getActiveWindow();
    if (window != null)
    {
       window.inputKeys("keys");
    }
  • ChrisGF
    ChrisGF
    163 Posts

    Re: keys instead of mouse

    ‏2013-11-06T11:47:32Z  
    • Stonger
    • ‏2013-11-05T16:04:22Z

    I usually use the IWindow interface if I want to use the keyboard to interact with a window.

     

    IWindow window = RationalTestScript.getScreen().getActiveWindow();
    if (window != null)
    {
       window.inputKeys("keys");
    }

    This looks good!

    Thank you for your idea!!!

    K