Page 1 of 1

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

Posted: Mon Aug 20, 2018 7:29 pm
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?

Re: Can I import keyboard config using a macro?

Posted: Mon Aug 20, 2018 11:04 pm
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?

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 6:51 am
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.

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 2:49 pm
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.

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 5:54 pm
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.

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 6:35 pm
by Villeroy
This makes no sense to me.

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 8:46 pm
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.

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 10:01 pm
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...

Re: Can I import keyboard config using a macro?

Posted: Tue Aug 21, 2018 10:55 pm
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.

Re: Can I import keyboard config using a macro?

Posted: Wed Aug 22, 2018 11:48 am
by JeJe
Have you considered a keyboard listener/handler?

Re: Can I import keyboard config using a macro?

Posted: Wed Aug 22, 2018 2:38 pm
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.

Re: Can I import keyboard config using a macro?

Posted: Wed Aug 22, 2018 5:07 pm
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?

Re: Can I import keyboard config using a macro?

Posted: Wed Aug 22, 2018 5:25 pm
by Villeroy
Even Windows can handle zip files and you are certainly allowed to use templates.

Re: Can I import keyboard config using a macro?

Posted: Mon Jun 22, 2020 4:54 am
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?

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

Posted: Mon Jun 22, 2020 5:35 am
by Muthuvel
Found it Villeroy
I renamed the file to .zip and used winrar to unzip it. Thank you for the valuable guidance

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

Posted: Mon Jun 22, 2020 5:55 am
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.