Jump to content

Spliiting Clipboard Text


locutus243
 Share

Recommended Posts

Hiya all,

I have used AutoIT to copy a cell from Excel that contains three numbers. I then want to enter this text into another program but the field I am entering it in won't let me copy form excel.

Therefore I need to manually enter the data that is on the clipboard.

E.g. If the cell I am copying contains the number 311, I want to be able to copy the cell, and then rather than using Clipput, I want to tell autoIT to enter the numbers as if I were using the Send function.

(I can't simply use the send function because the number is different each time so I would have to manually change the script every time, therefore losing the idea of autoscripting.)

Is there any way that I can get autoit to split up what is on the clipboard so it recognises the individual characters it has copied and is able to send these individually???

Thanks

Mark

Link to comment
Share on other sites

Couldn't you just send all three numbers at once?

; '1' signals not to interpret any characters specially
 send(clipGet(), 1)

Edit: To do what you describe, StringSplit() if called with an empty delimiter string will return an array where each element is a character from the original string.

Edited by LxP
Link to comment
Share on other sites

Hi,

Thanks for your help. I tried experimenting with the stringsplit idea and I think it will work. But am having real trouble with that function. It keeps saying that I don't have the correct number of parameters in my function call. I have included the function below, wondered if you could spot my problem??

Thanks

Mark

Func Five()

WinActivate("Microsoft Excel - Book2")

Send("^c")

$bak = ClipGet()

MsgBox(0, "Clipboard contains:", $bak)

$array = StringSplit($bak,"",1)

MsgBox(0, "Clipboard contains:", $array)

EndFunc

Hey,

I seemed to have found what I was doing wrong. Thanks for your help

Mark

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...