Various updates

* Layersets now have bounds.
* TextItem is now writeable
* Added flush function to writing, for faster debugging.
This commit is contained in:
Unknown
2018-04-18 23:58:38 -04:00
parent e90c491450
commit c54b196f6a
6 changed files with 125 additions and 21 deletions

View File

@@ -1,13 +1,21 @@
// 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", "????")
f.open("w")
return f
}
File.prototype.flush = function() {
this.close()
this.open("a")
};
function flush(file) {
file.close()
file.open("a")
}
// Prints an error message.
function err(e) {
return 'ERROR: ' + e.message + ' at ' + e.fileName + ':' + e.line;
@@ -19,6 +27,14 @@ function bounds(lyr) {
lyr.bounds[3] + ']]').replace(/ px/g, "");
}
function Undo() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "HstS" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Prvs" ));
desc.putReference(charIDToTypeID( "null" ), ref);
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
}
/**
* The setFormatting function sets the font, font style, point size, and RGB color of specified
* characters in a Photoshop text layer.