Read data from GUI - java

I have a general question :
If I got a GUI (e.g. metaTrader => online broker), is it possible to read data from this GUI using java?
My idea:
Using the java.awt.robot and do something like:
package java_robot;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
public class java_robot {
public static void main(String[] args) {
try {
// create class
Robot robot = new Robot();
// wait 1 sec
robot.delay(1000);
// move mouse to wanted area
robot.mouseMove(x, y);
}
// mark an area, copy it and save in file..
} catch (AWTException e) {
e.printStackTrace();
}
}
}
Is this idea good, or do you know other solutionĀ“s to read data from a GUI?
(working on mac)

You can use the Robot#createScreenCapture() method here.
Robot r = new Robot();
// Capture area
int width = ...
int height = ...
Rectangle area = new Rectangle(width, height);
BufferedImage image = r.createScreenCapture(area);
// Save to file
ImageIO.write(image, "png", new File("/screenshot.png"));
Alternatively, if metaTrader loads its data from internet, you can sniffe its traffic and determine how and where its data comes. Then you could try to mimic its internet calls and get the data yourself as long as it is not ciphered.
You could also build a proxy in Java and ask metaTrader to use this proxy. All data requested by metaTrader would go through your proxy. This can give you a chance to read the data... again as long as it is not ciphered.
The image below illustrates how things work. Alice plays the role of meaTrader. Bob is the source of data of metaTrader. Proxy is your Java app.
You can find a simple implementation of such a proxy here: http://www.java2s.com/Code/Java/Network-Protocol/Asimpleproxyserver.htm.
References:
Proxy server

Related

IBM PCOMM Automation using Java

I am trying to automate IBM PComm Application using HACL Java library classes .
I have succeeded in establishing connection to the pcom session as well as set /get cursor position and extracting text from the current cursor position on the application's screen. But unable to put / send text at a desired cursor position on the screen. Kindly help in resolving this issue .Please find the code for establishing connection and fetch text from the screen as below :
import java.util.Properties;
import com.ibm.eNetwork.ECL.ECLConnMgr;
import com.ibm.eNetwork.ECL.ECLConnection;
import com.ibm.eNetwork.ECL.ECLErr;
import com.ibm.eNetwork.ECL.ECLField;
import com.ibm.eNetwork.ECL.ECLFieldList;
import com.ibm.eNetwork.ECL.ECLPS;
import com.ibm.eNetwork.ECL.ECLSession;
import org.ohio.iOhioScreen;
public class Pcom {
public static void main(String[] args) throws ECLErr {
try{
System.loadLibrary("pcseclj");
Properties prop = new Properties();
// prop.put("SESSION_VT_LOCAL_ECHO ", "true");
prop.put("SESSION_HOST", "C:\\Mainframe\\A.ws"); // works OK
prop.put("SESSION_WIN_STATE", "MAX");
prop.put("SESSION_VT_KEYPAD ", "SESSION_VT_KEYPAD_APPL");
prop.put("SESSION_VT_LOCAL_ECHO", "SESSION_VT_LOCAL_ECHO_ON");
ECLSession session = new ECLSession(prop);
session.StartCommunication(); //works OK
Thread.sleep(5000);
session.connect(); //works OK
ECLFieldList fieldList = session.GetPS().GetFieldList();
session.GetPS().SetCursorPos(18, 044); //works OK
/session.GetPS().SetString("some_text"); // does not work
for(int i=0;i<fieldList.size();i++){ //works OK
//System.out.println("field ======================= "+fieldList.GetFirstField(i).getAttribute());
ECLPS ps=session.GetPS();
System.out.println(session.GetName()); //works Ok
session.GetPS().SetCursorPos(17, 44); //works OK
session.GetPS().SendKeys("some_text",17,44); // does not work ,17,44 are co ordinate positions pn screen
System.out.println(session.GetConnType()); // works ok
ps.SendKeys("some_text"); //does not work
/* ------------ does not work-------------
fieldList.FindField(17, 44).SetText("some_text");
fieldList.FindField(17, 44).SetString("some_text");
fieldList.FindField(18, 44).setString("some_text");
*/
System.out.println(fieldList.FindField(17, 44).GetLength()); // works ok
System.out.println(fieldList.FindField(17, 28).getString()); //works ok
}
catch(Exception e)
{
System.out.println(e);
}
}
}
I had similar issue before while automating PCOMM with Cucumber to make some automated regression test framework "middleware" for green screen in BDD style.
Thing is that SetCursorPos does not send new cursor position to the Host System (we use IBM i). Telnet5250 protocol is quite complicated but in few words you have two separate buffers - one on the client system (Terminal Emulator) and second on the Host System (telnet server). Usually they are sychronized, but in some circumstances they are not which leads to undefined behavior.
Litle hack is to send up and down arrow keys like this:
SendKeys("<Up>");
SendKeys("<Down>");
This will force PComm to send new cursor position to server and sync screen buffers.

OpenCV in Java for Image Filtering

i have java codes from Tutorials Point. This code for Robinson filter.
package improctry2;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;
public class ImProcTry2 {
public static void main( String[] args )
{
try {
int kernelSize = 9;
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
Mat source = Highgui.imread("grayscale.jpg",
Highgui.CV_LOAD_IMAGE_GRAYSCALE);
Mat destination = new Mat(source.rows(),source.cols(),source.type());
Mat kernel = new Mat(kernelSize,kernelSize, CvType.CV_32F){
{
put(0,0,-1);
put(0,1,0);
put(0,2,1);
put(1,0-2);
put(1,1,0);
put(1,2,2);
put(2,0,-1);
put(2,1,0);
put(2,2,1);
}
};
Imgproc.filter2D(source, destination, -1, kernel);
Highgui.imwrite("output.jpg", destination);
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}
This is is my image input, and this the output (i can't post the pictures because i'm new in stackoverflow).
As you can see, the image turn into black and nothing appears. I'm using Netbeans IDE 8.0 and i already put the OpenCV library in Netbeans. I also run another OpenCV Java codes and they work very well. And i also run this code in Eclipse but the result is same.
Anybody can help me?
Thank You
You create a 9x9 kernel matrix, but then fill only a 3x3 submatrix of it, leaving other elements unititialized. To fix it, just change:
int kernelSize = 9;
to:
int kernelSize = 3;
Your code actually works in the newest Opencv (3.0 beta), but those unititialized elements break it in older versions (I checked 2.4.10). To print elements of a matrix use:
System.out.println(kernel.dump());
PS.
Welcome to stackoverflow. :)

Image resizing Java

I have a weird problem with resizing images and can't figure out what I'am doing wrong. I've read lots of posts wwhich basically have the same code as I:
(I use the java library Scalr)
File image = new File("myimage.png");
File smallImage = new File("myimage_s");
try {
BufferedImage bufimage = ImageIO.read(image);
BufferedImage bISmallImage = Scalr.resize(bufimage, 30); // after this line my dimensions in bISmallImage are correct!
ImageIO.write(bISmallImage, "png", smallImage); // but my smallImage has the same dimension as the original foto
} catch (Exception e) {}
Can someone tell me what I am doing wrong?
I do not see anything wrong with your code.
I pulled it into a quick test project in Eclipse targeting Java SE 7 and using imgscalr 4.2 on Windows 7 Pro 64-bit:
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import org.imgscalr.Scalr;
public class ScalrTest {
public static void main(String[] args) {
File image = new File("myimage.png");
File smallImage = new File("myimage_s.png"); // FORNOW: added the file extension just to check the result a bit more easily
// FORNOW: added print statements just to be doubly sure where we're reading from and writing to
System.out.println(image.getAbsolutePath());
System.out.println(smallImage.getAbsolutePath());
try {
BufferedImage bufimage = ImageIO.read(image);
BufferedImage bISmallImage = Scalr.resize(bufimage, 30); // after this line my dimensions in bISmallImage are correct!
ImageIO.write(bISmallImage, "png", smallImage); // but my smallImage has the same dimension as the original foto
} catch (Exception e) {
System.out.println(e.getMessage()); // FORNOW: added just to be sure
}
}
}
With the following myimage.png...
..., it produced the following myimage_s.png:
Maybe there is an environmental issue that's hamstringing your code, but possibilities that come to mind would come with a clear error.

Enlarging image using GD results in dismal quality compared to Scalr (JAVA)

I have been dealing with very small images and I have tried to discover the best way to increase them. I compared two different sources: imagecopyresampled (PHP: http://www.php.net/manual/en/function.imagecopyresampled.php) versus Scalr (JAVA: How to resize images in a directory?). I am including the codes that I am using below for the sake of completeness, but they are strongly based on other threads or sites referenced above. If someone thinks that I should remove, I will do that! In both sources it seems that the algorithm used to deal with the issue seems to be the same: Bicubic interpolation. However, in the case of the JAVA source, the quality of the resized image is MUCH MUCH better in my implementation (it is not even possible to compare). Am I doing something wrong when I am using the PHP source? If not, does anyone can explain me the difference between them?
JavaCode:
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import static org.imgscalr.Scalr.*;
public class App2 {
public static void main(String[] args) throws IOException {
for (File sourceImageFile : new File("imgs").listFiles()) {
if (sourceImageFile.getName().endsWith(".jpg"))
res(sourceImageFile.getAbsolutePath());
}
}
public static void res(String arg) throws IOException {
File sourceImageFile = new File(arg);
BufferedImage img = ImageIO.read(sourceImageFile);
BufferedImage thumbnail = resize(img, 500);
thumbnail.createGraphics().drawImage(thumbnail, 0, 0, null);
ImageIO.write(thumbnail, "jpg", new File("resized/" + sourceImageFile.getName()));
}
}
PHP code:
<?php
// The file
$filename = 'photos/thePhoto.jpg';
// Set a maximum height and width
$width = 250;
$height = 250;
// Content type
header('Content-Type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
?>
Just to be clear, in the JAVA code, I have to keep the images in a folder. In the PHP code, I provide the name of the file. Off course, I compared exactly the same image. Furthermore, both codes are running without any kind of problem.
![PHP versus Java (in this order)]: http://www.facebook.com/media/set/?set=a.122440714606196.1073741825.100005208033163&type=1&l=55d93c4969

Taking screenshot in Java (Robot, code working but not with external full screen application)

I am using the following code for taking a screenshot:
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(screenRectangle);
ImageIO.write(image,"png", file);
This code is running good. It takes screen shots of my desktop when I run the program, etc.
However, when I try to run first some game, application in full screen, it doesn't work properly. It renders either black screen, either the same "initial" picture.
Is this problem known, and how to fix this please?
Second question :
Is this possible to simulate some "Print Screen" key we can have on keybord in order to solve this problem? Because I can use Print Screen key when the application is launched in full screen, and when I paste I got my screen. (Like this but in java : Copy the contents of the screen or the active window ? )
Thank you in advance for your help.
EDIT : Andrew Thompson was kind to propose me the following code that will be a good first step to solve this problem :
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.event.KeyEvent;
public class ScreenshotUsingPrintScreen {
public static void main(String[] args) throws Exception {
int i = KeyEvent.VK_PRINTSCREEN;
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
DataFlavor[] flavors = cb.getAvailableDataFlavors();
System.out.println("Before: ");
for (DataFlavor flavor : flavors) {
System.out.println(flavor);
}
// get the screenshot
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_PRINTSCREEN);
robot.delay(40);
robot.keyRelease(KeyEvent.VK_PRINTSCREEN);
robot.delay(40);
cb = Toolkit.getDefaultToolkit().getSystemClipboard();
flavors = cb.getAvailableDataFlavors();
System.out.println("After: ");
for (DataFlavor flavor : flavors) {
System.out.println(flavor);
}
}
}
It compiles well but however I receive the following error while then running it.
Before:
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-text-encoding;representationclass=[B]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.Reader]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.CharBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[C]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.InputStream;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.ByteBuffer;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[B;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.InputStream;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.ByteBuffer;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[B;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.InputStream;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[B;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.InputStream;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[B;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.InputStream;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[B;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.io.InputStream;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/html;representationclass=[B;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.Reader]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.CharBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[C]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=unicode]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=US-ASCII]
Exception in thread "main" java.lang.IllegalStateException: cannot open system clipboard
at sun.awt.windows.WClipboard.openClipboard(Native Method)
at sun.awt.datatransfer.SunClipboard.getClipboardFormatsOpenClose(SunClipboard.java:332)
at sun.awt.datatransfer.SunClipboard.getAvailableDataFlavors(SunClipboard.java:172)
at zipprotected.threadsTest.ScreenshotUsingPrintScreen.main(ScreenshotUsingPrintScreen.java:36)
Java Result: 1
Is this problem known,..
Yes. Typically it is caused by moving the rendering down to the level of the graphics card itself (largely side-stepping the OS).
..and how to fix this please?
AFAIU it cannot be fixed. Even native screenshot apps. will not manage to gain a screenshot of such a rendering.
Is this possible to simulate some "Print Screen" key in order to solve this problem?
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.event.KeyEvent;
public class ScreenshotUsingPrintScreen {
public static void main(String[] args) throws Exception {
int i = KeyEvent.VK_PRINTSCREEN;
Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
DataFlavor[] flavors = cb.getAvailableDataFlavors();
System.out.println("Before: ");
for (DataFlavor flavor : flavors) {
System.out.println(flavor);
}
// get the screenshot
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_PRINTSCREEN);
robot.delay(40);
robot.keyRelease(KeyEvent.VK_PRINTSCREEN);
robot.delay(40);
cb = Toolkit.getDefaultToolkit().getSystemClipboard();
flavors = cb.getAvailableDataFlavors();
System.out.println("After: ");
for (DataFlavor flavor : flavors) {
System.out.println(flavor);
}
}
}
Output
Before:
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-text-encoding;representationclass=[B]
java.awt.datatransfer.DataFlavor[mimetype=text/rtf;representationclass=java.io.InputStream]
java.awt.datatransfer.DataFlavor[mimetype=text/rtf;representationclass=java.nio.ByteBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/rtf;representationclass=[B]
java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.Reader]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.lang.String]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.CharBuffer]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[C]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=unicode]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-8]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16BE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16LE]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=ISO-8859-1]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=windows-1252]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=windows-1252]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=windows-1252]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=US-ASCII]
After:
java.awt.datatransfer.DataFlavor[mimetype=image/x-java-image;representationclass=java.awt.Image]
The solution to your problem is right in front of you, try thinking differently. You don't need to use PrtScr function because almost all platforms (games) have an inbuilt screenshot function.
In Steam for example, this includes all games played through steam, F12 is used to take a screentshot. Instead of using PrtScr, use F12 in your code, the file is automatically stored, use that file, do what ever you like with it.
I know this is a bit late, but I hope it helps you with your project.
Edit to add exact code:
if (e.getKeyCode() == NativeKeyEvent.VC_0) {
Robot robot = null;
try {
robot = new Robot();
robot.keyPress(KeyEvent.VK_F12);
robot.keyRelease(KeyEvent.VK_F12);
}
catch (AWTException ex) {
Logger.getLogger(JavaApplication6.class.getName()).log(Level.SEVERE, null, ex);
}
}
This is in relation to steam, basically when you press "0", your program will simulate the input of F12, this will take a screenshot, which will be stored in "STEAM\userdata\137637106\760\remote\570\screenshots" directory.
Hope this helps.

Categories

Resources