Sunday, October 14, 2007

SoftGrid scripting: hiding the DOS box

So you have created your wonderful SoftGrid script that performs the most advanced features known to man, but there is always that annoying DOS box that keeps on popping up when you use SCRIPTBODY or even when you use a HREF tag to launch the script? (Yeah that's right, also with HREF you can get DOS boxes...).

Here is a workaround to launch an external script to hide the DOS box. The idea is very simple: you use a Visual Basic script that runs the batch file in the background, thus effectively hiding all output!

The VBScript code is a single line and as follows:
CreateObject("Wscript.Shell").Run WScript.Arguments(0), 0, False
Save this file as HideDOS.vbs on your content share, for example in the Tools folder or something. Then call your external script called G:\Doit.bat using the following syntax:

<SCRIPT TIMING="PRE" EVENT="LAUNCH" WAIT="TRUE" PROTECT="TRUE">
<HREF>wscript \\server\content\Tools\HideDOS.vbs G:\Doit.bat</HREF>
</SCRIPT>


There you go, gone is the DOS box!

1 comment:

Anonymous said...

As one who merely dabbles in VBS but must master SoftGrid, this is going to be very useful. Thanks!

-- brinkcm from softgridguru.com