View Single Post
Old Jul 12th, 2006, 4:39 PM   #4
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
DaWei: I think this is more a system admin application of VBScript than a web-page one (though it could be it's both).

If you're running VB through the Windows Scripting Host, it's not easy to pop up a progress bar. You can use MsgBox and InputBox to interact with the user (consider yourself lucky; JScript running through the WSH doesn't even have an InputBox to play with!) but progress bars are far trickier.

In the olden days, people used to create instances of IE as automation objects within their WSH hosted VB/JScripts and squirt HTML into them to build forms and pages and interact with the user, but IE's 'security enhancements' have pretty much broken this. If you know the end users have MS Office, you might be able to use Office apps to do this, but it's very fiddly (kind of like eating spaghetti with a pitchfork).

Another method that works is to write a tiny application that just displays a centered dialog with a message on it; you can pass this in from a command line argument so that your baby app is more generally useful. I wrote one of these called busy.exe (not very original I know); if you have it, you can call it from batch files, VBScript, JScript etc. and have it pop up then kill it when you're done. Mine wasn't a progress bar (that would be quite involved) - just a fairly plain 'busy dialog' that could be terminated in various ways from the outside but not in obvious ways the user could see. I don't have the code for that app lying around but it takes about 5 minutes in VB6 to throw something like this together. It gave me something I could throw onto the screen to say the machine was working on something. If you want it actually to grab the input focus and stop the user doing something else, you need to make Win32 API calls in VB6 since it doesn't have system modal forms built in.

To write really interactive GUI enabled scripts very quickly (and they're even portable between Win32, Unix and MacOS), it might be worth checking out Tcl/Tk (see http://www.tcl.tk/ ) - it'll involve a bit of a learning curve but I do think you'll find it's worth it. Alternatively, there's always VB6; if you can already write VBScript, you can learn VB6 in an afternoon and it gives you a lot more flexibility than VBScript while still having easy access to the various ActiveX objects (like Scripting.FileSystemObject) that you're used to using. It's not as good as Tcl/Tk but it'd probably be faster for you to learn, and now that it's obsolete you should be able to pick it up cheaply

Whew, anyway, best of luck.
__________________
"I'm not a genius. Why do I have to suffer?"
mackenga is offline   Reply With Quote