Jump to content

Where to find key types?


Jueix

Recommended Posts

A simpler method would be to use:

  • keyboard.typeString("2"); for 2
  • keyboard.typeString(" "); for space

Another example:

    public void example() throws InterruptedException    {
       
            if (//something) {
                        keyboard.typeString("2");
                new ConditionalSleep(200, 200) {
                    @Override
                    public boolean condition() {
                        return //somethingelse;
                    }
                }.sleep();
            }
        }

or if you want to use widgets:

    public void example2() throws InterruptedException    {
        
        RS2Widget test= getWidgets().get(458, 1);
        
            if (test!= null && test.isVisible()) {
                        keyboard.typeString("2");
                new ConditionalSleep(200, 200) {
                    @Override
                    public boolean condition() {
                        return (//something);
                    }
                }.sleep();
            }
        }

 

Edited by Lol_marcus
Link to comment
Share on other sites

I would use 

getKeyboard().typeKey(KeyEvent.VK_SPACE);  and  getKeyboard().typeKey(KeyEvent.VK_2);

or 
getKeyboard().typeKey(' ');   and getKeyboard().typeKey('2');

I don't see why you would hardcode it with a value that is not 100% obvious (to you in a few weeks of not working on it and others tring to read your code).

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...