Files
ps/scripts/lib.js
2018-03-20 19:15:23 -04:00

20 lines
485 B
JavaScript

// Opens and returns a file, overwriting new data.
function newFile(path) {
var f = File(path)
if(f.exists)
f.remove()
f.encoding = "UTF8"
f.open("e", "TEXT", "????")
return f
}
// Prints an error message.
function err(e) {
return 'ERROR: ' + e.message + ' at ' + e.fileName + ':' + e.line;
}
function bounds(lyr) {
return ('"Bounds": [[' + lyr.bounds[0] + ',' +
lyr.bounds[1] + '],[' + lyr.bounds[2] + ',' +
lyr.bounds[3] + ']]').replace(/ px/g, "");
}