VLC record desktop command:
vlc screen:// -I rc --screen-fps 30 :sout=#transcode{vcodec=h264}:std{access=file,dst=%homepath%/Desktop/output.mp4}
之後再打stop即可停止錄影。
1.
hover(Location(s.getBottomRight())) #終於找到了之一,S=screen, hover 可以改成click等動作
hover(Location(s.getTopLeft()).offset(100,100)) #終於找到了之二,hover offset on second monitor
#來源網址 http://www.lai18.com/content/7527573.html
#screen capture
screen = Screen()
sc = screen.capture()
shutil.move(sc.getFilename(), os.path.join(os.path.abspath('.'), "some-name.png"))
2.
跟find()有關的
Find() # FindFailed exceptions
exists() #no exceptions
Region.exists() #returns False
setFindFailedResponse(PROMPT) # PROMPT/RETRY/SKIP/ABORT/HANDLE when not found you will be prompted. 這個超好用的,在發現findfailed的時候會跳出提示,真貼心。
註:http://sikulix-2014.readthedocs.io/en/latest/region.html#exception-findfailed
3.
在Sikuli呼叫JAVA
看樣子,jar在Jython裡面被視為是一個資料夾,所以用法如方法三。
參考網站:
http://techblog.leosoto.com/jython-import-logic/
https://puremonkey2010.blogspot.tw/2014/01/jython-using-jython-to-call-java.html
下面的Jython.class和Jython.jar是我自己建立的測試檔案,不是官網上的Jython.jar喔!!!
#Method 1. Jython.class in *.sikuli_folder\Jython.class
import class
#Method 2. Jython.class in *.sikuli_folder\jython\Jython.class
import jython.Jython
#Method 3. Jython.jar in ..\*.sikuli_folder\sikulix\lib\Jython.jar
import sys
sys.path.append(getBundlePath()+"\\Jython.jar") #宣告jar檔案的位置
from jython import Jython #from package import class
j = Jython("kyc1109","TPE")
j.hello()
------Jython.jar start----------------------------------------------
package jython;
/**
*
* @author kyc1109
*/
public class Jython {
private String name;
private String city;
/**
* @param name
* @param city
*/
public Jython(String name, String city){
this.name = name;
this.city = city;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public void hello() {
System.out.println("Hi this is Java by hello()");
}
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Hi this is Java");
}
}
------Jython.jar end----------------------------------------------
# for Multi-Monitor
for i in range(0,Screen.getNumberScreens()): #1 = Monitor2, 0 = Monitor 1
s= Screen(i)
print i
bounds=s.getBounds()
print bounds
hover(s) #move cursor to screen 1,2...
沒有留言:
張貼留言