Wednesday, January 16, 2013

FYP2: Content Development 2


Finally uses the Java to execute my audiovisual that I did in Processing..

The outcome:

This the important code that i had used to execute my audiovisual and also it will help me to trigger the motion in Zone Trigger.


public void keyPressed(KeyEvent arg0) {
if (arg0.getKeyCode() != i)
{
try
{
f.dispose();
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_ESCAPE);
    robot.keyRelease(KeyEvent.VK_ESCAPE);
Runtime rt = Runtime.getRuntime();
if (arg0.getKeyCode() == 65)

{
i = arg0.getKeyCode();
if (p != null)
p.destroy();
 
rt.exec("taskkill /FI \"WINDOWTITLE eq Changk\"");
rt.exec("taskkill /FI \"WINDOWTITLE eq Construction\"");
p = rt.exec("First/imbi6.exe");


//window.close();
}
else if (arg0.getKeyCode() == 66)
{
i = arg0.getKeyCode();
if (p != null)
p.destroy();

rt.exec("taskkill /FI \"WINDOWTITLE eq imbi6\"");
rt.exec("taskkill /FI \"WINDOWTITLE eq Construction\"");
p = rt.exec("Second/Changk.exe");

}
else if(arg0.getKeyCode() == 67)
{
i = arg0.getKeyCode();

if (p != null)
p.destroy();

rt.exec("taskkill /FI \"WINDOWTITLE eq imbi6\"");
rt.exec("taskkill /FI \"WINDOWTITLE eq Changk\"");
p = rt.exec("Third/Construction.exe");


}


The screenshot:







No comments:

Post a Comment