error check
This commit is contained in:
parent
511de720d3
commit
a28718408b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target/
|
@ -12,6 +12,7 @@ import com.sun.jna.platform.WindowUtils;
|
|||||||
import com.sun.jna.platform.win32.WinDef.LPARAM;
|
import com.sun.jna.platform.win32.WinDef.LPARAM;
|
||||||
import com.sun.jna.platform.win32.WinDef.WPARAM;
|
import com.sun.jna.platform.win32.WinDef.WPARAM;
|
||||||
import com.sun.jna.platform.win32.WinUser;
|
import com.sun.jna.platform.win32.WinUser;
|
||||||
|
import static com.sun.jna.Native.getLastError;;
|
||||||
|
|
||||||
public class Input {
|
public class Input {
|
||||||
|
|
||||||
@ -44,7 +45,8 @@ public class Input {
|
|||||||
public static void press(char c, int timeInMs, String windowName) {
|
public static void press(char c, int timeInMs, String windowName) {
|
||||||
DesktopWindow window = WindowUtils.getAllWindows(true).stream()
|
DesktopWindow window = WindowUtils.getAllWindows(true).stream()
|
||||||
.filter(w -> w.getTitle().toLowerCase().contains(windowName.toLowerCase())).findFirst().get();
|
.filter(w -> w.getTitle().toLowerCase().contains(windowName.toLowerCase())).findFirst().get();
|
||||||
System.out.println(SendMessageA(window.getHWND(), WinUser.WM_KEYDOWN, new WPARAM(c), new LPARAM(0)));
|
SendMessageA(window.getHWND(), WinUser.WM_KEYDOWN, new WPARAM(c), new LPARAM(0));
|
||||||
|
System.out.println(getLastError());
|
||||||
try {
|
try {
|
||||||
Thread.sleep(timeInMs);
|
Thread.sleep(timeInMs);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#Generated by Maven Integration for Eclipse
|
#Generated by Maven Integration for Eclipse
|
||||||
#Thu May 23 23:10:46 CEST 2024
|
#Fri May 24 08:04:04 CEST 2024
|
||||||
artifactId=macro
|
artifactId=macro
|
||||||
groupId=me.akito123321.macro
|
groupId=me.akito123321.macro
|
||||||
m2e.projectLocation=C\:\\Users\\ronny\\eclipse-workspace\\macro
|
m2e.projectLocation=/home/ronny/Desktop/Private Projects/PROBot
|
||||||
m2e.projectName=macro
|
m2e.projectName=macro
|
||||||
version=0.0.1-SNAPSHOT
|
version=0.0.1-SNAPSHOT
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user