[Solved] Macro switch the keyboard layout

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
bsi
Posts: 6
Joined: Fri Feb 10, 2017 9:22 am

[Solved] Macro switch the keyboard layout

Post by bsi »

Is it possible in LibreOffice Calc the switching of keyboard layout macro from Latin to Cyrillic ? It is necessary to select cells in column "In" included Latin, and the selection of cells in column "C" included the Cyrillic alphabet. The range of the macro starting with 6 strings. Thank you all.
Last edited by bsi on Tue Feb 14, 2017 3:48 pm, edited 2 times in total.
OpenOffice 3.1
User avatar
Zizi64
Volunteer
Posts: 11360
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Macro switch the keyboard layout.

Post by Zizi64 »

Is it possible in LibreOffice Calc the switching of keyboard layout macro from Latin to Cyrillic ?
I think, it is an operating sytem related task. It is needs a few clicks only on the system tray, but if you want to automazize it, then you can write a batch file or other script/software to toggle this in the op.sys.
And then and you can write a macro to launch the outer software/script from the AOO or LO.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: Macro switch the keyboard layout.

Post by JeJe »

Not entirely following your question but you can add a keyboard listener so whenever a keyboard key is pressed run a macro. That could be to type, or otherwise do something with, a Cyrillic character instead of a Latin character - or the other way round.

viewtopic.php?f=20&t=45516
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2784
Joined: Wed Mar 09, 2016 2:40 pm

Re: Macro switch the keyboard layout.

Post by JeJe »

This might be closer to what you want - if you're on Windows and provided you have the keyboard layouts loaded on your system you can use ActivateKeyboardLayout. You put the below in a module

Code: Select all

Private Declare Function ActivateKeyboardLayout Lib _
"user32.dll" (ByVal myLanguage As Long, Flag As Boolean) As Long

Sub ActiveAmericanKeyboard()
Call ActivateKeyboardLayout(&H0409, 0)
End Sub
'just change the number &H0409 for the number for the other keyboardlanguage

The numbers are here.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Look in the first column and replace the 0x with &H
so for the United States 0x0409 becomes &H0409
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
bsi
Posts: 6
Joined: Fri Feb 10, 2017 9:22 am

Re: Macro switch the keyboard layout.

Post by bsi »

Jeje, thanks for the quick response. Everything works. Have a good day.
OpenOffice 3.1
Post Reply