← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #241980]: Set Env Clipboard

 

Question #241980 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/241980

UNCCheezy posted a new comment:
not solved.

Here is what I would like it to do.

text = "asdfj l;kjal;kjfl;jka fjl;askdjfalksjd;lkjl;kaj
sd;lfkjasl;kdjfl;kj l;kjasdlfkjals;kdjfjj
sdafjalsdjfjaksjdf;lk;lkjgoi3goihbl;kcnbkjhglkjv a;lkjf lj ovj
dosjfiasoifjaskl;fj asgij erjklvjasodfhwofih asoijwefhasoijas;jkew
foiasvohfoasihfaosiuhf aslkdfjasl;k fjaso;ifjaw oeifj asoij as;dlfij
aoicj weoi;j aspoij aoij "

copied_text = Env.setClipboard(text)
type(copied_text)


Maybe sikuli should have a way to setClipboard since it has a getClipboard.

I followed this solution, and got it to work as long as you sleep after
you set the clipboard.

http://www.macdrifter.com/2011/12/python-and-the-mac-clipboard.html

I guess it's answered for now, sikuli can't do this but you can with
this.  for instance:



import subprocess 

def getClipboardData(): 
    p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) 
    retcode = p.wait() 
    data = p.stdout.read() 
    return data 

def setClipboardData(data): 
    p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE) 
    p.stdin.write(data) 
    p.stdin.close() 
    retcode = p.wait()

text = setClipboardData('asdf/fasdf/asd/a/gasdf/faasdfwer/werwerwerw/werwerwrgasdf/asdfasdfa/fasdfasdfasdfasfasdf/asdfasdfasd/')
click("1389487321663.png")
type('v', KeyModifier.CMD) #instapaste

worked on mac 10.9

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.