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

Creating a macro - Writing a Script - Using the API

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

Postby coopdmc » Sat Apr 08, 2017 9:01 am

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
coopdmc
 
Posts: 8
Joined: Sat Apr 01, 2017 8:08 am

Re: Copy and paste from unbound text box on Form

Postby Villeroy » Sat Apr 08, 2017 10:58 am

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24268
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Copy and paste from unbound text box on Form

Postby coopdmc » Sat Apr 08, 2017 9:09 pm

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
coopdmc
 
Posts: 8
Joined: Sat Apr 01, 2017 8:08 am

Re: Copy and paste from unbound text box on Form

Postby UnklDonald418 » Mon Apr 10, 2017 4:54 am

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.
https://forum.openoffice.org/en/forum/viewtopic.php?f=74&t=49294
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the subject line
Apache OpenOffice 4.1.3 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 536
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Copy and paste from unbound text box on Form

Postby karolus » Mon Apr 10, 2017 8:55 am

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 - 5.1 … 5.3.2.2 on Linux Mint17
User avatar
karolus
Volunteer
 
Posts: 843
Joined: Sat Jul 02, 2011 9:47 am

Re: Copy and paste from unbound text box on Form

Postby JeJe » Tue Apr 11, 2017 12:41 pm

I've quickly found these

Get the textbox contents:

https://forum.openoffice.org/en/forum/v ... 20&t=84203

Copy to Clipboard:

https://forum.openoffice.org/en/forum/v ... 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.
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 121
Joined: Wed Mar 09, 2016 2:40 pm

Re: Copy and paste from unbound text box on Form

Postby coopdmc » Wed Apr 12, 2017 1:20 am

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
coopdmc
 
Posts: 8
Joined: Sat Apr 01, 2017 8:08 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests