Robot Class
print.jsp
<%@page import="java.awt.*"%>
<%@page import java.awt.Robot;"%>
<%@page import java.awt.event.KeyEvent; "%>
<%@page import java.io.File;"%>
<%@page import javax.swing.filechooser.*;"%>
<%! Robot robot;
//JFileChooser chooser;
%>
<%
try
{
robot = new Robot();
//chooser = new JFileChooser();
}
catch(Exception e){}
%>
<%!
void move()
{
try{
/*File obj = new File("Invoice.xls");
chooser.setSelectedFile(obj);
chooser.ensureFileIsVisible(obj);
Boolean b = chooser.accept(obj);
System.out.println(b);
if(b)
{
int x = chooser.APPROVE_OPTION;
System.out.println("Hi");
}*/
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\excel\\createCell.xls");
robot.delay(5000);
out.println("Hey");
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_P);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_P);
}
catch(Exception e1)
{
e1.printStackTrace();
}
}
%>
<%
out.println("<input type='button' onclick='"+move()+"'>");
%>
//robot.delay(3000);
//robot.mouseMove(500,500);
//<% out.println("<BR/><FONT>MOVED FIRST!</FONT>"); %>
//robot.delay(3000);
//robot.mouseMove(100,100);
//<% out.println("<BR/><FONT>MOVED TWICE!</FONT>"); %>
//int y = 1;
//while(y==1)
//{
//Robot robot = new Robot();
// Creates the delay of 5 sec so that you can open notepad before
// Robot start writting
Hello Sir in this code its giving me error that print.jsp(1,15) equal symbol expected i dont know wdy this error is coming but please help out of this problem and it should give automatic printing option???
Please reply me sir as soon as possible??
Thank you sir.
View Answers
May 12, 2010 at 11:12 AM
Hi Friend,
We have modified your code:
<%@page import="java.awt.*"%>
<%@page import=" java.awt.Robot"%>
<%@page import= "java.awt.event.KeyEvent"%>
<%@page import=" java.io.File"%>
<%@page import=" javax.swing.filechooser.*"%>
<%! Robot robot;
//JFileChooser chooser;
%>
<%
try{
robot = new Robot();
//chooser = new JFileChooser();
}
catch(Exception e){}
%>
<%!
void move(){
try{
/*File obj = new File("Invoice.xls");
chooser.setSelectedFile(obj);
chooser.ensureFileIsVisible(obj);
Boolean b = chooser.accept(obj);
System.out.println(b);
if(b){
int x = chooser.APPROVE_OPTION;
System.out.println("Hi");
}*/
//Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\excel\\createCell.xls");
robot.delay(5000);
System.out.println("Hey");
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_P);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyRelease(KeyEvent.VK_P);
}
catch(Exception e1){
e1.printStackTrace();
}
}
%>
<script>
function hello(){
<%
move();
%>
}
</script>
<input type='button' onclick="hello();">
<%//robot.delay(3000);
//robot.mouseMove(500,500);
// out.println("<BR/><FONT>MOVED FIRST!</FONT>");
//robot.delay(3000);
//robot.mouseMove(100,100);
//out.println("<BR/><FONT>MOVED TWICE!</FONT>");
//int y = 1;
//while(y==1)
//{
//Robot robot = new Robot();
// Creates the delay of 5 sec so that you can open notepad before
// Robot start writting
%>
Thanks
Related Tutorials/Questions & Answers:
robot classrobot class please send me uses of
robot class and some examples using
robot class robot classrobot class i also want the uses of
robot classes its applications in the programming.
where exactly
robot class is useful.
why is it necessary... java.awt.* has provide the
class Robot. It gives the java program much power. It can
Advertisements
Robot class - Java BeginnersRobot class hi!!!
wenever i execute this code i get the error...!
import java.lang.*;
import java.awt.*;
public
class Robot04{
public...{
Robot robot = new
Robot();
robot.mouseMove(1005,10);
robot.delay(2000
Robot Class - JSP-ServletRobot Class print.jsp...);
//
//int y = 1;
//while(y==1)
//{
//
Robot robot = new
Robot...
//
Robot start writting
Hello Sir in this code its giving me error
classclass Is a
class a subclass of itself
class is a
class to represent a country in medal tally. It has an attribute of
country...
medals. In this
class, you should also define constructors, and assessor, mutator
methods.
Task 2
MedalTally.java is a
class to model a medal tally, containing
Class Class, Object and Methods
Class : Whatever we can see in this world all
the things... is termed as
a
class. All the
objects are direct interacted with its
class ModuleNotFoundError: No module named 'robot'ModuleNotFoundError: No module named '
robot' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
robot'
How to remove the ModuleNotFoundError: No module named '
robot'
ModuleNotFoundError: No module named 'cord-robot'ModuleNotFoundError: No module named 'cord-
robot' Hi,
My Python... 'cord-
robot'
How to remove the ModuleNotFoundError: No module named 'cord-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'cord-robot'ModuleNotFoundError: No module named 'cord-
robot' Hi,
My Python... 'cord-
robot'
How to remove the ModuleNotFoundError: No module named 'cord-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'py_robot'ModuleNotFoundError: No module named 'py_
robot' Hi,
My Python..._
robot'
How to remove the ModuleNotFoundError: No module named 'py_
robot... to install padas library.
You can install py_
robot python with following
ModuleNotFoundError: No module named 'robot-cli'ModuleNotFoundError: No module named '
robot-cli' Hi,
My Python... '
robot-cli'
How to remove the ModuleNotFoundError: No module named '
robot... have to install padas library.
You can install
robot-cli python with following
ModuleNotFoundError: No module named 'robot-grpc'ModuleNotFoundError: No module named '
robot-grpc' Hi,
My Python... '
robot-grpc'
How to remove the ModuleNotFoundError: No module named '
robot-grpc' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'robot-nps'ModuleNotFoundError: No module named '
robot-nps' Hi,
My Python... '
robot-nps'
How to remove the ModuleNotFoundError: No module named '
robot... have to install padas library.
You can install
robot-nps python with following
ModuleNotFoundError: No module named 'ciag-robot'ModuleNotFoundError: No module named 'ciag-
robot' Hi,
My Python... 'ciag-
robot'
How to remove the ModuleNotFoundError: No module named 'ciag-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'cord-robot'ModuleNotFoundError: No module named 'cord-
robot' Hi,
My Python... 'cord-
robot'
How to remove the ModuleNotFoundError: No module named 'cord-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'cord-robot'ModuleNotFoundError: No module named 'cord-
robot' Hi,
My Python... 'cord-
robot'
How to remove the ModuleNotFoundError: No module named 'cord-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'M_robot'ModuleNotFoundError: No module named 'M_
robot' Hi,
My Python..._
robot'
How to remove the ModuleNotFoundError: No module named 'M_
robot... to install padas library.
You can install M_
robot python with following command
ModuleNotFoundError: No module named 'py_robot'ModuleNotFoundError: No module named 'py_
robot' Hi,
My Python..._
robot'
How to remove the ModuleNotFoundError: No module named 'py_
robot... to install padas library.
You can install py_
robot python with following
ModuleNotFoundError: No module named 'timi-robot'ModuleNotFoundError: No module named 'timi-
robot' Hi,
My Python... 'timi-
robot'
How to remove the ModuleNotFoundError: No module named 'timi-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'alva-robot'ModuleNotFoundError: No module named 'alva-
robot' Hi,
My Python... 'alva-
robot'
How to remove the ModuleNotFoundError: No module named 'alva-
robot' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'ddm-robot'ModuleNotFoundError: No module named 'ddm-
robot' Hi,
My Python... 'ddm-
robot'
How to remove the ModuleNotFoundError: No module named 'ddm-
robot' error?
Thanks
Hi,
In your python environment you
Super class of an Exception classSuper
class of an Exception class hello,,,
What is super
class of an Exception
class?
hii,,ADS_TO_REPLACE_1
the super
class of an exception is throwable
class. and the super
class of an throwable
class Web robot to find the best dealWeb
robot to find the best deal Build a Web
robot that looks at certain retailers to find the best deal. For example, if you want to buy a textbook then you can give to the
robot. The
robot would visit the famous online book
Class
Class
This section explores the concept of
a
class in reference to object oriented programming techniques. A
class defines
the properties of objects and methods used