/ Published in: Awk
Quick & dirty gui for awk scripts under Windows using an 'HTA' (hyper text application)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!-- 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> <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>
URL: http://www.topcat.hypermart.net/index.html