2017-04-19 81 views

回答

1

這,我已經證明了代碼,所以你可以,如果你需要在以後修改。另外,請查看第166頁和Photoshop的JS參考手冊,您可以閱讀更多關於選擇的內容 - 您可以設置羽化,延伸/相交等。如果需要的話可以選擇。

專爲CS6,應與後者合作。

#target photoshop 
if (documents.length == 0) { 
    alert("nothing opened"); 
} else { 
    // start 

    //setup 
    var file = app.activeDocument; 
    var selec = file.selection; 

    //run 
    var bnds = selec.bounds; // get the bounds of current selection 
    var // save the particular pixel values 
     xLeft = bnds[0], 
     yTop = bnds[1], 
     xRight = bnds[2], 
     yBottom = bnds[3]; 

    var newRect = [ [xLeft,yTop], [xLeft,yBottom], [xRight,yBottom], [xRight,yTop] ]; // set coords for selection, counter-clockwise 

    selec.deselect; 
    selec.select(newRect); 

    // end 
}