-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2898 lines (2693 loc) · 165 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HTpy</title>
<style>
body {
background-color: #202020;
font-family:
"Open Sans",
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Oxygen-Sans,
Ubuntu,
Cantarell,
"Helvetica Neue",
Helvetica,
Arial,
sans-serif;
}
</style>
<!-- Include Ace Editor CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.32.2/ace.js" integrity="sha512-JLIRlxWh96sND3uUgI2RVHZJpgkWHg3+xoUY8XkgTPKpqRaqdk7zD/ck/XHXFSMW84o6GrP67dlqN3b98NB/yA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-language_tools.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.10.5/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3.10.5/brython_stdlib.js"></script>
</head>
<body onload="brython()">
<script type="text/python">
import io
import sys
from browser import document, window
def runPythonCode(code):
try:
# Redirect stdout to capture output
sys.stdout = io.StringIO()
exec(code)
# Get the captured output
output = sys.stdout.getvalue()
# Reset stdout
sys.stdout = sys.__stdout__
return output
except Exception as e:
return f"Error: {str(e)}"
# Expose the runPythonCode function to the browser's window object
window.runPythonCode = runPythonCode
</script>
<script>
// JavaScript equivalent code with variables
function changeFaviconAtTheBeginning(faviconUrl) {
// Create a new favicon link element
const newFavicon = document.createElement("link");
newFavicon.rel = "icon";
newFavicon.href = faviconUrl;
// Get the current favicon element (if exists)
const existingFavicon = document.querySelector('link[rel="icon"]');
// Replace the current favicon with the new one
if (existingFavicon) {
// If a favicon exists, replace it
document.head.removeChild(existingFavicon); // Remove the existing favicon
}
// Append the new favicon to the head
document.head.appendChild(newFavicon);
}
// Call the function with the desired favicon URL
changeFaviconAtTheBeginning("https://i.ibb.co/Jpty1B8/305182938-1a0efe63-726e-49ca-a13c-d0ed627f2ea7.png");
var lastKeyPressed = "";
function trackLastKeyPressed() {
document.addEventListener("keydown", function (event) {
lastKeyPressed = event.key;
// console.log(lastKeyPressed);
});
}
function getLastKeyPressed() {
return lastKeyPressed;
}
// Call the trackLastKeyPressed function to start tracking key presses
trackLastKeyPressed();
let lastInputTime = Date.now(); // Initialize with current timestamp
let startTimestamp = Date.now(); // Initialize with current timestamp
// Event listener to track user activity
function resetIdleTimer() {
lastInputTime = Date.now(); // Update last input time
}
document.addEventListener("mousemove", resetIdleTimer);
document.addEventListener("keypress", resetIdleTimer);
// Function to calculate time since last input event
function A_TimeIdle() {
return Date.now() - lastInputTime; // Calculate time difference
}
// Function to calculate tick count in milliseconds
function A_TickCount() {
return Date.now() - startTimestamp;
}
function BuildInVars(varName) {
switch (varName) {
case "A_ScreenWidth":
// Return screen width
return window.innerWidth;
case "A_LastKey":
// Return screen width
return getLastKeyPressed();
case "A_ScreenHeight":
// Return screen height
return window.innerHeight;
case "A_TimeIdle":
// Return time idle
return A_TimeIdle();
case "A_TickCount":
// Return tick count in milliseconds
return A_TickCount();
case "A_Now":
// Return current local timestamp
return new Date().toLocaleString();
case "A_YYYY":
// Return current year
return new Date().getFullYear();
case "A_MM":
// Return current month
return (new Date().getMonth() + 1).toString().padStart(2, "0");
case "A_DD":
// Return current day
return new Date().getDate().toString().padStart(2, "0");
case "A_MMMM":
// Return full month name
return new Date().toLocaleDateString(undefined, { month: "long" });
case "A_MMM":
// Return short month name
return new Date().toLocaleDateString(undefined, { month: "short" });
case "A_DDDD":
// Return full day name
return new Date().toLocaleDateString(undefined, { weekday: "long" });
case "A_DDD":
// Return short day name
return new Date().toLocaleDateString(undefined, { weekday: "short" });
case "A_Hour":
// Return current hour
return new Date().getHours().toString().padStart(2, "0");
case "A_Min":
// Return current minute
return new Date().getMinutes().toString().padStart(2, "0");
case "A_Sec":
// Return current second
return new Date().getSeconds().toString().padStart(2, "0");
case "A_Space":
// Return space character
return " ";
case "A_Tab":
// Return tab character
return "\t";
default:
// Handle unknown variable names
return null;
}
}
// Absolute value
function Abs(num) {
if (num === null || isNaN(num)) return null;
return Math.abs(num);
}
// Arc cosine
function ACos(num) {
if (num === null || isNaN(num)) return null;
return Math.acos(num);
}
// Arc sine
function ASin(num) {
if (num === null || isNaN(num)) return null;
return Math.asin(num);
}
// Arc tangent
function ATan(num) {
if (num === null || isNaN(num)) return null;
return Math.atan(num);
}
// Ceiling
function Ceil(num) {
if (num === null || isNaN(num)) return null;
return Math.ceil(num);
}
// Cosine
function Cos(num) {
if (num === null || isNaN(num)) return null;
return Math.cos(num);
}
// Exponential
function Exp(num) {
if (num === null || isNaN(num)) return null;
return Math.exp(num);
}
// Flooring
function Floor(num) {
if (num === null || isNaN(num)) return null;
return Math.floor(num);
}
// Natural logarithm
function Ln(num) {
if (num === null || isNaN(num)) return null;
return Math.log(num);
}
// Base-10 logarithm
function Log(num) {
if (num === null || isNaN(num)) return null;
return Math.log10(num);
}
// Rounding
function Round(num) {
if (num === null || isNaN(num)) return null;
return Math.round(num);
}
// Sin
function Sin(num) {
if (num === null || isNaN(num)) return null;
return Math.sin(num);
}
// Square root
function Sqrt(num) {
if (num === null || isNaN(num)) return null;
return Math.sqrt(num);
}
// Tangent
function Tan(num) {
if (num === null || isNaN(num)) return null;
return Math.tan(num);
}
function Chr(number) {
// Check if the number is null
if (number === null) {
// Return an empty string
return "";
}
// Check if the number is within the valid range
if (number >= 0 && number <= 0x10ffff) {
// Convert the number to a character using String.fromCharCode
return String.fromCharCode(number);
} else {
// Return an empty string for invalid numbers
return "";
}
}
// Function to simulate Sleep
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
// InStr
function InStr(Haystack, Needle, CaseSensitive = true, StartingPos = 1, Occurrence = 1) {
if (Haystack === null || Needle === null) return false;
// Adjust starting position if less than 1
StartingPos = Math.max(StartingPos, 1);
// Case-sensitive search by default
if (!CaseSensitive) {
Haystack = Haystack.toLowerCase();
Needle = Needle.toLowerCase();
}
let pos = -1;
let count = 0;
for (let i = StartingPos - 1; i < Haystack.length; i++) {
if (Haystack.substring(i, i + Needle.length) === Needle) {
count++;
if (count === Occurrence) {
pos = i + 1;
break;
}
}
}
return pos > 0; // Return true if the substring is found, false otherwise
}
// RegExMatch
function RegExMatch(Haystack, NeedleRegEx, OutputVar, StartingPos) {
if (Haystack === null || NeedleRegEx === null) return null;
const regex = new RegExp(NeedleRegEx);
let match;
if (typeof Haystack === 'string') {
match = Haystack.match(regex);
}
if (match) {
if (OutputVar) {
OutputVar.push(match[0]);
}
return match.index + 1;
} else {
return 0;
}
}
// StrLen
function StrLen(str) {
return str === null ? null : str.length;
}
function SubStr(str, startPos, length) {
// If str is null or undefined, return an empty string
if (str === null || str === undefined) {
return "";
}
// If length is not provided or is blank, default to "all characters"
if (length === undefined || length === "") {
length = str.length - startPos + 1;
}
// If startPos is less than 1, adjust it to start from the end of the string
if (startPos < 1) {
startPos = str.length + startPos;
}
// Extract the substring based on startPos and length
return str.substr(startPos - 1, length);
}
function Trim(inputString) {
// Check if inputString is null or undefined
if (inputString == null) {
return ""; // Return an empty string if inputString is null or undefined
}
return inputString.replace(/^\s+|\s+$/g, ""); // Removes leading and trailing whitespace
}
function StrReplace(originalString, find, replaceWith) {
// Check if originalString is a string
if (typeof originalString !== "string") {
return originalString; // Return originalString as is
}
// Escape special characters in the 'find' string to be used literally
const escapedFind = find.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
// Use replace method to replace all occurrences of 'find' with 'replaceWith'
return originalString.replace(new RegExp(escapedFind, "g"), replaceWith);
}
// Custom Mod function
function Mod(dividend, divisor) {
return dividend % divisor;
}
function Asc(char) {
return char.charCodeAt(0);
}
// Function to trim specified number of characters from the left side of a string
function StringTrimLeft(input, numChars) {
if (typeof input === 'string' && typeof numChars === 'number' && numChars >= 0) {
return input.length > numChars ? input.substring(numChars) : '';
} else {
console.error("Invalid input provided.");
return input; // Return original input if trimming is not possible
}
}
// Function to trim specified number of characters from the right side of a string
function StringTrimRight(input, numChars) {
if (typeof input === 'string' && typeof numChars === 'number' && numChars >= 0) {
return input.length > numChars ? input.substring(0, input.length - numChars) : '';
} else {
console.error("Invalid input provided.");
return input; // Return original input if trimming is not possible
}
}
// Object to store timer intervals for different functions
const timerIntervals = {};
async function SetTimer(func, timeOrOnOff) {
if (typeof func !== "function" || typeof timeOrOnOff === "undefined") {
console.error("Invalid arguments. Please provide a valid function and time/On/Off state.");
return;
}
if (typeof timeOrOnOff === "number") {
// If a number is provided, set the timer to that time in milliseconds and start it.
func.interval = timeOrOnOff; // Store the interval within the function
func(); // Call the function initially
func.intervalId = setInterval(func, timeOrOnOff);
timerIntervals[func] = func.intervalId; // Store the interval ID
} else if (timeOrOnOff === "On") {
// If 'On' is provided, start the timer if it's not already running.
if (!func.intervalId && func.interval) {
func(); // Call the function initially
func.intervalId = setInterval(func, func.interval); // Start with the stored interval
timerIntervals[func] = func.intervalId; // Store the interval ID
} else {
console.error("Timer is not set. Please provide a valid interval.");
}
} else if (timeOrOnOff === "Off") {
// If 'Off' is provided, clear the timer if it's running.
clearInterval(func.intervalId);
func.intervalId = null;
delete timerIntervals[func]; // Remove the interval ID from storage
} else {
console.error("Invalid time/On/Off state. Please provide a valid time in milliseconds or 'On'/'Off'.");
}
}
function GuiControl(action, id, param1, param2, param3, param4) {
const element = document.getElementById(id);
if (element) {
// Handle DOM elements
if (action === "move") {
// Set position and size
element.style.left = param1 + "px";
element.style.top = param2 + "px";
element.style.width = param3 + "px";
element.style.height = param4 + "px";
} else if (action === "focus" && (element instanceof HTMLInputElement || element instanceof HTMLElement)) {
// Focus on the element
element.focus();
} else if (action === "text") {
// Set new text content
element.textContent = param1;
} else if (action === "hide") {
// Hide the element
element.style.display = "none";
} else if (action === "show") {
// Show the element
element.style.display = "";
} else if (action === "enable") {
// Enable the element
element.disabled = false;
} else if (action === "disable") {
// Disable the element
element.disabled = true;
} else if (action === "font") {
// Set font size
element.style.fontSize = param1 + "px";
} else if (action === "color") {
// Set color
element.style.color = param1;
} else if (action === "picture") {
// Change the image source
if (element instanceof HTMLImageElement) {
element.src = param1;
} else {
console.error("Element is not an <img> tag, cannot change picture.");
}
} else if (action === "textide") {
// Set value for Ace editor
var editor = ace.edit(id); // Access the Ace editor instance using its ID
if (editor && param1) {
editor.session.setValue(param1);
} else {
console.error("Element is not an Ace editor or parameter is missing.");
}
}
} else {
// Handle canvas or non-existing element
if (action === "move") {
// Update position and size of the rectangle
updateRectangle(id, param1, param2, param3, param4);
redrawCanvas(); // Redraw the canvas with updated rectangles
} else if (action === "color") {
// Update color of the rectangle
updateRectangleColor(id, param1);
redrawCanvas(); // Redraw the canvas with updated rectangles
}
}
}
function FileAppend(data, filename) {
// Create a blob with the provided data
const blob = new Blob([data], { type: "text/plain" });
// Create a temporary anchor element
const anchor = document.createElement("a");
anchor.style.display = "none";
// Set the download attribute and filename
anchor.setAttribute("href", window.URL.createObjectURL(blob));
anchor.setAttribute("download", filename);
// Append the anchor element to the body
document.body.appendChild(anchor);
// Trigger a click event on the anchor element
anchor.click();
// Remove the anchor element
document.body.removeChild(anchor);
}
function StrLower(string) {
return string.toLowerCase();
}
async function getDataFromAPI(url) {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error("Network response was not ok");
}
const data = await response.json();
return data;
} catch (error) {
console.error("Error fetching data:", error);
return null;
}
}
function getDataFromJSON(jsonData, jsonPath) {
const pathSegments = jsonPath.split("."); // Split the path into segments
let currentData = jsonData; // Use jsonData directly (already an object)
try {
for (const segment of pathSegments) {
if (currentData && typeof currentData === "object") {
if (segment.includes("[") && segment.includes("]")) {
// Handle array index notation e.g., "data[21].employee_name"
const arrayIndex = segment.match(/\[(\d+)\]/); // Extract the array index
if (arrayIndex) {
const arrayName = segment.substring(0, segment.indexOf("["));
const index = parseInt(arrayIndex[1]);
currentData = currentData[arrayName][index];
} else {
return undefined; // Invalid array index notation
}
} else {
// Handle regular object property notation e.g., "employee_name"
currentData = currentData[segment];
}
} else {
console.log("Invalid path segment or data type encountered.");
return undefined;
}
}
} catch (error) {
console.error("Error accessing data:", error);
return undefined;
}
return currentData;
}
function StrSplit(inputStr, delimiter, num) {
// Check if inputStr is a valid string
if (typeof inputStr !== 'string') {
return ''; // Return empty string for invalid input
}
// Split the input string based on the delimiter
const parts = inputStr.split(delimiter);
// Return the part specified by the num parameter (1-based index)
if (num > 0 && num <= parts.length) {
return parts[num - 1]; // Return the specified part (0-based index)
} else {
return ''; // Return an empty string if num is out of range
}
}
// Function to simulate AutoHotkey's RegExReplace in JavaScript
function RegExReplace(inputStr, regexPattern, replacement) {
// Create a regular expression object using the provided pattern
const regex = new RegExp(regexPattern, 'g'); // 'g' flag for global match
// Use the replace() method to perform the regex replacement
const resultStr = inputStr.replace(regex, replacement);
// Return the modified string
return resultStr;
}
function LoopParseFunc(varString, delimiter1="", delimiter2="") {
let items;
if (!delimiter1 && !delimiter2) {
// If no delimiters are provided, return an array of characters
items = [...varString];
} else {
// Construct the regular expression pattern for splitting the string
let pattern = new RegExp('[' + delimiter1.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + delimiter2.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ']+');
// Split the string using the constructed pattern
items = varString.split(pattern);
}
return items;
}
function SortLikeAHK(varName, options = "") {
let delimiter = '\n'; // Default delimiter
let delimiterIndex = options.indexOf('D');
if (delimiterIndex !== -1) {
let delimiterChar = options[delimiterIndex + 1];
delimiter = delimiterChar === '' ? ',' : delimiterChar;
}
let items = varName.split(new RegExp(delimiter === ',' ? ',' : '\\' + delimiter));
// Remove empty items and trim whitespace
items = items.filter(item => item.trim() !== '');
// Apply sorting based on options
if (options.includes('N')) {
// Numeric sort
items.sort((a, b) => parseInt(a, 10) - parseInt(b, 10));
} else if (options.includes('Random')) {
// Random sort
for (let i = items.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[items[i], items[j]] = [items[j], items[i]];
}
} else {
// Default alphabetical sort
items.sort((a, b) => {
const keyA = options.includes('C') ? a : a.toLowerCase();
const keyB = options.includes('C') ? b : b.toLowerCase();
if (keyA < keyB) return -1;
if (keyA > keyB) return 1;
return 0;
});
}
// Reverse if 'R' option is present
if (options.includes('R')) {
items.reverse();
}
// Remove duplicates if 'U' option is present
if (options.includes('U')) {
const seen = new Map();
items = items.filter(item => {
const key = options.includes('C') ? item : item.toLowerCase();
if (!seen.has(key)) {
seen.set(key, item);
return true;
}
return false;
});
}
// Join the sorted items back into a string
const sortedVar = items.join(delimiter === ',' ? ',' : '\n');
return sortedVar;
}
function AddIDE(parent, xPos, yPos, w, h, id, font = 18, langName = "autohotkey", onChangeFunc, initialText = "") {
var langTools = ace.require("ace/ext/language_tools");
let Completer = {
getCompletions: function (editor, session, pos, prefix, callback) {
if (prefix.startsWith("p")) {
// Continue executing if the prefix starts with "p"
} else {
// Return early if the prefix does not start with "p" and its length is not greater than 1
if (prefix.length <= 1) {
callback(null, []); // Return an empty array of completions
return;
}
}
let prefixLower = prefix.toLowerCase();
let filteredTables = hth.filter(function (table) {
return table.name.toLowerCase().startsWith(prefixLower);
});
// filteredTables.sort(function(a, b) {
// return a.name.length - b.name.length;
// });
let limitedTables = filteredTables; //.slice(-10);
callback(
null,
limitedTables.map(function (table) {
return {
caption: table.name,
value: table.name,
};
}),
);
},
};
let hth = [{ name: "#AllowSameLineComments" }, { name: "#ClipboardTimeout" }, { name: "#CommentFlag" }, { name: "#Delimiter" }, { name: "#DerefChar" }, { name: "#ErrorStdOut" }, { name: "#EscapeChar" }, { name: "#HotkeyInterval" }, { name: "#HotkeyModifierTimeout" }, { name: "#Hotstring" }, { name: "#If" }, { name: "#IfTimeout" }, { name: "#IfWinActive" }, { name: "#IfWinExist" }, { name: "#IfWinNotActive" }, { name: "#IfWinNotExist" }, { name: "#Include" }, { name: "#IncludeAgain" }, { name: "#InputLevel" }, { name: "#InstallKeybdHook" }, { name: "#InstallMouseHook" }, { name: "#KeyHistory" }, { name: "#LTrim" }, { name: "#MaxHotkeysPerInterval" }, { name: "#MaxMem" }, { name: "#MaxThreads" }, { name: "#MaxThreadsBuffer" }, { name: "#MaxThreadsPerHotkey" }, { name: "#MenuMaskKey" }, { name: "#NoEnv" }, { name: "#NoTrayIcon" }, { name: "#Persistent" }, { name: "#Requires" }, { name: "#SingleInstance" }, { name: "#UseHook" }, { name: "#Warn" }, { name: "#WinActivateForce" }, { name: "break" }, { name: "case" }, { name: "catch" }, { name: "continue" }, { name: "else" }, { name: "finally" }, { name: "for" }, { name: "gosub" }, { name: "goto" }, { name: "if" }, { name: "IfEqual" }, { name: "IfExist" }, { name: "IfGreater" }, { name: "IfGreaterOrEqual" }, { name: "IfInString" }, { name: "IfLess" }, { name: "IfLessOrEqual" }, { name: "IfMsgBox" }, { name: "IfNotEqual" }, { name: "IfNotExist" }, { name: "IfNotInString" }, { name: "IfWinActive" }, { name: "IfWinExist" }, { name: "IfWinNotActive" }, { name: "IfWinNotExist" }, { name: "Loop" }, { name: "return" }, { name: "switch" }, { name: "throw" }, { name: "try" }, { name: "until" }, { name: "while" }, { name: "__Call" }, { name: "__Delete" }, { name: "__Get" }, { name: "__New" }, { name: "__Set" }, { name: "ahk_class" }, { name: "ahk_exe" }, { name: "ahk_group" }, { name: "ahk_id" }, { name: "ahk_pid" }, { name: "and" }, { name: "base" }, { name: "ByRef" }, { name: "class" }, { name: "extends" }, { name: "false" }, { name: "Files" }, { name: "global" }, { name: "local" }, { name: "new" }, { name: "not" }, { name: "or" }, { name: "Parse" }, { name: "ParseInt" }, { name: "Read" }, { name: "Reg" }, { name: "static" }, { name: "true" }, { name: "A_AhkPath" }, { name: "A_AhkVersion" }, { name: "A_AppData" }, { name: "A_AppDataCommon" }, { name: "A_Args" }, { name: "A_AutoTrim" }, { name: "A_BatchLines" }, { name: "A_CaretX" }, { name: "A_CaretY" }, { name: "A_ComputerName" }, { name: "A_ComSpec" }, { name: "A_ControlDelay" }, { name: "A_CoordModeCaret" }, { name: "A_CoordModeMenu" }, { name: "A_CoordModeMouse" }, { name: "A_CoordModePixel" }, { name: "A_CoordModeToolTip" }, { name: "A_Cursor" }, { name: "A_DD" }, { name: "A_DDD" }, { name: "A_DDDD" }, { name: "A_DefaultGui" }, { name: "A_DefaultListView" }, { name: "A_DefaultMouseSpeed" }, { name: "A_DefaultTreeView" }, { name: "A_Desktop" }, { name: "A_DesktopCommon" }, { name: "A_DetectHiddenText" }, { name: "A_DetectHiddenWindows" }, { name: "A_EndChar" }, { name: "A_EventInfo" }, { name: "A_ExitReason" }, { name: "A_FileEncoding" }, { name: "A_FormatFloat" }, { name: "A_FormatInteger" }, { name: "A_Gui" }, { name: "A_GuiControl" }, { name: "A_GuiControlEvent" }, { name: "A_GuiEvent" }, { name: "A_GuiHeight" }, { name: "A_GuiWidth" }, { name: "A_GuiX" }, { name: "A_GuiY" }, { name: "A_Hour" }, { name: "A_IconFile" }, { name: "A_IconHidden" }, { name: "A_IconNumber" }, { name: "A_IconTip" }, { name: "A_Index" }, { name: "A_IPAddress1" }, { name: "A_IPAddress2" }, { name: "A_IPAddress3" }, { name: "A_IPAddress4" }, { name: "A_Is64bitOS" }, { name: "A_IsAdmin" }, { name: "A_IsCompiled" }, { name: "A_IsCritical" }, { name: "A_IsPaused" }, { name: "A_IsSuspended" }, { name: "A_IsUnicode" }, { name: "A_KeyDelay" }, { name: "A_KeyDelayPlay" }, { name: "A_KeyDuration" }, { name: "A_KeyDurationPlay" }, { name: "A_Language" }, { name: "A_LastKey" }, { name: "A_LastError" }, { name: "A_LineFile" }, { name: "A_LineNumber" }, { name: "A_ListLines" }, { name: "A_LoopField" }, { name: "A_LoopFileAttrib" }, { name: "A_LoopFileDir" }, { name: "A_LoopFileExt" }, { name: "A_LoopFileFullPath" }, { name: "A_LoopFileLongPath" }, { name: "A_LoopFileName" }, { name: "A_LoopFilePath" }, { name: "A_LoopFileShortName" }, { name: "A_LoopFileShortPath" }, { name: "A_LoopFileSize" }, { name: "A_LoopFileSizeKB" }, { name: "A_LoopFileSizeMB" }, { name: "A_LoopFileTimeAccessed" }, { name: "A_LoopFileTimeCreated" }, { name: "A_LoopFileTimeModified" }, { name: "A_LoopReadLine" }, { name: "A_LoopRegKey" }, { name: "A_LoopRegName" }, { name: "A_LoopRegSubKey" }, { name: "A_LoopRegTimeModified" }, { name: "A_LoopRegType" }, { name: "A_MDay" }, { name: "A_Min" }, { name: "A_MM" }, { name: "A_MMM" }, { name: "A_MMMM" }, { name: "A_Mon" }, { name: "A_MouseDelay" }, { name: "A_MouseDelayPlay" }, { name: "A_MSec" }, { name: "A_MyDocuments" }, { name: "A_Now" }, { name: "A_NowUTC" }, { name: "A_NumBatchLines" }, { name: "A_OSType" }, { name: "A_OSVersion" }, { name: "A_PriorHotkey" }, { name: "A_PriorKey" }, { name: "A_ProgramFiles" }, { name: "A_Programs" }, { name: "A_ProgramsCommon" }, { name: "A_PtrSize" }, { name: "A_RegView" }, { name: "A_ScreenDPI" }, { name: "A_ScreenHeight" }, { name: "A_ScreenWidth" }, { name: "A_ScriptDir" }, { name: "A_ScriptFullPath" }, { name: "A_ScriptHwnd" }, { name: "A_ScriptName" }, { name: "A_Sec" }, { name: "A_SendLevel" }, { name: "A_SendMode" }, { name: "A_Space" }, { name: "A_StartMenu" }, { name: "A_StartMenuCommon" }, { name: "A_Startup" }, { name: "A_StartupCommon" }, { name: "A_StoreCapsLockMode" }, { name: "A_StringCaseSense" }, { name: "A_Tab" }, { name: "A_Temp" }, { name: "A_ThisFunc" }, { name: "A_ThisHotkey" }, { name: "A_ThisLabel" }, { name: "A_ThisMenu" }, { name: "A_ThisMenuItem" }, { name: "A_ThisMenuItemPos" }, { name: "A_TickCount" }, { name: "A_TimeIdle" }, { name: "A_TimeIdleKeyboard" }, { name: "A_TimeIdleMouse" }, { name: "A_TimeIdlePhysical" }, { name: "A_TimeSincePriorHotkey" }, { name: "A_TimeSinceThisHotkey" }, { name: "A_TitleMatchMode" }, { name: "A_TitleMatchModeSpeed" }, { name: "A_UserName" }, { name: "A_WDay" }, { name: "A_WinDelay" }, { name: "A_WinDir" }, { name: "A_WorkingDir" }, { name: "A_YDay" }, { name: "A_Year" }, { name: "A_YWeek" }, { name: "A_YYYY" }, { name: "Clipboard" }, { name: "ClipboardAll" }, { name: "ComSpec" }, { name: "ErrorLevel" }, { name: "ProgramFiles" }, { name: "this" }, { name: "Abs" }, { name: "ACos" }, { name: "Array" }, { name: "Asc" }, { name: "ASin" }, { name: "ATan" }, { name: "Ceil" }, { name: "Chr" }, { name: "ComObjActive" }, { name: "ComObjArray" }, { name: "ComObjConnect" }, { name: "ComObjCreate" }, { name: "ComObject" }, { name: "ComObjError" }, { name: "ComObjFlags" }, { name: "ComObjGet" }, { name: "ComObjQuery" }, { name: "ComObjType" }, { name: "ComObjValue" }, { name: "Cos" }, { name: "DllCall" }, { name: "Exception" }, { name: "Exp" }, { name: "FileExist" }, { name: "FileOpen" }, { name: "Floor" }, { name: "Format" }, { name: "Func" }, { name: "getDataFromEndpoint" }, { name: "GetKeyName" }, { name: "GetKeySC" }, { name: "GetKeyState" }, { name: "GetKeyVK" }, { name: "Hotstring" }, { name: "Icon" }, { name: "IL_Add" }, { name: "IL_Create" }, { name: "IL_Destroy" }, { name: "InputHook" }, { name: "InStr" }, { name: "IsByRef" }, { name: "isConnectedToBackend" }, { name: "IsFunc" }, { name: "IsLabel" }, { name: "isMobileDevice" }, { name: "IsObject" }, { name: "Ln" }, { name: "LoadPicture" }, { name: "Log" }, { name: "LTrim" }, { name: "LV_Add" }, { name: "LV_Delete" }, { name: "LV_DeleteCol" }, { name: "LV_GetCount" }, { name: "LV_GetNext" }, { name: "LV_GetText" }, { name: "LV_Insert" }, { name: "LV_InsertCol" }, { name: "LV_Modify" }, { name: "LV_ModifyCol" }, { name: "LV_SetImageList" }, { name: "Max" }, { name: "MenuGetHandle" }, { name: "MenuGetName" }, { name: "Min" }, { name: "Mod" }, { name: "NumGet" }, { name: "NumPut" }, { name: "ObjAddRef" }, { name: "ObjBindMethod" }, { name: "ObjClone" }, { name: "ObjCount" }, { name: "ObjDelete" }, { name: "Object" }, { name: "ObjGetAddress" }, { name: "ObjGetBase" }, { name: "ObjGetCapacity" }, { name: "ObjHasKey" }, { name: "ObjInsert" }, { name: "ObjInsertAt" }, { name: "ObjLength" }, { name: "ObjMaxIndex" }, { name: "ObjMinIndex" }, { name: "ObjNewEnum" }, { name: "ObjPop" }, { name: "ObjPush" }, { name: "ObjRawGet" }, { name: "ObjRawSet" }, { name: "ObjRelease" }, { name: "ObjRemove" }, { name: "ObjRemoveAt" }, { name: "ObjSetBase" }, { name: "ObjSetCapacity" }, { name: "OnClipboardChange" }, { name: "OnError" }, { name: "OnExit" }, { name: "OnMessage" }, { name: "Ord" }, { name: "RegExMatch" }, { name: "RegExReplace" }, { name: "RegisterCallback" }, { name: "Round" }, { name: "RTrim" }, { name: "StoreLocally" }, { name: "SB_SetIcon" }, { name: "SB_SetParts" }, { name: "SB_SetText" }, { name: "Sin" }, { name: "Sqrt" }, { name: "StrGet" }, { name: "StrLen" }, { name: "StrLower" }, { name: "StrPut" }, { name: "StrReplace" }, { name: "StrSplit" }, { name: "SubStr" }, { name: "Tan" }, { name: "Title" }, { name: "Trim" }, { name: "TV_Add" }, { name: "TV_Delete" }, { name: "TV_Get" }, { name: "TV_GetChild" }, { name: "TV_GetCount" }, { name: "TV_GetNext" }, { name: "TV_GetParent" }, { name: "TV_GetPrev" }, { name: "TV_GetSelection" }, { name: "TV_GetText" }, { name: "TV_Modify" }, { name: "TV_SetImageList" }, { name: "VarSetCapacity" }, { name: "WinActive" }, { name: "WinExist" }, { name: "AutoTrim" }, { name: "BlockInput" }, { name: "Click" }, { name: "ClipWait" }, { name: "Control" }, { name: "ControlClick" }, { name: "ControlFocus" }, { name: "ControlGet" }, { name: "ControlGetFocus" }, { name: "ControlGetPos" }, { name: "ControlGetText" }, { name: "ControlMove" }, { name: "ControlSend" }, { name: "ControlSendRaw" }, { name: "ControlSetText" }, { name: "CoordMode" }, { name: "Critical" }, { name: "DetectHiddenText" }, { name: "DetectHiddenWindows" }, { name: "Drive" }, { name: "DriveGet" }, { name: "DriveSpaceFree" }, { name: "Edit" }, { name: "Endpoint" }, { name: "EnvAdd" }, { name: "EnvDiv" }, { name: "EnvGet" }, { name: "EnvMult" }, { name: "EnvSet" }, { name: "EnvSub" }, { name: "EnvUpdate" }, { name: "Exit" }, { name: "ExitApp" }, { name: "FileAppend" }, { name: "FileCopy" }, { name: "FileCopyDir" }, { name: "FileCreateDir" }, { name: "FileCreateShortcut" }, { name: "FileDelete" }, { name: "FileEncoding" }, { name: "FileGetAttrib" }, { name: "FileGetShortcut" }, { name: "FileGetSize" }, { name: "FileGetTime" }, { name: "FileGetVersion" }, { name: "FileInstall" }, { name: "FileMove" }, { name: "FileMoveDir" }, { name: "FileRead" }, { name: "FileReadLine" }, { name: "FileRecycle" }, { name: "FileRecycleEmpty" }, { name: "FileRemoveDir" }, { name: "FileSelectFile" }, { name: "FileSelectFolder" }, { name: "FileSetAttrib" }, { name: "FileSetTime" }, { name: "FormatTime" }, { name: "getDataFromAPI" }, { name: "getDataFromJSON" }, { name: "GetKeyState" }, { name: "getUrlParams" }, { name: "GroupActivate" }, { name: "GroupAdd" }, { name: "GroupClose" }, { name: "GroupDeactivate" }, { name: "Gui" }, { name: "GuiControl" }, { name: "GuiControlGet" }, { name: "Hotkey" }, { name: "ImageSearch" }, { name: "IniDelete" }, { name: "IniRead" }, { name: "IniWrite" }, { name: "Input" }, { name: "InputBox" }, { name: "KeyHistory" }, { name: "KeyWait" }, { name: "ListHotkeys" }, { name: "ListLines" }, { name: "ListVars" }, { name: "Menu" }, { name: "MouseClick" }, { name: "MouseClickDrag" }, { name: "MouseGetPos" }, { name: "MouseMove" }, { name: "MsgBox" }, { name: "OnExit" }, { name: "OutputDebug" }, { name: "Pause" }, { name: "PixelGetColor" }, { name: "PixelSearch" }, { name: "PostMessage" }, { name: "Process" }, { name: "Progress" }, { name: "Random" }, { name: "RegDelete" }, { name: "RegRead" }, { name: "RegWrite" }, { name: "Reload" }, { name: "reloadWithParams" }, { name: "Run" }, { name: "RunAs" }, { name: "RunWait" }, { name: "Send" }, { name: "SendEvent" }, { name: "SendInput" }, { name: "SendLevel" }, { name: "SendMessage" }, { name: "SendMode" }, { name: "SendPlay" }, { name: "SendRaw" }, { name: "SetBatchLines" }, { name: "SetCapsLockState" }, { name: "SetControlDelay" }, { name: "SetDefaultMouseSpeed" }, { name: "SetEnv" }, { name: "SetFormat" }, { name: "SetKeyDelay" }, { name: "SetMouseDelay" }, { name: "SetNumLockState" }, { name: "SetRegView" }, { name: "SetScrollLockState" }, { name: "SetStoreCapsLockMode" }, { name: "SetTimer" }, { name: "SetTitleMatchMode" }, { name: "SetWinDelay" }, { name: "SetWorkingDir" }, { name: "Shutdown" }, { name: "Sleep" }, { name: "Sort" }, { name: "SoundBeep" }, { name: "SoundGet" }, { name: "SoundGetWaveVolume" }, { name: "SoundPlay" }, { name: "SoundSet" }, { name: "SoundSetWaveVolume" }, { name: "SplashImage" }, { name: "SplashTextOff" }, { name: "SplashTextOn" }, { name: "SplitPath" }, { name: "StatusBarGetText" }, { name: "StatusBarWait" }, { name: "StringCaseSense" }, { name: "StringGetPos" }, { name: "StringLeft" }, { name: "StringLen" }, { name: "StringLower" }, { name: "StringMid" }, { name: "StringReplace" }, { name: "StringRight" }, { name: "StringSplit" }, { name: "StringTrimLeft" }, { name: "StringTrimRight" }, { name: "StringUpper" }, { name: "Suspend" }, { name: "SysGet" }, { name: "Thread" }, { name: "ToolTip" }, { name: "Transform" }, { name: "TrayTip" }, { name: "URLDownloadToFile" }, { name: "WinActivate" }, { name: "WinActivateBottom" }, { name: "WinClose" }, { name: "WinGet" }, { name: "WinGetActiveStats" }, { name: "WinGetActiveTitle" }, { name: "WinGetClass" }, { name: "WinGetPos" }, { name: "WinGetText" }, { name: "WinGetTitle" }, { name: "WinHide" }, { name: "WinKill" }, { name: "WinMaximize" }, { name: "WinMenuSelectItem" }, { name: "WinMinimize" }, { name: "WinMinimizeAll" }, { name: "WinMinimizeAllUndo" }, { name: "WinMove" }, { name: "WinRestore" }, { name: "WinSet" }, { name: "WinSetTitle" }, { name: "WinShow" }, { name: "WinWait" }, { name: "WinWaitActive" }, { name: "WinWaitClose" }, { name: "WinWaitNotActive" }];
// Create a new div element for the editor
var editorDiv = document.createElement("div");
editorDiv.id = id;
editorDiv.style.position = "absolute";
editorDiv.style.left = xPos + "px";
editorDiv.style.top = yPos + "px";
editorDiv.style.width = w + "px";
editorDiv.style.height = h + "px";
editorDiv.style.fontSize = font + "px";
// Append the editor div to the parent
parent.appendChild(editorDiv);
// Create a new editor instance inside the div
var editor = ace.edit(id);
editor.setTheme("ace/theme/monokai");
editor.session.setMode("ace/mode/" + langName);
// editor.setOptions({
// enableBasicAutocompletion: true,
// enableLiveAutocompletion: true,
// behavioursEnabled: false, // Disable auto-pairing of characters
// });
editor.setOptions({
enableBasicAutocompletion: false,
enableSnippets: false,
enableLiveAutocompletion: true,
behavioursEnabled: false,
showPrintMargin: false,
});
langTools.setCompleters([]);
langTools.addCompleter(Completer);
// Set initial text if provided
if (initialText) {
editor.setValue(initialText, -1); // -1 to move cursor to the beginning
}
// Apply CSS styles for the editor
var css = `
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background-color: #1a1818;
color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
margin: 0;
}
.controls {
display: flex;
justify-content: center;
gap: 1rem;
margin: 1rem;
padding: 1rem;
}
button {
padding: 0.7rem;
font-size: 1.2em;
cursor: pointer;
background-color: #bababa;
color: #000000;
border: none;
border-radius: 0.2rem;
transition: background-color 0.3s;
}
button:hover {
background-color: #27ae60;
}
#${id} {
width: ${w}px;
height: ${h}px;
font-size: 1em;
border-radius: 0.3rem;
}
#result {
margin-top: 1rem;
font-size: 1.2em;
color: #999c9a;
font-weight: bold;
text-align: center;
}
.ace-monokai .ace_marker-layer .ace_active-line {
background-color: #103010 !important;
}
.ace-monokai {
background-color: #121212 !important;
color: #f8f8f2;
}
.ace-monokai .ace_gutter {
background: #204020 !important;
color: #cbcdc3 !important;
}
.ace-monokai .ace_gutter-active-line {
background-color: transparent !important;
}
.ace-monokai .ace_entity.ace_name.ace_tag,
.ace-monokai .ace_keyword,
.ace-monokai .ace_meta.ace_tag,
.ace-monokai .ace_storage {
color: #40a0e0 !important;
}
.ace-monokai .ace_entity.ace_name.ace_function,
.ace-monokai .ace_entity.ace_other,
.ace-monokai .ace_entity.ace_other.ace_attribute-name,
.ace-monokai .ace_variable {
color: #ff80df !important;
}
.ace-monokai .ace_comment {
color: #40d080 !important;
}
.ace-monokai .ace_string {
color: #ffa0a0 !important;
}
.ace-monokai .ace_punctuation,
.ace-monokai .ace_punctuation.ace _tag {
color: #ffa0a0 !important;
}
*::-webkit-scrollbar {
width: 1em;
}
*::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
*::-webkit-scrollbar-thumb {
background-color: darkgrey;
outline: 1px solid slategrey;
}
`;
var style = document.createElement("style");
style.type = "text/css";
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
document.head.appendChild(style);
// Bind change event listener to the editor
editor.getSession().on("change", function () {
var code = editor.getValue();
if (typeof onChangeFunc === "function") {
onChangeFunc(code);
}
});
}
async function runPyCode(code) {
return new Promise((resolve, reject) => {
const checkReady = () => {
if (window.runPythonCode) {
resolve(window.runPythonCode(code));
} else {
setTimeout(checkReady, 100);
}
};
checkReady();
});
}
// Define the str function
function str(value) {
return String(value);
}
// Single async function to structure the entire script
async function runScript() {
// Declare and assign a variable
let funcs = {
indent_nested_curly_braces: indent_nested_curly_braces,
RepeatSpaces: RepeatSpaces,
ifTheLineIsAFuncDec: ifTheLineIsAFuncDec,
isVarAnumKindaVar: isVarAnumKindaVar,
varDetect: varDetect,
funcToChecIfVaidNameForFunc: funcToChecIfVaidNameForFunc,
transpileVariables: transpileVariables,
transpileLowVariables: transpileLowVariables,
compiler: compiler,
}
var Gui1 = {};
Gui1 = document.createElement("div");
var Gui2 = {};
Gui2 = document.createElement("div");