How hta Changed the Way I Deliver Builds - Part 6 - Disable Application Button by Project

Remember, everything we've gone through in these exercises can be seen in the spsi_cad.hta available for download in Part 1. 

We've seen how to use 'if MSpath.FileExists' to check that the software has been installed in the correct location, but how do we use this same option to lock out and application? Well, the basic idea here is that I have a folder with the same name as the variable 'project'. Inside this folder I have a number of text files. Each file is a trigger for an aplication NOT to be used. So, if I don't want V8i, only Structural Modeller then I leave in the text file 'nov8i.txt'. The more control you want over applications, the more text files you would have. In the end you may need one for each application you have on your hta. 

The beauty of this is that, more often than not, you want similar application lock outs across a number of projects so all you need to do is copy a project folder you have set up previously and rename it. Easy really. 

So, we have our 'project' folder with text files, but how do we use them in the hta to lock out applications? Well, what we're actually doing is using the text files to trigger of the disabling of the html button in a similar fashion as we did with the install locations. In this case, if we wanted to see if V8i was to be locked out we would use the code: 

if MSpath.FileExists("P:\" + oEnv("Client") & "\" + oEnv("Project") + "\CAD\PSC\nov8i.txt") then
end if 

Nice and neat. 

OK, I can lock out a single application, but what if I wanted to make it easier for me and use a single text file to lock out all applications associated with that version? Easy, you could use the text file name for the base version (noV8i.txt, noxm.txt) to set the trigger and just adjust the code to include all application buttons: 

if MSpath.FileExists("P:\" + oEnv("Client") & "\" + oEnv("Project") + "\CAD\PSC\nov8.txt") then
end if 

All of this gets added to the 'Sub Window_onload' area so that it is updated each time the 'project' variable is updated. 

Later on we'll see how you can do all of this from a csv file instead of using text files in a folder. 

More soon.