Loading...
Logo
Processing Forum

ON Screen Keyboard

in General Discussion  •  Other  •  7 months ago  
Hey can we create an application like windows onscreen keyboard in processing which can type in other applications like notepad, office. Please help me I have googled everything but didn't get anything.

Replies(5)

Re: ON Screen Keyboard

7 months ago
Yes, you can, I need to use Robot class from java and keyevents from processing.

Re: ON Screen Keyboard

7 months ago
tgptialves : Thank for replying :)
 Yes, I am aware of the robot class of keyboard events and mouse events, actually I have made an application similar  like onscreen keyboard but the problem is that when you click on the application the other application goes to background and has no effect on the other application.

So let me give you an example, suppose you have notepad running as first application but when you run the processing application it becomes the first application running on the screen and notepad goes to background and has no effect on the background application. Here windows onscreen keyboard does the same but same time it types in the other application
.
Chrisir : Thanks for replying. :) I have seen these application :)  but as I mention the problems can you guys help me out with this.

"I want to make an application which is running as a front / first application on screen but at the same time also affects the second application on the background"  
 


Re: ON Screen Keyboard

7 months ago
Hey anyone please solve my problem.  Here is the code, I have set the frame on top mode (it's optional) and I wanted that if I click mouse on the screen it should type "A" in the notepad (notepad is background application) but it is not working. As I click on the processing screen it becomes foreground application and notepad becomes background application and doesnt type anything in the notepad. PLEASE HELP 
/*-----------------------------------------------*/

import java.awt.Robot;
import java.awt.AWTException;
import java.awt.event.KeyEvent;
import com.sun.awt.AWTUtilities;
import java.awt.GraphicsDevice.*; 
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*; 

Robot robot;
void setup()
{
  size(200, 200);
   smooth();
  frame.removeNotify();
  frame.setAlwaysOnTop(true);
  try {
    robot = new Robot();
  }
  catch(AWTException a) {
    println(a);
    a.printStackTrace();
  }
}

void draw()
{
  background(255);
  if (mousePressed) {
    robot.keyPress(KeyEvent.VK_A);
    robot.keyRelease(KeyEvent.VK_A);
    println("Pressed");
  }
}

thanks everyone I got it worked  :) :) :)