kit网页截图代码及一些录屏代码
编辑时间:2017-11-21 作者:金满斗 浏览量:2192 来源:原创

现在一般能post就尽量post。但有时候还是需要用到截图。

web里面有很好的剪切板函数。kit里就行不通了。用这个吧。

关键函数这

//根据id网页上截取验证码
	getcode_id = function(id){
		var eCodeImg = wb.jQuery(id);
		x = eCodeImg.offset().left;
		y = eCodeImg.offset().top ;
		imgScreen.capture(..mainForm.custom.hwnd,x,y,eCodeImg.width(),eCodeImg.height());
		//imgScreen.resize(60,20);   对于自适应网页加上这句。保存图片本身大小
		imgScreen.save("/1.jpg");
	}	


别人发的录制鼠标的

import console;
import soImage;
 
console.open()
var gifFile = soImage.gifFile("/test.gif");
class CURSORINFO{
    INT cbSize = 20;  
    INT flags;  
    pointer hCursor;  
    struct ptScreenPos = {int x;int y}; 
}
 
var img = soImage();  
var img2 = soImage()
for(i=1;20;1){
    img.capture(); //截屏
    var info = CURSORINFO()
    //获取鼠标信息
    ::User32.GetCursorInfo(info)
    //取得鼠标样式
    img2.fromIcon(info.hCursor)
    //混合图片,注意最后一个参数
    img.mix(img2,info.ptScreenPos.x,info.ptScreenPos.y,6/*_MIX_SCREEN*/);
    gifFile.write(img ); //写入GIF文件
    console.log("已录制",gifFile.count() );
    sleep(10);
}
 
gifFile.close();
console.pause();


另外一大牛发的用soImage录屏并存为GIF文件

import console; 
import soImage;

console.open()
var gifFile = soImage.gifFile("/test.gif");

var img = soImage();  
for(i=1;20;1){ 
    img.capture(); //截屏
    gifFile.write(img ); //写入GIF文件
    console.log("已录制",gifFile.count() ); 
    sleep(10); 
} 

gifFile.close(); 
console.pause();


来说两句吧