Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Retrieve a word from a clipboard
Retrieve a word from a clipboard [message #1703364] Fri, 31 July 2015 06:22 Go to next message
Romain Vianef is currently offline Romain VianefFriend
Messages: 32
Registered: April 2015
Member
Hello everybody,

during my process, I need to retrieve a word from a text component and put it in a String variable.
I made this :

m_aut.execute(textfield.selectAll(), null);
Clipboard clpbrd= Toolkit.getDefaultToolkit().getSystemClipboard();

From this moment, how can I put the selected word in the clipboard ?
Like this : clpbrd.setContents(new StringSelection(textfield.selectAll().toString()), null); ?

And then, how can I retrieve the word from the clipboard and put it in a String variable ?


Thanks for your time.
Romain
Re: Retrieve a word from a clipboard [message #1703368 is a reply to message #1703364] Fri, 31 July 2015 07:25 Go to previous messageGo to next message
Romain Vianef is currently offline Romain VianefFriend
Messages: 32
Registered: April 2015
Member
I found a way to get the content from the clipboard. But I don't know how to put the selected word in the clipboard.
If you have any idea, let me know.

Best regards,
Romain.

[Updated on: Fri, 31 July 2015 11:00]

Report message to a moderator

Re: Retrieve a word from a clipboard [message #1703803 is a reply to message #1703368] Wed, 05 August 2015 06:21 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi Romain,

I'm not a developer, but I think that you can just use the "normal" Java methods for this. A quick google gave me:
http://stackoverflow.com/questions/3591945/copying-to-clipboard-in-java
http://www.avajava.com/tutorials/lessons/how-do-i-copy-a-string-to-the-clipboard.html

The Jubula action for the ITE "copy to clipboard" isn't a part of the client API as far as I'm aware, since there are Java methods available for doing it which can be used when you're in the Java context of the client API.

Hope that helps.
Alex
Re: Retrieve a word from a clipboard [message #1703830 is a reply to message #1703803] Wed, 05 August 2015 09:04 Go to previous messageGo to next message
Romain Vianef is currently offline Romain VianefFriend
Messages: 32
Registered: April 2015
Member
Hi Alex,

Thanks for your answer. I already used these methods of the clipboard.

What I wanted, it was to give a String variable to the clipboard but not directly in Java, like I'm doing now. I guess it's a little difficult to represent but my method has two parts :
1 : click on component, selectAll (selected word) and copy in the clipboard
2 : get the content from the clipboard and put it in the String variable.
I already have the second part. I'm still working on the first part.

Thanks for your time.
Romain.
Re: Retrieve a word from a clipboard [message #1703972 is a reply to message #1703830] Thu, 06 August 2015 09:59 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi Romain,

is this question related to this one: https://www.eclipse.org/forums/index.php/t/1069060/?

Best regards,
Alex
Re: Retrieve a word from a clipboard [message #1703986 is a reply to message #1703972] Thu, 06 August 2015 12:00 Go to previous messageGo to next message
Romain Vianef is currently offline Romain VianefFriend
Messages: 32
Registered: April 2015
Member
Yes.
This question is global and I already have a part of the solution (second part). And the first part is related to the other topic. I think this topic can be considered as closed.

Best Regards,
Romain.
Re: Retrieve a word from a clipboard [message #1703989 is a reply to message #1703986] Thu, 06 August 2015 12:31 Go to previous message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Thanks for the update!
Previous Topic:Some controls are not mappable in Jubula for javafx
Next Topic:Socket write error when launching a java swing aut
Goto Forum:
  


Current Time: Thu Feb 22 22:36:29 GMT 2024

Powered by FUDForum. Page generated in 0.02212 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top