Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 68b6c1b

Browse files
committed
added null
1 parent c550e3f commit 68b6c1b

6 files changed

Lines changed: 874 additions & 841 deletions

File tree

HTH-Playground.hth

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3927,6 +3927,11 @@ if (out2 = "disable")
39273927
out0 := "GuiControl(" . Chr(34) . "" . out2 . "" . Chr(34) . ", " . Chr(34) . "Gui" . GuiNumber . "" . out3 . ");"
39283928
}
39293929

3930+
if (out2 = "destroy")
3931+
{
3932+
out0 := "GuiControl(" . Chr(34) . "" . out2 . "" . Chr(34) . ", " . Chr(34) . "Gui" . GuiNumber . "" . out3 . ");"
3933+
}
3934+
39303935
if (out2 = "enable")
39313936
{
39323937
out0 := "GuiControl(" . Chr(34) . "" . out2 . "" . Chr(34) . ", " . Chr(34) . "Gui" . GuiNumber . "" . out3 . ");"
@@ -5780,7 +5785,7 @@ StringTrimRight, jsCode, outJScodeLastTime2, 1
57805785

57815786

57825787

5783-
jsCode := "`n" . "// Declare and assign a variable`nlet variables = {};`n" . jsCode . "`n"
5788+
jsCode := "`n" . "// Declare and assign a variable`nlet variables = {`nnull: null,`n};`n" . jsCode . "`n"
57845789

57855790
funcs .= "}"
57865791

@@ -5874,7 +5879,7 @@ addFuncIfWeUseIt_isMobileDevice := "`n function isMobileDevice() {`n
58745879

58755880
addFuncIfWeUseIt_SetTimer := "`n // Object to store timer intervals for different functions`n const timerIntervals = {};`n`n async function SetTimer(func, timeOrOnOff) {`n if (typeof func !== " . Chr(34) . "function" . Chr(34) . " || typeof timeOrOnOff === " . Chr(34) . "undefined" . Chr(34) . ") {`n console.error(" . Chr(34) . "Invalid arguments. Please provide a valid function and time/On/Off state." . Chr(34) . ");`n return;`n }`n`n if (typeof timeOrOnOff === " . Chr(34) . "number" . Chr(34) . ") {`n // If a number is provided, set the timer to that time in milliseconds and start it.`n func.interval = timeOrOnOff; // Store the interval within the function`n func(); // Call the function initially`n func.intervalId = setInterval(func, timeOrOnOff);`n timerIntervals[func] = func.intervalId; // Store the interval ID`n } else if (timeOrOnOff === " . Chr(34) . "On" . Chr(34) . ") {`n // If 'On' is provided, start the timer if it's not already running.`n if (!func.intervalId && func.interval) {`n func(); // Call the function initially`n func.intervalId = setInterval(func, func.interval); // Start with the stored interval`n timerIntervals[func] = func.intervalId; // Store the interval ID`n } else {`n console.error(" . Chr(34) . "Timer is not set. Please provide a valid interval." . Chr(34) . ");`n }`n } else if (timeOrOnOff === " . Chr(34) . "Off" . Chr(34) . ") {`n // If 'Off' is provided, clear the timer if it's running.`n clearInterval(func.intervalId);`n func.intervalId = null;`n delete timerIntervals[func]; // Remove the interval ID from storage`n } else {`n console.error(" . Chr(34) . "Invalid time/On/Off state. Please provide a valid time in milliseconds or 'On'/'Off'." . Chr(34) . ");`n }`n }`n"
58765881

5877-
addFuncIfWeUseIt_GuiControl := "`n function GuiControl(action, id, param1, param2, param3, param4) {`n const element = document.getElementById(id);`n if (element) {`n // Handle DOM elements`n if (action === " . Chr(34) . "move" . Chr(34) . ") {`n // Set position and size`n element.style.left = param1 + " . Chr(34) . "px" . Chr(34) . ";`n element.style.top = param2 + " . Chr(34) . "px" . Chr(34) . ";`n element.style.width = param3 + " . Chr(34) . "px" . Chr(34) . ";`n element.style.height = param4 + " . Chr(34) . "px" . Chr(34) . ";`n } else if (action === " . Chr(34) . "focus" . Chr(34) . " && (element instanceof HTMLInputElement || element instanceof HTMLElement)) {`n // Focus on the element`n element.focus();`n } else if (action === " . Chr(34) . "text" . Chr(34) . ") {`n // Set new text content`n element.textContent = param1;`n } else if (action === " . Chr(34) . "hide" . Chr(34) . ") {`n // Hide the element`n element.style.display = " . Chr(34) . "none" . Chr(34) . ";`n } else if (action === " . Chr(34) . "show" . Chr(34) . ") {`n // Show the element`n element.style.display = " . Chr(34) . "" . Chr(34) . ";`n } else if (action === " . Chr(34) . "enable" . Chr(34) . ") {`n // Enable the element`n element.disabled = false;`n } else if (action === " . Chr(34) . "disable" . Chr(34) . ") {`n // Disable the element`n element.disabled = true;`n } else if (action === " . Chr(34) . "font" . Chr(34) . ") {`n // Set font size`n element.style.fontSize = param1 + " . Chr(34) . "px" . Chr(34) . ";`n } else if (action === " . Chr(34) . "color" . Chr(34) . ") {`n // Set color`n element.style.color = param1;`n } else if (action === " . Chr(34) . "picture" . Chr(34) . ") {`n // Change the image source`n if (element instanceof HTMLImageElement) {`n element.src = param1;`n } else {`n console.error(" . Chr(34) . "Element is not an <img> tag, cannot change picture." . Chr(34) . ");`n }`n } else if (action === " . Chr(34) . "textide" . Chr(34) . ") {`n // Set value for Ace editor`n var editor = ace.edit(id); // Access the Ace editor instance using its ID`n if (editor && param1) {`n editor.session.setValue(param1);`n } else {`n console.error(" . Chr(34) . "Element is not an Ace editor or parameter is missing." . Chr(34) . ");`n }`n }`n } else {`n // Handle canvas or non-existing element`n if (action === " . Chr(34) . "move" . Chr(34) . ") {`n // Update position and size of the rectangle`n updateRectangle(id, param1, param2, param3, param4);`n redrawCanvas(); // Redraw the canvas with updated rectangles`n } else if (action === " . Chr(34) . "color" . Chr(34) . ") {`n // Update color of the rectangle`n updateRectangleColor(id, param1);`n redrawCanvas(); // Redraw the canvas with updated rectangles`n }`n }`n }`n"
5882+
addFuncIfWeUseIt_GuiControl := "`n function GuiControl(action, id, param1, param2, param3, param4) {`n const element = document.getElementById(id);`n if (element) {`n // Handle DOM elements`n if (action === " . Chr(34) . "move" . Chr(34) . ") {`n // Set position and size`n element.style.left = param1 + " . Chr(34) . "px" . Chr(34) . ";`n element.style.top = param2 + " . Chr(34) . "px" . Chr(34) . ";`n element.style.width = param3 + " . Chr(34) . "px" . Chr(34) . ";`n element.style.height = param4 + " . Chr(34) . "px" . Chr(34) . ";`n } else if (action === " . Chr(34) . "focus" . Chr(34) . " && (element instanceof HTMLInputElement || element instanceof HTMLElement)) {`n // Focus on the element`n element.focus();`n } else if (action === " . Chr(34) . "text" . Chr(34) . ") {`n // Set new text content`n element.textContent = param1;`n } else if (action === " . Chr(34) . "hide" . Chr(34) . ") {`n // Hide the element`n element.style.display = " . Chr(34) . "none" . Chr(34) . ";`n } else if (action === " . Chr(34) . "show" . Chr(34) . ") {`n // Show the element`n element.style.display = " . Chr(34) . "" . Chr(34) . ";`n } else if (action === " . Chr(34) . "enable" . Chr(34) . ") {`n // Enable the element`n element.disabled = false;`n } else if (action === " . Chr(34) . "disable" . Chr(34) . ") {`n // Disable the element`n element.disabled = true;`n } else if (action === " . Chr(34) . "font" . Chr(34) . ") {`n // Set font size`n element.style.fontSize = param1 + " . Chr(34) . "px" . Chr(34) . ";`n } else if (action === " . Chr(34) . "destroy" . Chr(34) . ") {`n // Remove the element from the DOM`n element.parentNode.removeChild(element);`n } else if (action === " . Chr(34) . "color" . Chr(34) . ") {`n // Set color`n element.style.color = param1;`n } else if (action === " . Chr(34) . "picture" . Chr(34) . ") {`n // Change the image source`n if (element instanceof HTMLImageElement) {`n element.src = param1;`n } else {`n console.error(" . Chr(34) . "Element is not an <img> tag, cannot change picture." . Chr(34) . ");`n }`n } else if (action === " . Chr(34) . "textide" . Chr(34) . ") {`n // Set value for Ace editor`n var editor = ace.edit(id); // Access the Ace editor instance using its ID`n if (editor && param1) {`n editor.session.setValue(param1);`n } else {`n console.error(" . Chr(34) . "Element is not an Ace editor or parameter is missing." . Chr(34) . ");`n }`n }`n } else {`n // Handle canvas or non-existing element`n if (action === " . Chr(34) . "move" . Chr(34) . ") {`n // Update position and size of the rectangle`n updateRectangle(id, param1, param2, param3, param4);`n redrawCanvas(); // Redraw the canvas with updated rectangles`n } else if (action === " . Chr(34) . "color" . Chr(34) . ") {`n // Update color of the rectangle`n updateRectangleColor(id, param1);`n redrawCanvas(); // Redraw the canvas with updated rectangles`n }`n }`n }`n"
58785883

58795884
addFuncIfWeUseIt_getDataFromEndpoint := "`n async function getDataFromEndpoint(data, endpoint) {`n // Convert data to JSON string`n const requestData = JSON.stringify(data);`n`n // Set up fetch request options`n const requestOptions = {`n method: " . Chr(34) . "POST" . Chr(34) . ", // or 'GET' depending on your server's requirements`n headers: {`n " . Chr(34) . "Content-Type" . Chr(34) . ": " . Chr(34) . "application/json" . Chr(34) . ",`n },`n body: requestData,`n };`n`n // Fetch data from the specified endpoint`n const response = await fetch(endpoint, requestOptions);`n`n // Check if response is successful`n if (!response.ok) {`n throw new Error(" . Chr(96) . "Failed to fetch data from ${endpoint}. Status: ${response.status}" . Chr(96) . ");`n }`n`n // Parse response data based on Content-Type header`n const contentType = response.headers.get(" . Chr(34) . "content-type" . Chr(34) . ");`n if (contentType && contentType.includes(" . Chr(34) . "application/json" . Chr(34) . ")) {`n return response.json(); // Parse JSON response`n } else {`n return response.text(); // Parse plain text response`n }`n }`n"
58805885

HTH.ahk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ removeCurlyBracet := 0
156156
variables .= " " . "A_Index" . ": null," . "`n"
157157
variables .= " " . "A_LoopField" . ": null," . "`n"
158158
variables .= " " . "characters" . ": null," . "`n"
159+
variables .= " " . "null" . ": null," . "`n"
159160

160161
jsCodeGui := ""
161162

@@ -6474,6 +6475,14 @@ GuiControl("%out2%", "Gui%GuiNumber%%out3%);
64746475
)
64756476
}
64766477

6478+
if (out2 = "destroy")
6479+
{
6480+
out0 =
6481+
(
6482+
GuiControl("%out2%", "Gui%GuiNumber%%out3%);
6483+
)
6484+
}
6485+
64776486
if (out2 = "enable")
64786487
{
64796488
out0 =
@@ -9258,7 +9267,10 @@ addFuncIfWeUseIt_GuiControl =
92589267
} else if (action === "font") {
92599268
// Set font size
92609269
element.style.fontSize = param1 + "px";
9261-
} else if (action === "color") {
9270+
} else if (action === "destroy") {
9271+
// Remove the element from the DOM
9272+
element.parentNode.removeChild(element);
9273+
} else if (action === "color") {
92629274
// Set color
92639275
element.style.color = param1;
92649276
} else if (action === "picture") {

HTH.exe

512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)