码迷,mamicode.com
首页 > 其他好文 > 详细

Eletron 打开文件夹,截图

时间:2017-07-27 11:29:29      阅读:566      评论:0      收藏:0      [点我收藏+]

标签:require   issue   remote   var   pat   random   math   strong   current   

1、shell.openItem(fullPath)

var fullpath = path.join(processPath)+Math.random()+".png";

shell.showItemInFolder(fullPath)  //如果fullPath 是一个文件夹则打开,如果是一个文件,则打开其所在文件夹

https://electron.atom.io/docs/api/shell/

2\截图:

https://github.com/electron/electron/issues/8587

function takePicture(imagePath){
  var imagePath = imgFile || path.join(processPath)+Math.random()+".png";
  remote.getCurrentWebContents().capturePage({
    x: 0,
    y: 40,
    width: 0,    //保持原样,必须写
    height: 0    //保持原样。必须写 这4个参数
  },function(img){
    remote.require(‘fs‘).writeFile(imagePaht,img.toPng());
    shell.showItemInFolder(imagePath);
  });
}

  

Eletron 打开文件夹,截图

标签:require   issue   remote   var   pat   random   math   strong   current   

原文地址:http://www.cnblogs.com/cbugs/p/7243639.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!