Jump to content

Instant Keyboard Typer


glide

Recommended Posts

I need help finding a keyboard that types instantly. I used one in the past but it doesn't seem to work anymore and I'm not sure what exactly the issue is. It can be found in this thread here:

The solution (which worked in the past) was given by @Explv

 

Thank you.

Edited by glide
Link to comment
Share on other sites

private void typeStringInstant(String output){

    for(int i = 0; i < output.length(); i ++){

        char c = output.charAt(i);
        int code = KeyEvent.getExtendedKeyCodeForChar(c);
        // Type the character
        getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
    }

    // Press enter
    getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1);
    // Release enter
    getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000', 1);
}

 

This works almost fine for me. You have to change one thing with the Press enter and release enter. I bet the method generateBotKeyEvent was updated because it shouldn't have the 1 at the end.

Instead it should be getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000');

and getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000');

Of course there is also some natural delay between when the chat is sent and when it appears, but it instantly types and sends the message.

The code I tested this with and worked is here:

 

package net.chatbox.instantchat;

import java.awt.event.KeyEvent;

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Helper", info = "Instant Chat", logo = "", name = "Instant Chatter", version = 0)
public class InstantChat extends Script{

	@Override
	public int onLoop() throws InterruptedException {
		return 100;
	}

	public void onStart(){
		typeStringInstant("This probably will work just fine for me");
	}
	
	public void onExit() {
		typeStringInstant("Double-checking this");
	}
	
	private void typeStringInstant(String output)
	{

	    for(int i = 0; i < output.length(); i++)
	    {

	        char c = output.charAt(i);
	        int code = KeyEvent.getExtendedKeyCodeForChar(c);
	        // Type the character
	        getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
	    }

	    // Press enter
	    getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000');
	    // Release enter
	    getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000');
	}
	
	
	
	
	
	
	
	
}

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, jakealaka9 said:

private void typeStringInstant(String output){

    for(int i = 0; i < output.length(); i ++){

        char c = output.charAt(i);
        int code = KeyEvent.getExtendedKeyCodeForChar(c);
        // Type the character
        getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
    }

    // Press enter
    getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1);
    // Release enter
    getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000', 1);
}

 

This works almost fine for me. You have to change one thing with the Press enter and release enter. I bet the method generateBotKeyEvent was updated because it shouldn't have the 1 at the end.

Instead it should be getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000');

and getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000');

Of course there is also some natural delay between when the chat is sent and when it appears, but it instantly types and sends the message.

The code I tested this with and worked is here:

 


package net.chatbox.instantchat;

import java.awt.event.KeyEvent;

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Helper", info = "Instant Chat", logo = "", name = "Instant Chatter", version = 0)
public class InstantChat extends Script{

	@Override
	public int onLoop() throws InterruptedException {
		return 100;
	}

	public void onStart(){
		typeStringInstant("This probably will work just fine for me");
	}
	
	public void onExit() {
		typeStringInstant("Double-checking this");
	}
	
	private void typeStringInstant(String output)
	{

	    for(int i = 0; i < output.length(); i++)
	    {

	        char c = output.charAt(i);
	        int code = KeyEvent.getExtendedKeyCodeForChar(c);
	        // Type the character
	        getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
	    }

	    // Press enter
	    getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000');
	    // Release enter
	    getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000');
	}
	
	
	
	
	
	
	
	
}

 

Thank you so much! It works perfectly.

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