Skip to content
Snippets Groups Projects
Commit 6a0df699 authored by NikolaBabic's avatar NikolaBabic
Browse files

Added ability to launch applications from path

parent 82af72fb
No related branches found
No related tags found
2 merge requests!65Prototype,!51Feature mouse speed
......@@ -16,6 +16,7 @@ public class OSInterface implements HotkeyDetector, HotkeyRegistration, InputEmu
private static OSInterface instance = null;
private User32 user32 = User32.INSTANCE;
Runtime runtime;
private WinDef.HWND hwnd;
private HashMap<Integer, Hotkey> registeredKeys;
private HashMap<Integer, Integer> pressedKeys;
......@@ -33,6 +34,7 @@ public class OSInterface implements HotkeyDetector, HotkeyRegistration, InputEmu
registeredKeys = new HashMap<>();
pressedKeys = new HashMap<>();
msg = new WinUser.MSG();
runtime = Runtime.getRuntime();
hotkeyRegQueue = new LinkedBlockingQueue<>();
hotkeyUnRegQueue = new LinkedBlockingQueue<>();
keySendQueue = new LinkedBlockingQueue<>();
......@@ -182,6 +184,10 @@ public class OSInterface implements HotkeyDetector, HotkeyRegistration, InputEmu
@Override
public boolean setMouseSpeed(int speed) {
if (speed < 1 || speed > 20)
return false;
return false;
}
......@@ -199,6 +205,16 @@ public class OSInterface implements HotkeyDetector, HotkeyRegistration, InputEmu
return pressed;
}
public boolean launchApplication(String path) {
try {
runtime.exec(path);
return true;
} catch (Exception e) {
System.out.println("Error launching applications: " + e.getMessage());
return false;
}
}
@Override
public void sendKey(int keyCode, boolean release) {
if (keyCode > 0 && keyCode < 255) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment