Re[2]: Enabling Calc macro recording

Andrew Pitonyak andrew at pitonyak.org
Tue Aug 18 21:29:17 UTC 2020


I guess if it will end up in the documentation, I should be more specific and not just go from memory!

The most versatile method to manipulate an LO document is to get the internal UNO objects and manipulate them. Using the model provides significant control, but you must understand much about the different services and interfaces. Another method, which requires very little understanding of the LO internals, is to use a UNO dispatcher. The macro recorder uses the dispatcher for all commands. The dispatcher requires (1) the command to dispatch such as ".uno:Undo", (2) arguments that control the dispatch, and (3) an object capable of performing the dispatch. When writing your own macros, it is usually better to use the object model rather than the dispatcher. That said, some things are best handled by the dispatcher; for example, controlling the clipboard. The problem with using the macro recorder are that: 

1. The dispatches are not documented and are stated to be subject to change; although I have not seen them change over time. 
2. The recorder ignores some values from dialogs that are opened while recording a macro. It is possible, therefore, that you will record a complicated macro that will not actually playback everything that you did. One example is CSV import, the generated macro does nothing. I just verified that this is true. 


Side note, my book OOME, which is available as a free download, contains a macro that will enumerate the supported dispatches. Last time I ran it, it generated over 300,000 rows of dispatch commands. 

On Tuesday, August 18, 2020 14:40 EDT, "Steve (GMail)" <stevemfanning.wh at gmail.com> wrote:
  Thanks Andrew. I feel a need to put a brief clarification in Chapter 12 of the 7.0 Calc Guide. Regards, Steve  ------ Original Message ------From: "Andrew Pitonyak" <andrew at pitonyak.org>To: "Steve (GMail)" <stevemfanning.wh at gmail.com>Cc: "Development List" <libreoffice at lists.freedesktop.org>Sent: 18/08/2020 19:31:34Subject: Re: Enabling Calc macro recording It may not record input from a dialog. As an example, if you import a CSV file, I think that it does not remember the parameters that you used for the import. 

The macro it produces does not use commands that directly modify the underlying object model but instead build an object to encapsulate each call and send that object. This can make it more difficult to modify the created macro. 

On Tuesday, August 18, 2020 14:00 EDT, "Steve (GMail)" <stevemfanning.wh at gmail.com> wrote:
  All, In Calc, I notice the option to enable macro recording at Tools > Options > LibreOffice > Advanced is entitled "Enable macro recording (may be limited)".  Can anybody advise what to "(may be limited)" caveat refers to? Regards,
Steve Fanning 


 


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20200818/208397de/attachment.htm>


More information about the LibreOffice mailing list