OK, I admit it. This is one beast of a build and the collection of a LOT of work and work arounds, but what if you want to use something more traditional? No problems, it's very easy to use the same principles we have gone through to date in a much more simplified system if that's what works for you. the hta then becomes a way to manage users and take much of the hands on work out of the situation.
To that end, download the text files attached to this blog for reference purposes and make sure you rename it to My_CAD.hta.
While the build and buttons may have been simplified, much of the basics still ecist and are critical to the way the build works, including it's portability and the scripting:
<SCRIPT language="VBScript">Dim DRV_ROOT,BENTLEY_ROOT,AdminPath,AdminScriptsPathDim oWshShell,oMe,oMy,oEnv,MSpathSet WshShell = CreateObject("WScript.Shell")Set oEnv = WshShell.Environment("PROCESS")Set objFSO = CreateObject("Scripting.FileSystemObject")Set MSpath = createobject("Scripting.FileSystemObject")Set SITE_ROOT = createobject("Scripting.FileSystemObject")Set DRV_ROOT = createobject("Scripting.FileSystemObject")Set ProjDrv = createobject("Scripting.FileSystemObject")Set Bentley_Root = createobject("Scripting.FileSystemObject")DRV_ROOT = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName("..\.") oEnv("hta_DRV_Root") = Replace(DRV_Root, "/", "\")'msgbox DRV_RootAdminPath = DRV_Root + "\_Admin\"oEnv("hta_sAdminPath") = Replace(AdminPath, "/", "\")AdminScriptsPath= AdminPath + "Scripts\"'msgbox AdminScriptsPath'msgbox AdminScriptsPath + "user_create_local.bat" WshShell.Run AdminScriptsPath & "user_create_local.bat" ,0WshShell.Run AdminScriptsPath & "std_cad.bat" ,0WshShell.Run AdminScriptsPath & "std_cad_Link.bat" ,0Site_Root = DRV_Root + "\Bentley\Site\" SiteInstallList = Site_Root + "Site_Installs\SiteInstallPaths.txt"oEnv("hta_sSite") = Replace(SITE_ROOT, "/", "\")Std_Root = DRV_Root + "\Bentley\Standard\" 'msgbox Std_RootoEnv("hta_sStd") = Replace(Std_ROOT, "/", "\")Bentley_Root = DRV_Root + "\Bentley\"oEnv("hta_sBentley") = Replace(BENTLEY_ROOT, "/", "\")'msgbox Bentley_Root</SCRIPT>
Left if the ability to be able to list multiple install locations to cover all bases:
Sub Window_onload'------------------------------------------------------------------------------------------' Get Primary Microstation Root Directories'------------------------------------------------------------------------------------------BentleyV8iRoot = (GetPath(SiteInstallList,"MS811"))'msgbox BentleyV8iRoot'------------------------------------------------------------------------------------------ ' Final Check...'------------------------------------------------------------------------------------------If BentleyV8IRoot = "undefined" then startv8ibutton.disabled=TrueElse MS811 = BentleyV8iRoot & "MicroStation\ustation.exe" MS811ustn = chr(34) & MS811 & chr(34)End IfEnd SubFunction GetPath(TargetFile,targetval) Dim objFSO,objFile,myFile,line,Result,TmpPath Dim filesys, newfolder myFile=(TargetFile) Set objFSO = CreateObject("Scripting.FileSystemObject") set filesys=CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(myFile,1) Do Until objFile.AtEndOfLine line=objFile.ReadLine If InStr(line,targetval) > 0 Then Result=Split(line,",") TmpPath= Result(1) If filesys.FolderExists(TmpPath) Then 'newfolder = filesys.CreateFolder ("c:\Duru\website\") GetPath = TmpPath 'msgbox "FOUND " & TmpPath Exit Function Else ' msgbox " Not Found " & TmpPath 'msgbox TmpPath & " wasn't found" GetPath="undefined" End if End If Loop Set objFSO=Nothing Set objFile=NothingEnd FunctionSet objFSO = CreateObject("Scripting.FileSystemObject")set filesys=CreateObject("Scripting.FileSystemObject")'------------------------------------------------------------------------------------------' Start V8i & V8i DEBUG '------------------------------------------------------------------------------------------ Sub StartV8i objFSO.CopyFile oEnv("hta_sStd") + "MS811\Standards\data\std_appl.cfg" , BentleyV8iRoot + "MicroStation\config\appl\", OverwriteExisting WshShell.run chr(34) & (BentleyV8iRoot) & "MicroStation\ustation.exe" & chr(34) End Sub
We're left with the basics that we can still build on:
The biggest difference is that we have included the ability to use the MicroStation project locations from a network path using the hta variables. The way we have done this with the *.pcf files is to point the location of '_USTN_PROJECT' to our projects directory and then lock the variable so it can't be changed:
_USTN_PROJECT = $(hta_sBentley)Standard/$(STD_MS)/Projects/%lock _USTN_PROJECT
The way this work is that users will get the company build first, as with the previous builds, and then the admin can edit\update\overwrite at the project level using the mentioned variable.
This will have it's draw backs. the first of these is that, due to the way cfg files are loaded in Microstation, the locks file becomes harder to use. This is because the cfg files under _ustn_site will be processed before the project pcf files. This means anything locked will not change at the pcf level. Part of the reason i don't use pcf files at all and work around them using the custom builds I have outlined previously.
Once you have this base it's very easy to add more programs, buttons for help files and much more.
More soon.
This was covered in:
communities.bentley.com/.../how-hta-changed-the-way-i-deliver-builds-part-8-dev-build-hta.aspx