Skip to content

Instantly share code, notes, and snippets.

@efreed
Created January 26, 2018 21:27
Show Gist options
  • Save efreed/cb48febf2b67c426234dcc930fdea13f to your computer and use it in GitHub Desktop.
Save efreed/cb48febf2b67c426234dcc930fdea13f to your computer and use it in GitHub Desktop.
Hypertext application demo
<HTML XMLNS:HTA><HEAD>
<TITLE>App Without A Cool Acronym</TITLE>
<HTA:APPLICATION id=oApp APPLICATIONNAME="IDHERE"
BORDER="thick" CAPTION="yes"
icon="http://dkcoin8.com/images/whatsapp-cool-clipart-9.vnd.microsoft.icon"
SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes"
WINDOWSTATE="normal" SCROLL="yes" SCROLLFLAT="yes" VERSION="1.0">
</HTA:APPLICATION>
<SCRIPT language=JScript>
function WriteFile(FilePath, Content) {
var fso, f;
var ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(FilePath,ForWriting);
f.WriteLine(Contents);
}
function DispData() {
document.body.innerHTML+= "CommandLine) "+oApp.commandLine.replace('"','').replace('"','')+"<br>";
var fso, f;
var ForReading = 1;
var ForWriting = 2;
fso = new ActiveXObject(
"Scripting.FileSystemObject");
aPath = oApp.commandLine.replace('"','').replace('"','').split("\\");
FileName = aPath[aPath.length-1];
f = fso.GetFile(FileName);
// Output info about the file
document.body.innerHTML+= "Attributes) "+f.attributes+"<br>";
document.body.innerHTML+= "DateCreated) "+f.DateCreated+"<br>";
document.body.innerHTML+= "DateLastModified) "+f.DateLastModified+"<br>";
document.body.innerHTML+= "Size) "+f.Size+"<br>";
ts = f.OpenAsTextStream(ForReading);
while (s = ts.ReadLine()) {
document.getElementById("box").value += s + "\n";
}
ts.Close();
}
</SCRIPT>
</HEAD>
<BODY>
<button onclick="DispData()">run me</button><br>
<textarea id="box" style="width:100%; height:150px;"></textarea><br>
<br>
</BODY>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment