Scripts that copy the width/height of the object to the clipboard
Could you create two scripts that copy the width/height (only a fractional number without "px") of the selected object (or group of objects) to the clipboard?
Could you create two scripts that copy the width/height (only a fractional number without "px") of the selected object (or group of objects) to the clipboard?
I rewrite your modifications.
var myDoc = app.activeDocument;
var myLayer = myDoc.layers.add(); //in this case, You can keep your layer in ths variable.
var sel = app.selection; //sel as selections array.
var str = "";
for (var i=0;i<sel.length;i++) { //loop and check each selected objects
str += sel.width.toFixed(3) + "/" + sel.height.toFixed(3) + "\n";
}
var tx = myLayer.textFrames.add();
tx.contents = str;
app.executeMenuCommand("deselectall"); //deselect all abjects
tx.selected = true;
app.cut();
for (i=0;i<sel.length;i++) sel.selected = true; //select all of last selections
myLayer.remove();
Here is some references you can read and try.
https://www.w3schools.com/js/default.asp
ex:how to make loop
https://www.w3schools.com/js/js_loop_for.asp
Have you aleady install Extendscript Toolkit CC?
If you aleady install it, You can read references under the Help menu.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.