gt7599a Posted July 24, 2007 Posted July 24, 2007 (edited) I want to create a condition to install XP SP2 on only English language machines. I also want to ensure that if someday Microsoft were to release an XP SP3 that this script wouldn't allow the user to try & install SP2 over it if it has been already installed. It would hopefully fail anyway before it went very far by why give the user a chance to waste their time &/or do something stupid.In List of return values for getOSlang() Kelsenellenelvian showed me where to find the list of return values for the getOSlang() (Thank you Kelsenellenelvian) (see %wpipath%\WPIScripts\core.js function CreateLocalArray())Here is how I think I would write the condition but I'd like to get some feedback from those with more (that would be any) experience then me.getOSver()=="XP" && getSPver()<2 && (getOSlang()=="ENA" || getOSlang()=="ENL" || getOSlang()=="ENC" || getOSlang()=="ENB" || getOSlang()=="ENI" || getOSlang()=="ENJ" || getOSlang()=="ENZ" || getOSlang()=="ENP" || getOSlang()=="ENS" || getOSlang()=="ENT" || getOSlang()=="ENG" || getOSlang()=="ENU" || getOSlang()=="ENW")I think it should work but it strikes me that there has to be a more elegant way to write this. Any suggestions would be greatly appreciated.Ed Edited July 24, 2007 by gt7599a
zorphnog Posted July 24, 2007 Posted July 24, 2007 Well a simpler way to do what you want is this:getOSver()=="XP" && getSPver()<2 && getOSlang().substr(0,2)=="EN"More importantly, though, I believe you have discovered a bug. There is no getOSlang() function. Therefore no matter what you try, the condition is never going to work if getOSlang is in the equation.@KelI searched through all the scripts and unless I am just blind I never saw the function. After adding the following code, the conditional statement worked flawlessly:function getOSlang(){ position="core.js"; whatfunc="getOSlang()"; return oslang;}
gt7599a Posted July 25, 2007 Author Posted July 25, 2007 @zorphnogThanks, I did a global find on all the js files and didn't find a reference to getOSlang() and initially just figured it was cause I don't know jack about js.I added the code you provided to core.js and it worked great. Thanks a bunch! Still wrestling with reboot issues but that's a subject for a different post.Also thanks for the more elegant code.Ed
Kelsenellenelvian Posted July 25, 2007 Posted July 25, 2007 I cant belive with all that lang code that was added we missed that part! Damnit!!!
GrowBigTrees Posted April 12, 2008 Posted April 12, 2008 (edited) I have an English, French and Dutch version of a program.Dependent upon the OS language, I would like to install only the correct executable.I wonder if the getOSlang()=="xxx" condition can only be used in the cond[pn] line, so you need 3 separate entries in config.js, or is there a possibility to use the condition in a cmdx[pn] line? e.g.cmd1[pn]=['getOSlang().substr(0,2)=="EN" && "%wpipath%\\Install\\OFFICE\\Acrobat Reader\\8\\ar812lite_US.exe"'];cmd2[pn]=['getOSlang().substr(0,2)=="NL" && "%wpipath%\\Install\\OFFICE\\Acrobat Reader\\8\\ar812lite_NL.exe"'];cmd3[pn]=['getOSlang().substr(0,2)=="FR" && "%wpipath%\\Install\\OFFICE\\Acrobat Reader\\8\\ar812lite_FR.exe"'];//getOSlang(): --- see : http://www.msfn.org/board/List-of-return-values-for-getOSlang-t101612.html&hl=locale + http://www.msfn.org/board/using-conditions-for-language-and-SP-version-t101617.html&hl=getOSlang%28 Edited April 12, 2008 by GrowBigTrees
zorphnog Posted April 12, 2008 Posted April 12, 2008 WPI does not evaluate internal function calls with cmd entries. You would need 3 separate entries that have a gcond entry, i.e.:gcond[pn]=['getOSlang().substr(0,2)!="EN"']cmd1[pn]=['"%wpipath%\\Install\\OFFICE\\Acrobat Reader\\8\\ar812lite_US.exe"'];
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