baghera8 Posted June 6, 2009 Posted June 6, 2009 Having a condition function return the value of an environment variable would greatly increase the versatility of WPI - one could write a pre-install script which runs custom checks and sets environment variables accordingly. An application condition function check such as EnvVarValue("CLEAN_SYSTEM")=="1" would enable application installation based on the aforementioned custom checks.I realize this could be accomplished by setting registry values / writing flag files, but the environment variable solution is more elegant, IMHO, as it requires no cleanup.Another condition function I see as being quite useful would check for the return value of an arbitrary script (e.g. getReturnValue("cscript test.vbs")=="Success"). This would allow for unlimited bespoke conditions supported by self-contained scripts. The pathing to the scripts would need to be worked out, to be sure.After having typed the above, I've gone over the ChangeLog and realized that the requested functions can be trivially implemented by the user via the userfunctions.js file. Perhaps their addition to the core WPI function set may be of help to the less technically inclined, however. Thanks for the great app!
baghera8 Posted June 7, 2009 Author Posted June 7, 2009 Say I use WPI in a corporate IT environment. All big shots get the "Bonus Minimizer 2.7" app. A big shot's PC will have the system environment variable "BIG_CHEESE" set to "1". I can condition "Bonus Minimizer 2.7" with EnvVarValue("BIG_CHEESE")=="1". I can also run a "script or program to execute before installation begins", which checks all sorts of things (version of Citrix, user's group membership, etc.) and sets environment variables accordingly. This gives me the flexibility to implement complex conditions such as "User Is Member of 'HellsAngels' AND 'Ping Response Time from www.myserver.com' under 10ms". My script can run the required checks and set an appropriate environment variable, e.g. USERTYPE=FASTDEVIL. My "Harley 1.0" app will be conditioned as EnvVarValue("USERTYPE")=="FASTDEVIL". etReturnValue("cscript test.vbs")=="Success" - see above, with the difference being that the custom condition scripts can be self-contained, and run only when a given app is selected. For instance, test.vbs can ensure that the user has permission to write to a certain directory before I install something that attempts to write to said directory.Once again, these are trivial for me to implement using the userfunctions.js feature (much thanks for that!), so it's definitely your call as to whether the requested functions would be of use to the rest of WPI's userbase. One great thing about these 2 functions is that they enable use of existing scripts/code without you having to add more and more built-in functions. If I want a fileModifiedDateGreaterThan function, I can Google up a script and have my WPI app conditioned on it faster than it'd take me to post a request for it at MSFN.
mritter Posted June 8, 2009 Posted June 8, 2009 Sent baghera8 a beta copy to test getEnvVar() and setEnvVar(). Waiting for his test results..........................
baghera8 Posted June 11, 2009 Author Posted June 11, 2009 The new functions work perfectly. The conditional functionality is greatly expanded by this feature.Many thanks, Mark!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now