Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

using conditions for language & SP version

Featured Replies

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

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

  • Author

@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

  • 8 months later...

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

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.