IMG Home PageIMG ProductsProduct DownloadsOrdering InformationTechnical Support and Frequently Asked QuestionsDeveloper's Corner and UtilitiesAbout IMG
CustomersIMG ResellersMedia InformationIMG Events / Trade ShowsUseful LinksIMG Contact InformationIMG Information / Policies

IMG KnowledgeBase & Frequently Asked Questions

IMG Logo



Search FAQ's

Keyword Keyword Search Help
Category Type Product Version

Searching for ID: QD1117120871

QD1117120871
How do I externally change the current input language keyboard layout?

This extends the "Change My-T-Soft Layout" example at How to externally Change My-T-Soft Layout. The first part below explains the mechanism provided by Windows, and then it ties into the example of the linked example above.

There is an unattended XMLfeature that can be used to manipulate regional and language settings. This example only uses the InputPreferences option, and there are many other aspects to this functionality that are not covered here. The example is from Windows 7. This also works for Windows 10, but the default input layout acts differently - note that [Win]-[Space] will roll through current input layouts.

This is an Example of an XML file that adds and removes layouts using Spanish, English US, and German layouts, setting English as the default

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!-- User List -->
<gs:UserList>
<gs:User UserID="Current" />
</gs:UserList>
<gs:InputPreferences>
<!-- Spanish -->
<gs:InputLanguageID Action="remove" ID="0c0a:0000040a" Default="false" />
<!-- en-US -->
<gs:InputLanguageID Action="add" ID="0409:00000409" Default="true" />
<!-- de-DE -->
<gs:InputLanguageID Action="add" ID="0407:00000407" Default="false" />
</gs:InputPreferences>
</gs:GlobalizationServices>

This file would need to be saved as an XML file, e.g. inputchange.xml, and care must be taken to make sure standard characters are used (text only type file), and then it can be implemented using the following:

control intl.cpl,, /f:"inputchange.xml"

Note: There are 2 commas, and there needs to be a space between the second comma and the /f switch. The quotes need to be normal double-quotes, and ideally a path would be specified - this example must be run from the same directory where the file inputchange.xml exists. The critical piece is the ID value for the InputLanguageID - refer to Microsoft documentation for additional ID values for language, region, and layout.

To use these tools, 4 XML files where created that do discrete actions - add and remove Italian and Japanese layouts. By removing the layout, if it is the default in an open application, it will be replaced by the new default layout. It is important to note how Windows handles input layouts - each Window can have its own input settings, and by changing focus between open applications, the current input language will stay with the current settings for an open Window. For example, you could have 3 instances of Notepad open, and each could have their own input language, and the keyboard layout will change based on which Notepad is the current active window. There are options for the input language to show on the task bar or as a floating window to indicate which input language is active. Note that most users set to the current locale, and operate with 1 input locale, so the issues of changing input settings would typically not apply, but when changing and working with multiple input locales, unique situations can occur, so awareness of which input locale is in use can be extremely relevant and useful.

IT.XML - Adds Italian (Italy) layout and sets as default

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!-- User List -->
<gs:UserList>
<gs:User UserID="Current"/>
</gs:UserList>
<gs:InputPreferences>
<!-- Italian -->
<gs:InputLanguageID Action="add" ID="0410:00000410" Default="true"/>
</gs:InputPreferences>
</gs:GlobalizationServices>

ITREMOVE.XML - Removes Italian layout

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!-- User List -->
<gs:UserList>
<gs:User UserID="Current"/>
</gs:UserList>
<gs:InputPreferences>
<!-- Italian -->
<gs:InputLanguageID Action="remove" ID="0410:00000410"/>
</gs:InputPreferences>
</gs:GlobalizationServices>

JP.XML - Adds Japanese layout and sets as default

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!-- User List -->
<gs:UserList>
<gs:User UserID="Current"/>
</gs:UserList>
<gs:InputPreferences>
<!-- JP-Japanese -->
<gs:InputLanguageID Action="add" ID="0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}" Default="true"/>
</gs:InputPreferences>
</gs:GlobalizationServices>

JPREMOVE.XML - Removes Japanese layout

<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!-- User List -->
<gs:UserList>
<gs:User UserID="Current"/>
</gs:UserList>
<gs:InputPreferences>
<!-- JP-Japanese -->
<gs:InputLanguageID Action="remove" ID="0411:{03B5835F-F03C-411B-9CE2-AA23E1171E36}{A76C93D9-5523-4E90-AAFA-4DB112F9AC76}"/>
</gs:InputPreferences>
</gs:GlobalizationServices>

The following extends the batch file from the example linked at the top of this item

@echo off
cls
REM This toggles 2 layouts.
REM These files must exist:
REM JAPAN.CFG and JAPAN.INI for Japanese layout
REM ITALIAN.CFG and ITALIAN.INI for Italian layout
REM If changing Layouts, the it, itremove, jp, and jpremove XML files must exist
REM user is [Username] for current logged in user / application user
REM the actual path below is an example, will need to be updated for your usage
REM If the Input Language layout is not changing as expected, you may find events
REM that may show errors or warnings in the Event Viewer.
REM Go to Control Panel | System and Security | Administrative Tools | View Event Logs
REM and in the Event Viewer open Applications and Services Logs then go into
REM Microsoft | Windows | International and view the Operational log

C:
cd "C:\Users\user\AppData\Roaming\Innovation Management Group\MYTSOFT"

IF exist LAYOUTJAPAN.CUR GOTO DOITALIAN
REM This changes the My-T-Soft Layout
cpycnmts.exe JAPAN.CFG
REM This removes Italian Input Resource
control intl.cpl,, /f:"itremove.xml"
REM This adds & sets as default the Japanese Input Resource
control intl.cpl,, /f:"jp.xml"
copy JAPAN.CFG LAYOUTJAPAN.CUR
goto END

:DOITALIAN
REM This changes the My-T-Soft Layout
cpycnmts.exe ITALIAN.CFG
REM This removes Japanese Input Resource
control intl.cpl,, /f:"jpremove.xml"
REM This adds and sets as default the Italian Input Resource
control intl.cpl,, /f:"it.xml"

DEL LAYOUTJAPAN.CUR

:END

Notes:

Category: Integrating(Developing)Type: Question/Answer Product: My-T-SoftVersion: 1.78 1.79 1.80 1.90

Notes:



IMG Home PageIMG ProductsProduct DownloadsOrdering InformationTechnical Support and Frequently Asked QuestionsDeveloper's Corner and UtilitiesAbout IMG
CustomersIMG ResellersMedia InformationIMG Events / Trade ShowsUseful LinksIMG Contact InformationIMG Information / Policies


As seen in ...

Yahoo!finance