views:

1274

answers:

4

I have a HTML application, partially HTML, partially VBscript, disguised as a form. What it does is it opens a few local files, runs a DOS box containing GAWK and presents a text file as its result. I wish to expand upon it by letting it create a bitmap image with the results in a stacked bar graph, for instance as a .BMP file. But I'm stumped. I haven't the faintest idea where to start.

+3  A: 

Is javascript an option? That would be a lot easier than creating an image file.

I have used this jquery plugin http://code.google.com/p/flot/ a few times and works well.

I have not used VBScript for a few years now, think you would probably need to use an active-x object of some kind to generate an image file, but I could be wrong there.

seanb
JS is definitely an option. I'll leave the wondering why I didn't think of JS to you. Flot looks like it's gonna save me a heck of a lot of time as well. I'll investigate. Thanks!
A: 

Graphics are beyond the capabilities of VBScript alone. You can try if you find an ActiveX/COM component that can do it for you. Looking into Google, my guess is that most of them come as dumbed-down trial versions of quite expensive commercial products. Maybe someone else here knows one that is for free.

As an alternative route, you could set up a web service somewhere that does the image processing (for example PHP/gdlib) using URL parameters. Then you would just have to link to the image in your HTA with an <img> tag like you normally would.

Tomalak
Where this app is used most, there's no web access, unfortunately.
A: 

I believe you will be able to use this library http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm in VBScript too. It can be used to draw all kinds of shapes lines, rectangles, circles etc

Once you have drawn the graph you can print the page to a PDF printer (like cutePDF) to get the image onto a file for later use.

SDX2000
A: 

The Microsoft Scripting Guys came out with an article which discussed his quite a while ago, but it involves using the Excel ActiveX control or the OWC control the article is really detailed in how to do it, look here: http://www.microsoft.com/technet/scriptcenter/topics/activex/chart.mspx

mrTomahawk