How hta Changed the Way I Deliver Builds - Part 5 - Opening Windows Explorer and Dev Build hta
Sean 'Bear' Forward
Senior Structural Designer\CAD Administrator @ Universal Site Solutions
The one thing I do like about the hta interface isn't so much the fact that I now have a way to deliver builds, but the fact that I can add a lot more value to these builds through the same interface. One of the easier, but more popular, additions is the Explore button I have on all my hta files. The idea here is that instead of having to search Windows Explorer through a great list of paths, I can use the variables in the hta to open Explorer straight to where I need to be.
The code for the button is fairly simple:
<div align="left">
<p>
<input id=startexpldirbutton type="button" value="Explorer" name="startexpldir" style="width=60px" onclick?="startexpldir">
</p>
</div>
The sub is fairly straight forward as well. Note how the path has been given it's own variable in this case.
The is the great advantage of having standard company builds which include standard directory structures.
Next, as I've mentioned before, I run 2 different builds. One build is for testing and development and the other is the active main build. NOTHING is live tested, everything is testing in the dev build first before deploying.
As such I also run a different hta file for the dev build. The main guts of the file run the same as we have looked at in the articles to date, but with a few subtle differences. The first of these is that I add an extra set of buttons so I can debug the build. To do the debug requires a subtle change to the code we used for application start:
Sub StartV8bug
objFSO.CopyFile SitePath + "MS85\Standards\data\std_appl.cfg" , "C:\Program Files (x86)\Bentley2004\Program\MicroStation\config\appl\", OverwriteExisting
WshShell.Run """C:\Program Files (x86)\Bentley2004\Program\MicroStation\ustation.exe"" -debug=4"
End Sub
Take note of where the debug string sits at the end of the run string. This can be modified for any Bentley vertical application:
Sub StartV8BSbug
objFSO.CopyFile SitePath + "MS85\Standards\data\std_appl.cfg" , "C:\Program Files (x86)\Bentley2004\Program\MicroStation\config\appl\", OverwriteExisting
WshShell.run """C:\Program Files (x86)\Bentley2004\Program\MicroStation\ustation.exe"" -wc""C:\Program Files (x86)\Bentley2004\Program\TriForma\config\stflocal.cfg"" -debug=4"
End Sub
To finish it all off I then have a final set of buttons to open the msdebug files. I already have these associated with notepad++, but you could have them open in what ever suits. This code could also be added to the end of the run command for the debug, but you may need to tweak timing to have it run once the debug is completed:
Sub startmsdebug
Set objShell = CreateObject("Wscript.Shell")
Set oShell = CreateObject("Wscript.Shell")
Dim strDirectory, strFile, strText, strUserProfile, fso, file
strUserProfile = oShell.ExpandEnvironmentStrings("%USERPROFILE%")
strPath = strUserProfile + "\Local Settings\Temp"
strFile = "\msdebug.txt"
strLoad = strPath + strFile
objShell.Run("notepad++ " & strLoad)
End Sub
Sub startmsdebug2
Set objShell = CreateObject("Wscript.Shell")
Set oShell = CreateObject("Wscript.Shell")
Dim strDirectory, strFile, strText, DevPath, fso, file
DevPath = "R:\_CADDdev\Bentley"
strPath = DevPath + "\Site\Batch"
strFile = "\msdebug.txt"
strLoad = strPath + strFile
objShell.Run("notepad++ " & strLoad)
End Sub
Note that the subs have been modified to suit the location where each version of MicroStation saves the debug file. SS3 MicroStation allows you to set where YOU want the debug file to go, a good addition.
More soon.