Toggle track changes with a shortcut?

I’ve learned to create a keyboard shortcut that will begin recording track changes, but I would like to be able to toggle the recording of track changes off with a keyboard shortcut as well.

Pressing the key combination a second time does not toggle recording off. (A checkmark continues to be shown next to “Record” as found via the path Edit > Track Changes > Record.)

Assigning a different keyboard shortcut to the function “Stop Recording” also does not stop the recording of track changes. (The checkmark next to “Record” continues to be shown.)

Question 1: Is there a way to turn the activating keyboard shortcut into an on/off (= activate/deactivate) toggle?

Question 2: Alternatively, what is the correct function to choose (via Customize > Keyboard > Function) to stop the recording of track changes, which I can then associate with a new keyboard shortcut?

This problem can be solved using a macro as indicated in this topic.

Thank you. I will have to increase my skill level in order to be able to implement this solution.

1 Like

So if anyone has another solution, more on the level of a current basic user, I would not discourage you from sharing it . . .

Try macro that assigns Shift + F7 to toggle the recording state of changes:

' TrackChange => Shift + F7
Sub TrackChangesHotKey()
  Dim oSupplier As Object, oModuleShortCutManager As Object
  Dim keyEvent As New com.sun.star.awt.KeyEvent

  oSupplier=GetDefaultContext.getValueByName("/singletons/com.sun.star.ui.theModuleUIConfigurationManagerSupplier")
  oModuleShortCutManager = oSupplier.getUIConfigurationManager("com.sun.star.text.TextDocument").ShortCutManager
  
  keyEvent.KeyCode = com.sun.star.awt.Key.F7
  keyEvent.Modifiers = com.sun.star.awt.KeyModifier.SHIFT
  oModuleShortCutManager.setKeyEvent keyEvent, ".uno:TrackChanges"
  oModuleShortCutManager.store
End Sub

1 Like

Thank you again. I created my first macro to try this, but the shortcut didn’t have the desired effect. One effect: SHIFT+F7 is still showing up as the designated shortcut in the menu at Edit > Track Changes > Record, even now that I’ve successfully implemented Regina’s solution with a different key combination.

Unfortunately, now when I open LO and open a document, that first document opening prompts two error reports:

Error loading BASIC of document
file:///Users/Bayberry/Library/Aplication%20Support/LibreOffice/4/user/basic/MyTestLibrary/script.xlb/:
General Error.
General input/output error.

and

Error loading BASIC of document
file:///Users/Bayberry/Library/Aplication%20Support/LibreOffice/4/user/basic/MyTestLibrary/dialog.xlb/:
General Error.
General input/output error.

When I saw that the SHIFT+F7 wasn’t working, I deleted the macro and also the macro library I had created. The macro has stayed deleted, but the library (MyTestLibrary) keeps reappearing when I re-open LO.

The command is a toggle. So using it next time will stop recording. Provided you used the correct command in the first place.

Go to Tools > Customize, part Keyboard. In Category select Edit. In Functions enter Record. In Function select it. In Shortcut Keys select the desired shortcut e.g. Alt+R. Now the Assign button is active. Click it. OK.

2 Likes

Thank you, Regina. This worked for me to toggle the recording of track changes on and off. I had chosen the command Record changes in all views when I set it up the first time.