mayankmetha / Rucky

A simple to use USB HID Rubber Ducky Launch Pad for Android.
https://mayankmetha.github.io/Rucky
GNU General Public License v3.0
546 stars 65 forks source link

Suggestion: alt num command for unicode characters #126

Closed Maxsteff57 closed 1 year ago

Maxsteff57 commented 1 year ago

@mayankmetha, sorry, I didn't really understand How can I enter unicode symbols?

Example:

Alt + num 0 + num 1 + num 1

or

HOLD ALT - also HOLD don't work N0 N1 N1 RELEASE ALT

226185188-df4499de-e788-4eb4-957d-496a76aa8b12

Using these combinations, you do not need to switch the layout

Maxsteff57 commented 1 year ago

Code for atmega

#include "Keyboard.h"
#include <SD.h>
#include <string.h>
#include <SPI.h>
File script;
boolean first = true;
String DEFAULT_FILE_NAME = "script.txt"; void setup() { if (!SD.begin(4)) { return; } script = SD.open(DEFAULT_FILE_NAME); if (script) { Keyboard.begin(); String line = ""; while (script.available()) { char m = script.read(); if (m == '\n'){ Line(line); line = ""; } else if((int) m != 13) { line += m; } } Line(line); script.close(); } else { } Keyboard.end();
} void Line(String l)
{ int space_1 = l.indexOf(" "); if (space_1 == -1) { Press(l); } else if (l.substring(0,space_1) == "STRING") { Keyboard.print(l.substring(space_1 + 1)); } else if (l.substring(0,space_1) == "DELAY") { int delaytime = l.substring(space_1 + 1).toInt(); delay(delaytime); } else if(l.substring(0,space_1) == "REM"){} else { String remain = l; while(remain.length() > 0) { int latest_space = remain.indexOf(" "); if (latest_space == -1) { Press(remain); remain = ""; } else { Press(remain.substring(0, latest_space)); remain = remain.substring(latest_space + 1); } delay(5); } } Keyboard.releaseAll();
} void Press(String b)
{ if(b.length() == 1) { char c = b[0]; Keyboard.press(c); } else if (b.equals("ENTER")) { Keyboard.press(KEY_RETURN); } else if (b.equals("CTRL")) { Keyboard.press(KEY_LEFT_CTRL); } else if (b.equals("SHIFT")) { Keyboard.press(KEY_LEFT_SHIFT); } else if (b.equals("ALT")) { Keyboard.press(KEY_LEFT_ALT); } else if (b.equals("GUI")) { Keyboard.press(KEY_LEFT_GUI); } else if (b.equals("NUMLOCK")) { Keyboard.press(219); } else if (b.equals("UP") || b.equals("UPARROW")) { Keyboard.press(KEY_UP_ARROW); } else if (b.equals("DOWN") || b.equals("DOWNARROW")) { Keyboard.press(KEY_DOWN_ARROW); } else if (b.equals("LEFT") || b.equals("LEFTARROW")) { Keyboard.press(KEY_LEFT_ARROW); } else if (b.equals("RIGHT") || b.equals("RIGHTARROW")) { Keyboard.press(KEY_RIGHT_ARROW); } else if (b.equals("DELETE")) { Keyboard.press(KEY_DELETE); } else if (b.equals("PAGEUP")) { Keyboard.press(KEY_PAGE_UP); } else if (b.equals("PAGEDOWN")) { Keyboard.press(KEY_PAGE_DOWN); } else if (b.equals("HOME")) { Keyboard.press(KEY_HOME); } else if (b.equals("ESC")) { Keyboard.press(KEY_ESC); } else if (b.equals("INSERT")) { Keyboard.press(KEY_INSERT); } else if (b.equals("TAB")) { Keyboard.press(KEY_TAB); } else if (b.equals("END")) { Keyboard.press(KEY_END); } else if (b.equals("CAPSLOCK")) { Keyboard.press(KEY_CAPS_LOCK); } else if (b.equals("F1")) { Keyboard.press(KEY_F1); } else if (b.equals("F2")) { Keyboard.press(KEY_F2); } else if (b.equals("F3")) { Keyboard.press(KEY_F3); } else if (b.equals("F4")) { Keyboard.press(KEY_F4); } else if (b.equals("F5")) { Keyboard.press(KEY_F5); } else if (b.equals("F6")) { Keyboard.press(KEY_F6); } else if (b.equals("F7")) { Keyboard.press(KEY_F7); } else if (b.equals("F8")) { Keyboard.press(KEY_F8); } else if (b.equals("F9")) { Keyboard.press(KEY_F9); } else if (b.equals("F10")) { Keyboard.press(KEY_F10); } else if (b.equals("F11")) { Keyboard.press(KEY_F11); } else if (b.equals("F12")) { Keyboard.press(KEY_F12); } else if (b.equals("N9")) { Keyboard.press (233); Keyboard.release (233); } else if (b.equals("N8")) { Keyboard.press (232); Keyboard.release (232); } else if (b.equals("N7")) { Keyboard.press (231); Keyboard.release (231); } else if (b.equals("N6")) { Keyboard.press (230); Keyboard.release (230); } else if (b.equals("N5")) { Keyboard.press (229); Keyboard.release (229); } else if (b.equals("N4")) { Keyboard.press (228); Keyboard.release (228); } else if (b.equals("N3")) { Keyboard.press (227); Keyboard.release (227); } else if (b.equals("N2")) { Keyboard.press (226); Keyboard.release (226); } else if (b.equals("N1")) { Keyboard.press (225); Keyboard.release (225); } else if (b.equals("N0")) { Keyboard.press (234); Keyboard.release (234); }
} void loop() {} 

Encoder:

convert = { 'A': 'ALT N6 N5', 'B': 'ALT N6 N6', 'C': 'ALT N6 N7', 'D': 'ALT N6 N8', 'E': 'ALT N6 N9', 'F': 'ALT N7 N0', 'G': 'ALT N7 N1', 'H': 'ALT N7 N2', 'I': 'ALT N7 N3', 'J': 'ALT N7 N4', 'K': 'ALT N7 N5', 'L': 'ALT N7 N6', 'M': 'ALT N7 N7', 'N': 'ALT N7 N8', 'O': 'ALT N7 N9', 'P': 'ALT N8 N0', 'Q': 'ALT N8 N1', 'R': 'ALT N8 N2', 'S': 'ALT N8 N3', 'T': 'ALT N8 N4', 'U': 'ALT N8 N5', 'V': 'ALT N8 N6', 'W': 'ALT N8 N7', 'X': 'ALT N8 N8', 'Y': 'ALT N8 N9', 'Z': 'ALT N9 N0', 'a': 'ALT N9 N7', 'b': 'ALT N9 N8', 'c': 'ALT N9 N9', 'd': 'ALT N1 N0 N0', 'e': 'ALT N1 N0 N1', 'f': 'ALT N1 N0 N2', 'g': 'ALT N1 N0 N3', 'h': 'ALT N1 N0 N4', 'i': 'ALT N1 N0 N5', 'j': 'ALT N1 N0 N6', 'k': 'ALT N1 N0 N7', 'l': 'ALT N1 N0 N8', 'm': 'ALT N1 N0 N9', 'n': 'ALT N1 N1 N0', 'o': 'ALT N1 N1 N1', 'p': 'ALT N1 N1 N2', 'q': 'ALT N1 N1 N3', 'r': 'ALT N1 N1 N4', 's': 'ALT N1 N1 N5', 't': 'ALT N1 N1 N6', 'u': 'ALT N1 N1 N7', 'v': 'ALT N1 N1 N8', 'w': 'ALT N1 N1 N9', 'x': 'ALT N1 N2 N0', 'y': 'ALT N1 N2 N1', 'z': 'ALT N1 N2 N2', ',': 'ALT N4 N4', '.': 'ALT N4 N6', '/': 'ALT N4 N7', '<': 'ALT N6 N0', '>': 'ALT N6 N2', '?': 'ALT N6 N3', ';': 'ALT N5 N9', ':': 'ALT N5 N8', '"': 'ALT N3 N4', '[': 'ALT N9 N1', ']': 'ALT N9 N3', '{': 'ALT N1 N2 N3', '}': 'ALT N1 N2 N5',} stEng = input("Input text: ")
i = 0
f = 0
otvet = []
for k in stEng: try: print(convert[stEng[i]]) i += 1 except KeyError: print('STRING',k) i += 1
mayankmetha commented 1 year ago

Hold option is part of rubber ducky 3.0 which is still under development.