Showing posts with label HTA. Show all posts
Showing posts with label HTA. Show all posts

Wednesday, September 28, 2005

[MetaCard and Tcl] Broggle's cousin at home on the iBook

MetaCard's great but I can't afford to buy it (not that you can anyway, now that it's been subsumed into Runtime Revolution). But using the demo version means I keep bumping up against an inbuilt limit for scripts. So I hit upon the idea of bypassing the issue by calling external scripts.

The tool I use to write blogs at home (as opposed to the HTA I use elsewhere) is written in MetaCard and does the render and preview passes using Tcl.

[Aside: Not that there's anything about Tcl that lends itself to the job. I could have used Perl, Lua, Python, sed (maybe), awk, or any number of other languages from Algol68 (there's an implementation for Mac OS X believe it or not) right through to Zen BASIC. It's just that Tcl is familiar ground.]

Right, where was I. Oh yes ...

First the script in my "Render" button ...
... which creates a file in the temporary folder (I'm on Mac OS X here ... might work on Linux ... have to do something drastic for Windows), and puts my marked-up text from field fSource into it. Then it shells out to render.tcl and captures its output into the fGenerated field. The temporary file is deleted.

Render.tcl looks like this (in its current incarnation):
This script inhales the file specified on the command line, splits it on newline and works its way through the lines, outputting HTML according to the rules of the markup: @ in column 1 identifies markup and there are currently four types: text, code, quot and end. Very simple, but it does me fine ... for now.

So after this runs, there's HTML in the fGenerated field. If I want to see how it's going to turn out in a browser, then I click on the Preview button. Okay, so it won't have all the CSS definitions that blogspot/blogger would apply but I get a useful approximation.

The script for the Preview button ...
... is similar to that of the Render button except this time I create an .html file in /tmp and and write the contents of the fGenerated field to it. I ignore the output of the shell() command.

I haven't quite figured out how to delete the temporary file because, if I uncomment the "delete file", by the time Safari is ready to load the file it's gone. There might be some way of making the shell synchronous, the way that /WAIT does on Win2k's START command, but then that'd probably mean waiting until Safari quits before I can use my blog writer again ... definitely sub-optimal. Then again, it'd be waiting for "open" to close, which happens as soon as it's launched Safari. And it's 10:48 pm and ...

Well, that's it. I really enjoyed this short break away from the long run of VBScript posts. I've got more stuff cooking here at home including a short foray into Javascript (a language I should have learned ages ago). Till then ...

Friday, September 09, 2005

[VBScript] Evaluator

A quick scripting environment so that I could bash out a few lines, get the results easily and put them on the clipboard.

Have been using the Vrode Editor 1.1 for HTA development.

Wednesday, September 07, 2005

[VBScript/HTA] More Broggle

The next version of Broggle with the readonly textarea for the code.

Thursday, August 25, 2005

[VBScript/HTA] Broggle on Steroids

Big changes to Broggle.hta. No more #code/#endcode etc. Just #text, #code, #quot and #end. Now the HTA is more in line with the MetaCard and Tcl version at home on the iBook. I've also put in a preview button (which should probably be somewhere other than where it is right now) which puts the conversion results into a <DIV> at the bottom (thus the scrollbar at the side.)

Enjoy


Thursday, August 18, 2005

Broggle - a blogging tool in an HTML application

Okay, now a quick shift from straight VBScript to VBScript inside an HTML application. It's to deal with formatting issues I have with Blogger. The solution is probably way simpler than this.

Saved as Broggle.hta and then double-click launched in Explorer.

Just put "#code" and "#endcode" around code and "#text" and "#endtext" around text, click on [Evaluate], then click on [Copy to Clipboard], and then paste into the blog.

Tuesday, August 16, 2005

HTA - HTML applications

I've played with this one from time to time and would like sometime to take it a bit further. It's a text editor written as an HTML application, good for doing CScript and WScript.

Simple VBScript Development Tool

It's also good an example of what you can do with HTML applications, especially the idea of being able to put a functional interactive GUI front end over VBScript (and JScript).