Skip to content

Commit

Permalink
Stable version with pause and icons.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeke committed May 13, 2014
1 parent 886718b commit 58a2b16
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
4 changes: 0 additions & 4 deletions Macro Recorder/src/player/KeyListener.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package player;

import javax.swing.ImageIcon;

import gui.UI;

import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;

Expand Down
3 changes: 1 addition & 2 deletions Macro Recorder/src/player/MainPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
public class MainPlayer {
public static boolean exit = false;
public static boolean pause = false;
public static double speedMultiplier = 1;
public static String filepath = null;

public static void play() {
Expand Down Expand Up @@ -68,7 +67,7 @@ public static void play() {
player.keyRelease(keycode);
} else if (split[0].equals("Wait")) {
time = Integer.parseInt(split[1]);
player.delay((int)(time/speedMultiplier));
player.delay(time);
} else if (split[0].equals("Exit")) {
exit = true;
}
Expand Down
2 changes: 1 addition & 1 deletion Macro Recorder/src/program/MainProgram.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ public class MainProgram {
public static void main(String[] args) {
UI.run();
}
}
}
16 changes: 8 additions & 8 deletions Macro Recorder/src/recorder/KeyRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ public void nativeKeyPressed(NativeKeyEvent e) {
String key = NativeKeyEvent.getKeyText(keycode);
boolean leave = false;

if (key == "Shift") {
if (key.equals("Shift")) {
keycode = 16;
} else if (key == "Alt") {
} else if (key.equals("Alt")) {
keycode = 18;
} else if (key == "Escape") {
GlobalScreen.unregisterNativeHook();
} else if (key.equals("Escape")) {
skip = true;
}

Expand Down Expand Up @@ -81,12 +80,11 @@ public void nativeKeyReleased(NativeKeyEvent e) {
String key = NativeKeyEvent.getKeyText(keycode);
boolean leave = false;

if (key == "Shift") {
if (key.equals("Shift")) {
keycode = 16;
} else if (key == "Alt") {
} else if (key.equals("Alt")) {
keycode = 18;
} else if (key == "Escape") {
GlobalScreen.unregisterNativeHook();
} else if (key.equals("Escape")) {
out.write("Exit");
out.newLine();
exit = true;
Expand All @@ -104,6 +102,8 @@ public void nativeKeyReleased(NativeKeyEvent e) {
out.newLine();
out.write("Wait " + timeMs);
out.newLine();
} else {
GlobalScreen.unregisterNativeHook();
}

out.close();
Expand Down

0 comments on commit 58a2b16

Please sign in to comment.