[Solved] Can I import keyboard config using a macro?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Tarkovsky
Posts: 29
Joined: Fri Jun 30, 2017 9:17 am

[Solved] Can I import keyboard config using a macro?

Post by Tarkovsky »

Tried to find anything in the internet, but no success.
So, I would like to import an existing keyboard config(with all its custom shortcuts) using a macro.
First, is it possible?
If yes, Can someone help me?
Last edited by Tarkovsky on Thu Aug 23, 2018 7:16 am, edited 2 times in total.
OpenOffice 4.1.3 on Arch Linux
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Can I import keyboard config using a macro?

Post by Zizi64 »

So, I would like to import an existing keyboard config(with all its custom shortcuts) using a macro.
The keyboard locale layout is related to the operating system.

And there are some shortcut key functions, that are related to the operating system. It is not a good idea to modify them.

And there are sortcut key associations with different functions for the AOO applications. What application (Calc, Writer, or other) you want to control by the macro?
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.
Tarkovsky
Posts: 29
Joined: Fri Jun 30, 2017 9:17 am

Re: Can I import keyboard config using a macro?

Post by Tarkovsky »

I don't want to touch the locale, I'm talking about the shortcuts from Tools > Customize... > Keyboard.
I want to change them in my Calc file, it's because I have created a SpreadSheet with lots of macros and foms. So, people will use it to insert data on each textbox and unlock some other textboxes on other sheets... But I want them to use some shortcuts to navigate. Since the shortcuts can be stored in a config file, that would be cool if I could load that file when they open my SpreadSheet.
OpenOffice 4.1.3 on Arch Linux
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can I import keyboard config using a macro?

Post by Villeroy »

Every Calc document has a configuration file Configurations2/accelerator/current.xml which is normally empty
You find the same configuration in the saved file after you saved your shortcuts via Tools>Customize>Keyboard> [Save...]

I don't know how to merge the trees nor do I know what happens when you do so but I would expect that there is some API interface for this.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Tarkovsky
Posts: 29
Joined: Fri Jun 30, 2017 9:17 am

Re: Can I import keyboard config using a macro?

Post by Tarkovsky »

But I want to save the .cfg file separated from the current document, and just use the macro to load it when my document is opened.
OpenOffice 4.1.3 on Arch Linux
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can I import keyboard config using a macro?

Post by Villeroy »

This makes no sense to me.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Can I import keyboard config using a macro?

Post by Zizi64 »

But I want to save the .cfg file separated from the current document, and just use the macro to load it when my document is opened.
Why you want save the settings separatelly? Just store (save) the changed settings of the Toolbar, Hotkeys, and the Menu items into the specific document: then they will be loaded together the document, and they will not be appeared, when you open and another document.
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.
Tarkovsky
Posts: 29
Joined: Fri Jun 30, 2017 9:17 am

Re: Can I import keyboard config using a macro?

Post by Tarkovsky »

I'm sorry, but there is just an option to save the keyboard shortcuts in a .cfg file or change it for Calc or LIbreOffice.
I can store the menus, context menus, toolbars and events inside my document, but can not store the keyboard shortcuts keys...
OpenOffice 4.1.3 on Arch Linux
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Can I import keyboard config using a macro?

Post by Zizi64 »

I'm sorry, but there is just an option to save the keyboard shortcuts in a .cfg file or change it for Calc or LIbreOffice.
I can store the menus, context menus, toolbars and events inside my document, but can not store the keyboard shortcuts keys...
OOoops! Yes, I see now: It is true.
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: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Can I import keyboard config using a macro?

Post by JeJe »

Have you considered a keyboard listener/handler?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can I import keyboard config using a macro?

Post by Villeroy »

Imported keyboard settings for a single document do work. This is something you can't do in the GUI and the GUI can not override this setup.
Starting with today's topic viewtopic.php?f=5&t=94786&p=451846#p451846 I saved the configuration which inserts a new row at Ctrl+R and then transfered Configurations2/accelerator/current.xml into a Calc document using a zip tool.
Now Ctrl+R inserts a new row into this document's spreadsheet whereas the same shortcut used in other spreadsheets aligns cell contents to the right.
Attachments
Calc_Ctrl-R.ods
(12.6 KiB) Downloaded 461 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Tarkovsky
Posts: 29
Joined: Fri Jun 30, 2017 9:17 am

Re: Can I import keyboard config using a macro?

Post by Tarkovsky »

Have you considered a keyboard listener/handler?
Yes, but I want to remove some shortcuts(like the navigator hotkey) that enable the users to access other parts of my spreadsheet.
Imported keyboard settings for a single document do work. This is something you can't do in the GUI and the GUI can not override this setup.
Starting with today's topic v ... 46#p451846 I saved the configuration which inserts a new row at Ctrl+R and then transfered Configurations2/accelerator/current.xml into a Calc document using a zip tool.
Now Ctrl+R inserts a new row into this document's spreadsheet whereas the same shortcut used in other spreadsheets aligns cell contents to the right.
That's awesome, it does exactly what I want... but on my job I'm not allowed to install new apps due to compliance issues. I can use winrar there, but will that work?
OpenOffice 4.1.3 on Arch Linux
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Can I import keyboard config using a macro?

Post by Villeroy »

Even Windows can handle zip files and you are certainly allowed to use templates.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Muthuvel
Posts: 12
Joined: Sat Jun 20, 2020 7:42 pm

Re: Can I import keyboard config using a macro?

Post by Muthuvel »

@Villeroy
Hi You have nailed it.
See my post viewtopic.php?f=20&t=102360
I think your ctrl+R example may be the answer for my question. But i am unable to understand these lines.
Villeroy wrote:I saved the configuration
Is it "Tools->Customise-> Save?
Villeroy wrote:then transfered Configurations2/accelerator/current.xml into a Calc document using a zip tool.
Where is this current.xml file? How to transfer it to the calc document using the zip tool?
OpenOffice 4.1 on Windows 10
Muthuvel
Posts: 12
Joined: Sat Jun 20, 2020 7:42 pm

Re: [Solved] Can I import keyboard config using a macro?

Post by Muthuvel »

Found it Villeroy
I renamed the file to .zip and used winrar to unzip it. Thank you for the valuable guidance
OpenOffice 4.1 on Windows 10
Muthuvel
Posts: 12
Joined: Sat Jun 20, 2020 7:42 pm

Re: [Solved] Can I import keyboard config using a macro?

Post by Muthuvel »

I assigned a macro ( copy values only) to ctrl+v key.
transferred the current.xml file as you said. But it does not work in new file.
OpenOffice 4.1 on Windows 10
Post Reply