Return to Snippet

Revision: 38866
at January 9, 2011 04:53 by TopcatSoftware


Initial Code
<!--

Instant GUI for AWK output - Topcat Software LLC. 2009
http://www.topcat.hypermart.net/index.html

This example will capture the output of your AWK program
and render that output dynamically to an HTML stream
within a graphical window.

Requires Windows, and the WSH scripting host, both
of which are native to any modern Windows installation.

To use this example, follow these three steps:

1. Save this example to a file with an extension of 'HTA'
eg - 'example.hta' (HTA meaning 'HyperText Application'
is a proprietary format for Internet Explorer).

2. Edit the line below containing 'program.awk datafile'
and replace with your AWK program file, and your datafile.

3. double click your HTA file to run it.

-->

<html>
<head>
<title>My application</title>

<hta:application
id="MyApp"
applicationName="My application"
border="thick"
borderStyle="normal"
caption="yes"
contextMenu="yes"
icon=""
innerBorder="no"
maximizeButton="yes"
minimizeButton="yes"
navigable="yes"
scroll="yes"
scrollFlat="no"
selection="yes"
showInTaskBar="yes"
singleInstance="yes"
sysMenu="yes"
version="1.0"
windowState="normal">

</head>
<body>

<script type="text/vbscript">
Set wsh  = CreateObject("Wscript.Shell")
Set fso  = CreateObject("Scripting.FileSystemObject")
TempFile = fso.GetSpecialFolder(2) &  "\" & fso.GetTempName

wsh.Run "%comspec% /c gawk -f program.awk datafile" & " > " & TempFile, 0, True
Set otf = fso.OpenTextFile(TempFile, 1)
buf     = otf.ReadAll
otf.Close
Set otf = fso.GetFile(TempFile)
otf.Delete

Set otf = Nothing
Set fso = Nothing
Set wsh = Nothing

buf = Replace(buf,"<", "<")
buf = Replace(buf,">", ">")

document.write("<pre>" & buf & "</pre>")
</script>

</body>
</html>

Initial URL
http://www.topcat.hypermart.net/index.html

Initial Description
Quick & dirty gui for awk scripts under Windows using an 'HTA' (hyper text application)

Initial Title
GUI for AWK Scripts in Windows

Initial Tags


Initial Language
Awk