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

stroke-exporer

时间:2020-11-19 12:03:37      阅读:4      评论:0      收藏:0      [点我收藏+]

标签:rectangle   screen   function   length   排列   ati   end   push   process   

win10

2列排列所有打开的explorer窗口

关闭全部explorer 窗口


function getExplorerWindows() {
    let wnds = sp.AllApplications();
    const windClass = "CabinetWClass";
    const proName = "explorer";
    let result = new Array();
    for(let i =0;i< wnds.Length;++i) {
        let cur = wnds[i];
        if(cur.Process.ProcessName == proName) {
            result.push(cur);
        }
    }
    return result;
}


function closeExporer() {
    let todo = getExplorerWindows();
    for(let i =0;i< todo.length;++i) {
        todo[i].SendClose()
    }
}

function sortExporer(windArray) {
    if(!!!windArray || windArray.length<1) return;
    const total = windArray.length;
    const curScreen = windArray[0].Screen;
    const sWidth = curScreen.WorkingArea.Width;
    const sHeight = curScreen.WorkingArea.Height;
    
    const cellW = Math.floor(sWidth/2);
    const cellH = Math.floor(sHeight/Math.floor((total+1)/2));


    let result = "";
    for(let i =0; i<total;++i) {
        let rect =   windArray[i].Rectangle;
        rect.Width =cellW;
        rect.Height = cellH;
        rect.X = (i%2)*cellW;
        rect.Y = Math.floor((i)/2.0)*cellH;
        windArray[i].Rectangle = rect;
    }
}


sortExporer(getExplorerWindows());

closeExporer();

stroke-exporer

标签:rectangle   screen   function   length   排列   ati   end   push   process   

原文地址:https://www.cnblogs.com/Searchor/p/13970192.html

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