I came across a post on the VMware ThinApp forum of a user looking for a way to register with thinreg an app based on the OS language (french or english) so as I’m working in a similar environment I came up with a little VBS script for this.

First, the package.ini; two entry points, one for the english shortcut, the other one for the french shortcut:

 

[Readme.exe]
Source=%ProgramFilesDir%\App\app.exe
Shortcut=App.dat
WorkingDirectory=%ProgramFilesDir%\App
 
[Lisez-moi.exe]
Source=%ProgramFilesDir%\App\app.exe
Shortcut=App.dat
WorkingDirectory=%ProgramFilesDir%\App

 

Second, the script:

 

 Visual Basic |  copy code |? 
01
02
'=================================================
03
' Initialize vars
04
'=================================================
05
Dim strComputer, strOSLanguage
06
Dim strThinregPath, strAppToRegister, strThinregCmdLine
07
 
08
'=================================================
09
' Set thinreg path and params
10
'=================================================
11
strThinregPath = "\\fileserver\share\thinreg.exe"
12
 
13
'=================================================
14
' Get Computer OS Language
15
' See: http://msdn.microsoft.com/en-us/library/aa394239%28v=vs.85%29.aspx
16
'=================================================
17
strComputer = "."
18
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
19
Set oss = objWMIService.ExecQuery ("Select OSLanguage FROM Win32_OperatingSystem")
20
 
21
For Each os in oss
22
	strOSLanguage = os.OSLanguage
23
Next
24
 
25
If strOSLanguage = 1036 or strOSLanguage = 3084 Then
26
	REM Wscript.Echo "OS Language: French – France / Canada"
27
	strAppToRegister = "\\fileserver\share\Lisez-moi.exe"
28
ElseIf strOSLanguage = 1033 or strOSLanguage = 4105 Then
29
	REM Wscript.Echo "OS Language: English – US / Canada"
30
	strAppToRegister = "\\fileserver\share\Readme.exe"
31
End If 
32
 
33
'=================================================
34
' Register the app
35
'=================================================
36
Set WSHShell = WScript.CreateObject("WScript.Shell")
37
strThinregCmdLine = strThinregPath & " " & strAppToRegister
38
WSHShell.Run "" & strThinregCmdLine & "", 0, True
39

 

And here you go! Happy Scripting!