Spoiler
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Persistent
SetTitleMatchMode, 2
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try ; leads to having the script re-launching itself as administrator
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
Gui, New
Gui, Add, Edit, h500 w500 vJSin
Gui, Add, Button, y+5 Default, Submit
gui, Show, , AHK Javascript Tester (HTA)
return
Escape::ExitApp
ButtonSubmit:
IfExist, myHta.hta
FileDelete, myHta.hta
Gui,Submit, NoHide
GuiControlGet, JS, , JSin
code =
(
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=windows-1252" http-equiv="content-type">
<title>JS Tester</title>
<HTA:APPLICATION
APPLICATIONNAME="AHK JS Tester"
ID="ahk_js_tester"
border = "thin"
borderStyle = "tool"
caption = "yes"
contextMenu = "no"
maximizeButton = "no"
minimizeButton = "yes"
navigable = "no"
showInTaskbar = "yes"
singleInstance = "yes"
scroll = "no"
sysmenu = "yes"
windowState = "normal"
VERSION="1.0"/>
</head>
<body>
<script language="JavaScript">
%JS%
</script>
</body>
</html>
)
FileAppend, %code%, myHta.hta
Run, myHta.hta
return
- hta_tester.gif (144.98 KiB) Viewed 1847 times