Bug 140956 - Recording macros is not convenient - fully rewrite Macro recorder for proper code
Summary: Recording macros is not convenient - fully rewrite Macro recorder for proper ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.1.3.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-Recording
  Show dependency treegraph
 
Reported: 2021-03-11 14:49 UTC by Harald Langheinrich
Modified: 2022-04-21 14:56 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Langheinrich 2021-03-11 14:49:32 UTC
Description:
if i record a macro I get a mass of lines for a simple action
In excel I get one line vba per action 
You already have a table to transform VBA to uno in order to run these macros
You should use same object and action names as VBA , if you combine them with starbasic or python that doesn't matter 
but you can handle it far better 

Actual Results:
	rem ----------------------------------------------------------------------
	rem define variables
	Dim document   As object
	Dim dispatcher As object
	rem ----------------------------------------------------------------------
	rem get access to the document
	document   = ThisComponent.CurrentController.Frame
	dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
	
	rem ----------------------------------------------------------------------
	Dim args1(1) As new com.sun.star.beans.PropertyValue
	args1(0).Name = "URL"
	args1(0).Value = Name_of_Map
	args1(1).Name = "FilterName"
	args1(1).Value = "Calc MS Excel 2007 XML"
	
	dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())

Expected Results:
Workbooks(Name_of_Map).SaveAs filtername:="Calc MS Excel 2007 XML"


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
[Information automatically included from LibreOffice]
Locale: de
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes
Comment 1 Timur 2022-03-21 14:52:30 UTC
Record Macro works with dispatch (records what you are doing with keystrokes and mouse-clicks) and doesn't really create proper code, no way to "fix" that.
It should be rewritten completely. So let's confirm like that (and not really expect it any time soon).
Comment 2 educmale 2022-04-21 14:56:27 UTC
LO 7.2.6.2 continues the difficulty (on my Win 11 install).  

Recognizing that this would be a massive undertaking, to move MACRO RECORDING from command execution (dispatches) to functional, executable commands in basic  ((akin to what happens in MSOffice and VBA)),

I would vote for a communal focus in this area.   Sadly, my programming skills aren't up.

My hope is that (by trivial example, only!), I could turn on a macro recording, change the border color on a shape, and turn off recording.   Look in at the recorded macro, and see the exact code that executed that, and then use/manipulate it as needed.