Sign in to follow this  
Followers 0
Dalex

Copy Editbox to clipboard

9 posts in this topic

I have looked for hours now with no luck, could someone please point me in the right direction.

I have to copy a license key from an editbox and paste it in another field when licensing a software app.

If I can get it in the clipboard I will use a Clipget() to paste it, but that is the problem I can't figure out how to

get the key from the Edit1 Box onto the clipboard.

I can do a ControlClick, or ControlFocus to focus on that field but after that I am lost.

I tried WinGetText but I couldn't make it work, but I prob. wasn't using it correctly.

The software is at work so I can't post what I have now but maybe tomorrow.


[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites



Try looking in the helpfile for ControlRead().

I can't find anything about Controlread()


[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites

Perhaps ControlGetText() will help you out?

Share this post


Link to post
Share on other sites
GUICtrlRead: Read state or data of a control.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I have played with ControlGetText but no luck yet.

Is it possible to use that function to read something into the clipboard?

Or even read it into a varible?

Or with GUICtrlRead:

Edited by Dalex

[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

what happens when you click on the text you want? Can you highlight it that way? If you can just click on the text you want, do this:

ClipPut("") ;clears the clipboard
send("^a")  ;if needed, you can highlight all the text in the field. Make sure it doesn't highlight the whole screen.
sleep(10)
send("^c")  ;copies the highlight ed text to the clipboard.
Edited by vollyman

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I have played with ControlGetText but no luck yet.

Is it possible to use that function to read something into the clipboard?

Or even read it into a varible?

Or with GUICtrlRead:

; Get text from Notepad and put it into the clipboard
$Var = ControlGetText("Untitled - Notepad", "", "Edit1")
ClipPut($Var)
Edited by Emperor

Share this post


Link to post
Share on other sites

Ok figured it out, with help of a friend.

:(

This may Help someone else.

I put the msgbox in there to to show that the text was copied you can remove that from the script.

Then if you close the msgbox it will open note pad and enter the text just :) WARNING:let it finish it is kinda long but it's easier than trying to kill the script

Even though the following is a WinGetText, I needed a ControlGetText (which worked the same way as the following)

You can test this script by starting, it the while scite is open click Help \ About SciTE and it will run

WinWaitActive("About SciTE")

$text = WinGetText("About SciTE")

MsgBox(0,"Text read was:", $text)

ClipPut($text)

Run("notepad.exe")

WinWaitActive("Untitled - Notepad","")

Send(ClipGet())

:D


[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0