Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


gt7599a

using conditions for language & SP version

Recommended Posts

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 :thumbup 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. :wacko:

Any suggestions would be greatly appreciated.

Ed

Edited by gt7599a

Share this post


Link to post
Share on other sites

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.

@Kel

I 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;
}

Share this post


Link to post
Share on other sites

@zorphnog

Thanks, 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! :thumbup

Still wrestling with reboot issues :wacko: but that's a subject for a different post.

Also thanks for the more elegant code.

Ed

Share this post


Link to post
Share on other sites

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 by GrowBigTrees

Share this post


Link to post
Share on other sites

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"'];

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...