Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'==============================================================================
' Gets current CATIA UI language by reading FrameGeneral.CATSettings file
'==============================================================================
Private Function GetLanguageFromSettings()
' set the defaul return value
GetLanguageFromSettings = ""
' read FrameGeneral.CATSettings from settings as binary
Dim fso, settingsFile, content, filePos
Set fso = CreateObject("Scripting.FileSystemObject")
Set settingsFile = fso.OpenTextFile(fso.BuildPath(CATIA.SystemService.Environ("CATUserSettingPath"), "FrameGeneral.CATSettings"))
content = settingsFile.ReadAll()
settingsFile.Close
filePos = InStr(content, "UserInterfaceLanguage")
' read byte that stores setting value
Select Case Asc(Mid(content, filePos + 54, 1))
Case &HE5: GetLanguageFromSettings = "RU"
Case &H56: GetLanguageFromSettings = "FR"
Case &HCA: GetLanguageFromSettings = "EN"
Case &H5A: GetLanguageFromSettings = "DE"
Case &H27: GetLanguageFromSettings = "JP"
Case &H24: GetLanguageFromSettings = "CH"
Case &H60: GetLanguageFromSettings = "KO"
Case &H0: GetLanguageFromSettings = "SYSTEM"
End Select
End Function
I don't have access at FrameGeneral settings
Sub CATMain()
MsgBox GetLanguageFromSettings()
End Sub
'==============================================================================
' Gets current CATIA UI language by reading FrameGeneral.CATSettings file
'==============================================================================
Private Function GetLanguageFromSettings()
' set the defaul return value
GetLanguageFromSettings = ""
' read FrameGeneral.CATSettings from settings as binary
Dim fso, settingsFile, content, filePos
Set fso = CreateObject("Scripting.FileSystemObject")
Set settingsFile = fso.OpenTextFile(fso.BuildPath(CATIA.SystemService.Environ("CATUserSettingPath"), "FrameGeneral.CATSettings"))
content = settingsFile.ReadAll()
settingsFile.Close
filePos = InStr(content, "UserInterfaceLanguage")
' read byte that stores setting value
Select Case Asc(Mid(content, filePos + 54, 1))
Case &HE5: GetLanguageFromSettings = "RU"
Case &H56: GetLanguageFromSettings = "FR"
Case &HCA: GetLanguageFromSettings = "EN"
Case &H5A: GetLanguageFromSettings = "DE"
Case &H27: GetLanguageFromSettings = "JP"
Case &H24: GetLanguageFromSettings = "CH"
Case &H60: GetLanguageFromSettings = "KO"
Case &H0: GetLanguageFromSettings = "SYSTEM"
End Select
End Function
Sub CATMain()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
MsgBox "Dir: " & CATIA.SystemService.Environ("CATUserSettingPath")
MsgBox "Path: " & fso.BuildPath(CATIA.SystemService.Environ("CATUserSettingPath"), "FrameGeneral.CATSettings")
MsgBox CStr(fso.FileExists(fso.BuildPath(CATIA.SystemService.Environ("CATUserSettingPath"), "FrameGeneral.CATSettings")))
End Sub
Dim fso, dir, path, settingsFile, content, filePos
Set fso = CreateObject("Scripting.FileSystemObject")
For each dir in Split(CATIA.SystemService.Environ("CATUserSettingPath"), ";")
path = fso.BuildPath(dir, "FrameGeneral.CATSettings")
If fso.FileExists(path) then
Set settingsFile = fso.OpenTextFile(path)
content = settingsFile.ReadAll()
settingsFile.Close
Exit for
End if
Next
If IsEmpty(dir) then
Exit function
End if
'==============================================================================
' Gets current CATIA UI language by reading FrameGeneral.CATSettings file
'==============================================================================
Private Function GetLanguageFromSettings()
' set the defaul return value
GetLanguageFromSettings = ""
' locate FrameGeneral.CATSettings among all settings directories
Dim fso, dir, path, settingsFile, content, filePos, ss
Set fso = CreateObject("Scripting.FileSystemObject")
For Each dir In Split(CATIA.SystemService.Environ("CATUserSettingPath"), ";")
path = fso.BuildPath(dir, "FrameGeneral.CATSettings")
If fso.FileExists(path) Then
Exit For
End If
Next
If IsEmpty(dir) Then
Exit Function
End If
' read file
Set settingsFile = fso.OpenTextFile(path)
content = settingsFile.ReadAll()
settingsFile.Close
filePos = InStr(content, "UserInterfaceLanguage")
' read byte that stores setting value
Select Case Asc(Mid(content, filePos + 54, 1))
Case &HE5: GetLanguageFromSettings = "RU"
Case &H56: GetLanguageFromSettings = "FR"
Case &HCA: GetLanguageFromSettings = "EN"
Case &H5A: GetLanguageFromSettings = "DE"
Case &H27: GetLanguageFromSettings = "JP"
Case &H24: GetLanguageFromSettings = "CH"
Case &H60: GetLanguageFromSettings = "KO"
Case &H0: ' check system locale
Set ss = CATIA.SystemService
Select Case ss.Evaluate("Function Main() Main = GetLocale() End Function", CATVBScriptLanguage, "Main", Array())
Case 1049: GetLanguageFromSettings = "RU"
Case 1036: GetLanguageFromSettings = "FR"
Case 1033: GetLanguageFromSettings = "EN"
Case 1031: GetLanguageFromSettings = "DE"
Case 1041: GetLanguageFromSettings = "JP"
Case 2052: GetLanguageFromSettings = "CH"
Case 1042: GetLanguageFromSettings = "KO"
End Select
End Select
End Function