← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #290731]: VNCScreen in Java work fine. HowTo in python ?

 

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

    Status: Open => Answered

Karl proposed the following answer:
Imports are the most important thing.

----

import java.net.Socket as Socket
import edu.unh.iol.dlc.VNCScreen as VNCScreen
import edu.unh.iol.dlc.ConnectionController as ConnectionController

print("Start!\n");
s = Socket("frlesvmhostqa02", 9101); #open a socket to vnc server on listening port
s.setSoTimeout(1000);
s.setKeepAlive(true); #some socket configuration

cc = ConnectionController(s);
cc.openConnection(0); #opens the vnc connection for connection 0, multiple are supported
cc.setPixelFormat(0, "Truecolor", 32, 0); #for connection 0, set pixel data to Truecolor, 32 bits per pixel, little endian
cc.start(0); #start thread that keeps BufferedImage updated by polling server for remote desktop changes

wait(2); #wait for buffered image to be updated before we do sikuli
stuff

vnc = VNCScreen(); #default constructor uses ConnectionController index 0
print("Avant Capture\n");

Test = vnc.capture();
Test.save("c:\\temp","test.png");
print("Fin\n");

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.