321 lines
10 KiB
HTML
321 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Ducky Script Creator</title>
|
|
<style>
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
padding: 10px;
|
|
background-color: #f8f8f8;
|
|
}
|
|
|
|
h1 {
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
h2, h3 {
|
|
margin-top: 10px;
|
|
}
|
|
|
|
textarea {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
resize: vertical;
|
|
}
|
|
|
|
.container {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.other {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
|
gap: 5px;
|
|
}
|
|
|
|
.other button {
|
|
width: 100%;
|
|
height: 40px;
|
|
font-size: 12px;
|
|
border: none;
|
|
background-color: #4E9AF1;
|
|
color: white;
|
|
cursor: pointer;
|
|
border-radius: 4px; /* Added rounded corners */
|
|
}
|
|
|
|
.other input[type="number"],
|
|
.other input[type="text"],
|
|
.other .large-btn {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
#createStringButton,
|
|
#createRemarkButton,
|
|
#saveButton {
|
|
padding: 10px;
|
|
border: none;
|
|
background-color: #4E9AF1;
|
|
color: white;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
border-radius: 4px; /* Added rounded corners */
|
|
}
|
|
|
|
#output {
|
|
width: 100%;
|
|
height: 200px;
|
|
padding: 10px;
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
resize: vertical;
|
|
}
|
|
|
|
/* Added new styles for input fields and buttons in the "other" class */
|
|
.other > input[type="number"],
|
|
.other > input[type="text"],
|
|
.other > button {
|
|
display: block;
|
|
width: 100%;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.other .large-btn {
|
|
width: 100%;
|
|
white-space: normal;
|
|
line-height: 1.2;
|
|
border-radius: 4px; /* Added rounded corners */
|
|
margin-top: 5px; /* Added margin-top to create space */
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<b>Function:</b>
|
|
<div class="other">
|
|
<button onclick="appendToOutput('F1')">F1</button>
|
|
<button onclick="appendToOutput('F2')">F2</button>
|
|
<button onclick="appendToOutput('F3')">F3</button>
|
|
<button onclick="appendToOutput('F4')">F4</button>
|
|
<button onclick="appendToOutput('F5')">F5</button>
|
|
<button onclick="appendToOutput('F6')">F6</button>
|
|
<button onclick="appendToOutput('F7')">F7</button>
|
|
<button onclick="appendToOutput('F8')">F8</button>
|
|
<button onclick="appendToOutput('F9')">F9</button>
|
|
<button onclick="appendToOutput('F10')">F10</button>
|
|
<button onclick="appendToOutput('F11')">F11</button>
|
|
<button onclick="appendToOutput('F12')">F12</button>
|
|
</div>
|
|
</div>
|
|
<div class="container">
|
|
<b>String:</b>
|
|
<div class="other">
|
|
<textarea id="input" rows="4" cols="50" placeholder="Type your text here."></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<button id="createStringButton">Write String</button>
|
|
<button id="createRemarkButton">Write Remark</button>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<b>Delay:</b>
|
|
<div class="other">
|
|
<input id="delayInput" type="number" value="1000" min="0">
|
|
<button onclick="appendToOutput('DELAY ' + document.getElementById('delayInput').value)">DELAY</button>
|
|
</div>
|
|
<div class="other">
|
|
<input id="defaultDelayInput" type="number" value="1000" min="0">
|
|
<button onclick="appendToOutput('DEFAULT_DELAY ' + document.getElementById('defaultDelayInput').value)">DEFAULT_DELAY</button>
|
|
</div>
|
|
<div class="other">
|
|
<button class="large-btn" onclick="appendToOutput('WAIT_FOR_BUTTON_PRESS')">BUTTON_PRESS</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<b>Modifiers:</b>
|
|
<div class="other">
|
|
<button onclick="appendToOutput('CTRL')">Ctrl</button>
|
|
<button onclick="appendToOutput('SHIFT')">Shift</button>
|
|
<button onclick="appendToOutput('ALT')">Alt</button>
|
|
<button onclick="appendToOutput('GUI')">Gui</button>
|
|
</div>
|
|
<div class="other">
|
|
<input id="charInput" type="text" maxlength="1" placeholder="Modified key">
|
|
<button onclick="insertChar()">Insert</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<b>Combos:</b>
|
|
<div class="other">
|
|
<button onclick="appendToOutput('CTRL-ALT')">Ctrl-Alt</button>
|
|
<button onclick="appendToOutput('CTRL-SHIFT')">Ctrl-Shift</button>
|
|
<button onclick="appendToOutput('ALT-SHIFT')">Alt-Shift</button>
|
|
<button onclick="appendToOutput('ALT-GUI')">Alt-Gui</button>
|
|
<button onclick="appendToOutput('GUI-SHIFT')">Gui-Shift</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<b>Cursor:</b>
|
|
<div class="other">
|
|
<button onclick="appendToOutput('DOWNARROW')">Down arrow</button>
|
|
<button onclick="appendToOutput('LEFTARROW')">Left arrow</button>
|
|
<button onclick="appendToOutput('RIGHTARROW')">Right arrow</button>
|
|
<button onclick="appendToOutput('UPARROW')">Up arrow</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<b>Control:</b>
|
|
<div class="other">
|
|
<button onclick="appendToOutput('ENTER')">Enter</button>
|
|
<button onclick="appendToOutput('BREAK')">Break</button>
|
|
<button onclick="appendToOutput('PAUSE')">Pause</button>
|
|
<button onclick="appendToOutput('CAPSLOCK')">Caps Lock</button>
|
|
<button onclick="appendToOutput('DELETE')">Delete</button>
|
|
<button onclick="appendToOutput('BACKSPACE')">Back space</button>
|
|
<button onclick="appendToOutput('END')">End</button>
|
|
<button onclick="appendToOutput('ESC')">Esc</button>
|
|
<button onclick="appendToOutput('ESCAPE')">Escape</button>
|
|
<button onclick="appendToOutput('HOME')">Home</button>
|
|
<button onclick="appendToOutput('INSERT')">Insert</button>
|
|
<button onclick="appendToOutput('NUMLOCK')">Num Lock</button>
|
|
<button onclick="appendToOutput('PAGEUP')">Page Up</button>
|
|
<button onclick="appendToOutput('PAGEDOWN')">Page Down</button>
|
|
<button onclick="appendToOutput('PRINTSCREEN')">Print Screen</button>
|
|
<button onclick="appendToOutput('SCROLLOCK')">Scroll Lock</button>
|
|
<button onclick="appendToOutput('SPACE')">Space</button>
|
|
<button onclick="appendToOutput('TAB')">Tab</button>
|
|
<button onclick="appendToOutput('MENU')">Menu</button>
|
|
<button onclick="appendToOutput('APP')">App</button>
|
|
<button onclick="appendToOutput('SYSRQ')">SysRq</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<b>Output:</b>
|
|
<textarea id="output" rows="4" cols="50" placeholder="Your Ducky script will appear here.
|
|
You can edit this manually before saving, if needed."></textarea>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<button id="saveButton">Save As...</button>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('createStringButton').addEventListener('click', createString);
|
|
document.getElementById('createRemarkButton').addEventListener('click', createRemark);
|
|
document.getElementById('saveButton').addEventListener('click', saveOutput);
|
|
|
|
function createString() {
|
|
const input = document.getElementById('input');
|
|
const output = document.getElementById('output');
|
|
let translatedInput = '';
|
|
|
|
const lines = input.value.split('\n');
|
|
for (let i = 0; i < lines.length; i++) {
|
|
const line = lines[i].trim();
|
|
|
|
if (line === '') {
|
|
continue; // Skip empty lines
|
|
}
|
|
|
|
if (hasDeadKeys(line)) {
|
|
translatedInput += `ALTCODE ${line}\n`;
|
|
} else {
|
|
translatedInput += `STRING ${line}\n`;
|
|
}
|
|
}
|
|
|
|
// If the input does not end with a new line, append a new line to the translated input
|
|
if (input.value[input.value.length - 1] !== '\n') {
|
|
translatedInput += '\n';
|
|
}
|
|
|
|
output.value += translatedInput.trim() + '\n'; // Append to the output and add a new line
|
|
input.value = ''; // Clear the input
|
|
}
|
|
|
|
function createRemark() {
|
|
const input = document.getElementById('input');
|
|
const output = document.getElementById('output');
|
|
let translatedInput = '';
|
|
|
|
const lines = input.value.split('\n');
|
|
for (let i = 0; i < lines.length; i++) {
|
|
const line = lines[i].trim();
|
|
|
|
if (line === '') {
|
|
continue; // Skip empty lines
|
|
}
|
|
|
|
if (hasDeadKeys(line)) {
|
|
translatedInput += `ALTCODE ${line}\n`;
|
|
} else {
|
|
translatedInput += `REM ${line}\n`;
|
|
}
|
|
}
|
|
|
|
// If the input does not end with a new line, append a new line to the translated input
|
|
if (input.value[input.value.length - 1] !== '\n') {
|
|
translatedInput += '\n';
|
|
}
|
|
|
|
output.value += translatedInput.trim() + '\n'; // Append to the output and add a new line
|
|
input.value = ''; // Clear the input
|
|
}
|
|
|
|
function hasDeadKeys(input) {
|
|
const deadKeys = /[`^~"']/;
|
|
return deadKeys.test(input);
|
|
}
|
|
|
|
function appendToOutput(value) {
|
|
const output = document.getElementById('output');
|
|
if (value === 'CTRL' || value === 'CONTROL' || value === 'SHIFT' || value === 'ALT' || value === 'GUI' ) {
|
|
output.value += value + ' ';
|
|
} else {
|
|
output.value += value + '\n';
|
|
}
|
|
}
|
|
|
|
function insertChar() {
|
|
const output = document.getElementById('output');
|
|
const charInput = document.getElementById('charInput');
|
|
const char = charInput.value.trim();
|
|
|
|
if (char !== '') {
|
|
output.value += char + '\n';
|
|
charInput.value = '';
|
|
}
|
|
}
|
|
|
|
function saveOutput() {
|
|
const output = document.getElementById('output');
|
|
const filename = prompt("Enter the filename", "output.txt");
|
|
const blob = new Blob([output.value], { type: 'text/plain' });
|
|
const anchor = document.createElement('a');
|
|
anchor.download = filename || 'output.txt';
|
|
anchor.href = window.URL.createObjectURL(blob);
|
|
anchor.click();
|
|
anchor.remove();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|