@@ -0,0 +1,1412 @@
+/**%0AKhalid%0A*/%0Apackage org.sikuli.slides.listeners;%0A%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0A%0Aimport org.jnativehook.keyboard.NativeKeyEvent;%0Aimport org.jnativehook.keyboard.NativeKeyListener;%0Aimport org.sikuli.api.ScreenRegion;%0Aimport org.sikuli.slides.utils.Constants.DesktopEvent;%0A%0Apublic class GlobalKeyboardListeners implements NativeKeyListener, Runnable%7B%0A%09private ScreenRegion region;%0A%09private String textToBeTyped;%0A%09private DesktopEvent desktopEvent;%0A%09private AtomicBoolean isPerformed;%0A%09private StringBuilder typedText;%0A%09public GlobalKeyboardListeners(ScreenRegion region, String textToBeTyped, DesktopEvent desktopEvent)%7B%0A%09%09this.region=region;%0A%09%09this.textToBeTyped=textToBeTyped;%0A%09%09this.desktopEvent=desktopEvent;%0A%09%09this.isPerformed=new AtomicBoolean();%0A%09%09typedText=new StringBuilder();%0A%09%7D%0A%09@Override%0A%09public void nativeKeyPressed(NativeKeyEvent e) %7B%0A%09%7D%0A%0A%09@Override%0A%09public void nativeKeyReleased(NativeKeyEvent e) %7B%0A%09%7D%0A%0A%09@Override%0A%09public void nativeKeyTyped(NativeKeyEvent e) %7B%0A%09%09// TODO: Fix user's typing errors. Use OCR to make sure the user types the required text.%0A%09%09char ch=e.getKeyChar();%0A%09%09typedText.append(ch);%0A%09%09if(textToBeTyped.equalsIgnoreCase(typedText.toString()))%7B%0A%09%09%09this.isPerformed.set(true);%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public void run() %7B%0A%09%09while(!isPerformed.get())%7B%0A%09%09%09try%7B%0A%09%09%09%09Thread.sleep(1000);%0A%09%09%09%7D%0A%09%09%09catch(InterruptedException e)%7B%0A%09%09%09%09e.printStackTrace();%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

add global keyboard listener