Macro for Selecting all the text in a Text Box, located in a HSQLBD based form, and Copy

Hi All,

This question in a similar form was already asked @ OO, but for whatever reason we can not connect to Apache OpenOffice Community Forum - Apache OpenOffice Community Forum under Ubuntu 24.04 and Firefox 139.0.1 at this point in time.
Apologies for that one, but need an answer.

Looking for a information about how to select text in a Text Box in a HSQLDB based form in LO Writer 24.8.6.2.

There is a need to copy a concatenated Address, shown in a Text Box, and copy it to an outside LO residing program. The Client does not want to invest in much more development at this point in time, so a Macro would be the solution.
Seem not to be able to create a Macro to do so, for reasons unknown, even when using the ‘record Macro’ function that is available for use in Writer.
Apparently there seems to be a difference between a text in a Text Box and a text just typed in Writer.

Being not familiar with programming functionality like this, I am seeking guidance for the following:

  1. Where can I find information for identifying the textbox to use in a Macro?
  2. If there is nothing in that area known, how to go about a functionality like this?

Dream

Might be I understand in a wrong way:
Texbox is part of a form. So you have to look with formnavigator for the form name and the name of the textbox.

oDoc = thisComponent
oDrawpage = oDoc.drawpage
oForm = oDrawpage.forms.getByName("MyForm")
oField = oForm.getByName("MyTextBox")
stText = oField.Text

If you start this from the form it will copy the content, which is shown in the text box, to the variable stText.

How should this action be triggered? A push button on the form? Another running macro?

copyFormText.odt (12.2 KB)

WIth a little help from Andrew Pitonyak I finally made it. This is triggered by a form button on the same form as the text control. The button’s property “Additional info” has the name of the text control to be read from, “Text Box 1”.

This looks very promising.
The macro works as expected in your example.
However, when transposing it to our situation, it appears that the selected string is limited to 18 characters.

Any suggestions,

Dream

Sorry, I have no idea what’s going on. It’s not my code.