Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/main/java/com/ohualtex/autoclicker/AutoClicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;
import java.util.Random;
import java.util.logging.Level;
Expand Down Expand Up @@ -303,7 +301,9 @@ private void applyThemeAndFont(boolean isDark, int fontSize, Color fgColor) {
statusLabel.setFont(new Font("Segoe UI", Font.BOLD, fontSize + 8));
statusLabel.setForeground(isRunning ? new Color(90, 255, 90) : new Color(255, 90, 90));
}
} catch (Exception ex) { ex.printStackTrace(); }
} catch (Exception ex) {
System.err.println("[AutoClicker] Tema/font uygulanamadi: " + ex.getMessage());
}
}

private void loadConfig() {
Expand Down Expand Up @@ -885,14 +885,19 @@ public void keyPressed(KeyEvent ev) {
int mask = InputEvent.BUTTON1_DOWN_MASK;
if(mIdx==1) mask = InputEvent.BUTTON3_DOWN_MASK;
else if(mIdx==2) mask = InputEvent.BUTTON2_DOWN_MASK;
else if(mIdx==3) mask = 999;
else if(mIdx==3) mask = MacroAction.DOUBLE_CLICK;
chainModel.addElement(new MacroAction(ActionType.MOUSE_CLICK, mask, 0));
} else if(t==1) {
chainModel.addElement(new MacroAction(ActionType.KEY_PRESS, selectedActKey[0], 0));
} else if(t==2) {
chainModel.addElement(new MacroAction(ActionType.MOUSE_MOVE, macroTempPt.x, macroTempPt.y));
} else if(t==3) {
try { chainModel.addElement(new MacroAction(ActionType.DELAY, Integer.parseInt(delayField.getText()), 0)); } catch(Exception ex) {}
try {
chainModel.addElement(new MacroAction(ActionType.DELAY, Integer.parseInt(delayField.getText().trim()), 0));
} catch (Exception ex) {
Toolkit.getDefaultToolkit().beep(); // gecersiz sayi: sessizce yutma, kullaniciya bildir
return;
}
}
dialog.dispose();
});
Expand Down Expand Up @@ -1126,7 +1131,16 @@ private void initJNativeHook() {
GlobalScreen.registerNativeHook();
GlobalScreen.addNativeKeyListener(this);
GlobalScreen.addNativeMouseListener(this);
} catch (NativeHookException e) {}
} catch (NativeHookException e) {
// Kanca kurulamazsa hotkey + record calismaz; sessiz kalma, kullaniciya bildir
System.err.println("[AutoClicker] Global kanca (JNativeHook) kurulamadi: " + e.getMessage());
SwingUtilities.invokeLater(() -> {
if (statusLabel != null) {
statusLabel.setText(Lang.get("hook_fail"));
statusLabel.setForeground(new Color(255, 165, 0));
}
});
}
}

// Limit ayarlarinin worker thread'e gecirilecek anlik kopyasi (EDT-disi Swing erisimini onler)
Expand Down Expand Up @@ -1423,7 +1437,7 @@ private boolean startChainMacro() {
SwingUtilities.invokeLater(() -> chainList.setSelectedIndex(idx));
switch (action.type) {
case MOUSE_CLICK:
if (action.p1 == 999) {
if (action.p1 == MacroAction.DOUBLE_CLICK) {
doMouseClick(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(40);
doMouseClick(InputEvent.BUTTON1_DOWN_MASK);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/ohualtex/autoclicker/i18n/Lang.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public final class Lang {
d.put("st_idle", new String[]{"DURUM: BEKLIYOR", "STATUS: IDLE", "STATUS: BEREIT", "STATUT: EN ATTENTE", "STATO: IN ATTESA", "СТАТУС: ОЖИДАНИЕ"});
d.put("st_run", new String[]{"DURUM: CALISIYOR", "STATUS: RUNNING", "STATUS: LÄUFT", "STATUT: EN COURS", "STATO: IN ESECUZIONE", "СТАТУС: РАБОТАЕТ"});
d.put("st_lim", new String[]{"DURUM: LIMIT YENDI", "STATUS: LIMIT HIT", "STATUS: LIMIT ERREICHT", "STATUT: LIMITE", "STATO: LIMITE RAGGIUNTO", "СТАТУС: ЛИМИТ"});
d.put("hook_fail", new String[]{"DURUM: KISAYOL DINLENEMIYOR", "STATUS: HOTKEY UNAVAILABLE", "STATUS: HOTKEY NICHT VERFUGBAR", "STATUT: RACCOURCI INDISPONIBLE", "STATO: HOTKEY NON DISPONIBILE", "СТАТУС: ГОРЯЧАЯ КЛАВИША НЕДОСТУПНА"});

d.put("t_mouse", new String[]{"Fare", "Mouse", "Maus", "Souris", "Mouse", "Мышь"});
d.put("t_key", new String[]{"Klavye", "Keyboard", "Tastatur", "Clavier", "Tastiera", "Клавиатура"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@

/** Zincir makrosundaki tek bir adim (tur + iki parametre). Listede toString ile gosterilir, serialize ile saklanir. */
public class MacroAction {
/** MOUSE_CLICK adiminda p1 bu degerse "cift sol tik" demektir (sentinel/isaret degeri). */
public static final int DOUBLE_CLICK = 999;

public ActionType type;
public int p1, p2;

public MacroAction(ActionType type, int p1, int p2) { this.type = type; this.p1 = p1; this.p2 = p2; }

public String toString() {
switch(type) {
case MOUSE_CLICK: return Lang.get("tnt_mouse") + ": " + (p1==InputEvent.BUTTON1_DOWN_MASK ? Lang.get("l_click") : p1==InputEvent.BUTTON3_DOWN_MASK ? Lang.get("r_click") : p1==999 ? Lang.get("d_click") : Lang.get("m_click"));
case MOUSE_CLICK: return Lang.get("tnt_mouse") + ": " + (p1==InputEvent.BUTTON1_DOWN_MASK ? Lang.get("l_click") : p1==InputEvent.BUTTON3_DOWN_MASK ? Lang.get("r_click") : p1==DOUBLE_CLICK ? Lang.get("d_click") : Lang.get("m_click"));
case KEY_PRESS: return Lang.get("tnt_key") + ": " + KeyEvent.getKeyText(p1);
case MOUSE_MOVE: return Lang.get("tnt_move") + ": X=" + p1 + ", Y=" + p2;
case DELAY: return Lang.get("ms_delay") + " " + p1;
Expand Down
Loading