Sign in to follow this  
Followers 0
tsherr

Copying and pasting from the clipboard

5 posts in this topic

I have a program that I have to copy and paste registration information from a text document into a registration box. I can't select the text in the text document and then to a send("^C") and then activate the other window and do a send("^V") - I assume it is the ClipGet and ClipPut but I'm not sure how to use them.

Is this possible to do?

T

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Yes, ClipGet and ClipPut will work, but it might be simpler to read directly from the file. (See the helpfile for stuff about fileread/filereadline) You could then controlsend the data to your registration box.

That way you don't have the constant flipping windows, selecting, pasting, etc.

Edited by Brickoneer

Share this post


Link to post
Share on other sites

Yes, ClipGet and ClipPut will work, but it might be simpler to read directly from the file. (See the helpfile for stuff about fileread/filereadline) You could then controlsend the data to your registration box.

That way you don't have the constant flipping windows, selecting, pasting, etc.

The file I'm reading in looks like:

LineOneInfo

LineTwoInfo

When I use FileReadLine, and ControlSend, the line break doesn't get passed to the control, and when I use FileRead and send individual characters, it puts a blank line between the two lines. Clearly it isn't reading the text file the same way CTRL-C/V do. What am I doing wrong?

T

Share this post


Link to post
Share on other sites

can you post a example of the txt file and your code? It may be a matter of using stringinstr

The code looks like this:

dim $Line

Run("C:\firststep\ScanSystem\scannedr.exe")

WinWait("Information","")

WinActivate("Information","")

WinWaitActive("Information","")

Send("!B")

Sleep(500)

$file = FileOpen("C:\firststep\ScanSystem\RegistrationInfo.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$Line = FileReadLine($file)

If @error = -1 Then ExitLoop

ControlSend("Unlock", "", "[CLASS:TMemo; INSTANCE:1]", $Line)

ControlSend("Unlock", "", "[CLASS:TMemo; INSTANCE:1]", $Line)

Wend

FileClose($file)

Send("!U")

Here is the text file:

First+Last$Halifax:A2GGd

BOzcgFlWxz5+dGs:cbeIei:Dvnl0a:J1i1zS

If you can help, I'd appreciate it.

T

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