[Solved] Copy and paste from unbound text box on Form

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
coopdmc
Posts: 8
Joined: Sat Apr 01, 2017 8:08 am

[Solved] Copy and paste from unbound text box on Form

Post by coopdmc »

In visual basic express, I can highlight and automatically copy a text box text (I think to clipboard).

TextBox1.Focus() 'VBA
TextBox1.SelectAll() 'VBA
TextBox1.Copy() 'VBA

I've looked at clipboard operation text in OOBasic, but it's very complicated and verbose.
Is there a way to access the controls (Textbox) properties to highlight and copy an unbound textbox text on a form?
Last edited by coopdmc on Wed Apr 12, 2017 1:27 am, edited 1 time in total.
open office 4.1.3 on windows 10 home pc
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Copy and paste from unbound text box on Form

Post by Villeroy »

Well, you start with the most complex parts of this API without knowing the basic parts.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
coopdmc
Posts: 8
Joined: Sat Apr 01, 2017 8:08 am

Re: Copy and paste from unbound text box on Form

Post by coopdmc »

Thanks for the response. I looked at several documents regarding application programming interface, using the same interface for several programming languages, and universal network objects
I looked at the IDL Reference at http://www.openoffice.org/api/docs/comm ... le-ix.html. But should a casual user of OpenOffice really need to have a degree in these fields to use OpenOffice at a slightly higher level (such as writing macros)? If so, then I'll certainly pursue this course of action. Do you have a starting point of reference regarding "knowing the basic parts" (of the api)? Thank you for getting me pointed in the right direction!
open office 4.1.3 on windows 10 home pc
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Copy and paste from unbound text box on Form

Post by UnklDonald418 »

But should a casual user of OpenOffice really need to have a degree in these fields to use OpenOffice at a slightly higher level (such as writing macros)?
The oO API is complicated, so writing macro code is not something a "casual user" would likely tackle.
Do you have a starting point of reference regarding "knowing the basic parts" (of the api)? Thank you for getting me pointed in the right direction!
Andrew Pitonyak's book “OpenOffice.org Macros Explained” is available as a free download from
http://www.pitonyak.org/oo.php
Also look for his “Database Macros” download
There is another book "Database Programming with OpenOffice.org Base & Basic" that I find helpful, but it isn't free.
http://www.baseprogramming.com/
Also look through the Base Tutorials and Examples and Code Snippets areas for macro examples.

To do much macro programming you will need object inspection tool.
viewtopic.php?f=74&t=49294
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
karolus
Volunteer
Posts: 1159
Joined: Sat Jul 02, 2011 9:47 am

Re: Copy and paste from unbound text box on Form

Post by karolus »

TextBox1.Focus() 'VBA
TextBox1.SelectAll() 'VBA
TextBox1.Copy() 'VBA
But should a casual user of OpenOffice really need to have a degree in these fields
No, the casual user needs nothing but click … ctrl+a … ctrl+c
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Copy and paste from unbound text box on Form

Post by JeJe »

I've quickly found these

Get the textbox contents:

viewtopic.php?f=20&t=84203

Copy to Clipboard:

viewtopic.php?f=20&t=77313

The code to copy to clipboard is complicated - but if you put it in a separate module - once that's done its as easy to call as the VBA copy function. You just need to do a little work first.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
coopdmc
Posts: 8
Joined: Sat Apr 01, 2017 8:08 am

Re: Copy and paste from unbound text box on Form

Post by coopdmc »

Thanks, all of you for you for your input, very useful links. I've taken another route for my solution, using shell to open a visual basic .exe to generate a random password and convert to hexadecimal for storage:
REM ***** BASIC *****
Sub Main
'20.122. Shell Function (Andrew Pitonyik)
Dim vRC As Variant
Dim sd as integer
sd = 0
vRC = Shell("C:\Users\"user"\Documents\Visual Studio 2015\Projects\encode_030717_2341\encode_030717_2341\bin\Debug\encode_030717_2341.exe", sd)
'(or your path to .bat or .exe program)
End Sub

I'll consider this topic as solved. I knew about Ctrl-C, copy, but was unaware of Ctrl-A, so I did learn something, hi!
open office 4.1.3 on windows 10 home pc
Post Reply