Skip to content

Instantly share code, notes, and snippets.

@hilukasz
Created May 29, 2012 19:56
Show Gist options
  • Save hilukasz/2830342 to your computer and use it in GitHub Desktop.
Save hilukasz/2830342 to your computer and use it in GitHub Desktop.
function MySymbol(input){
this.doc = app.activeDocument;
this.mySymbolIndex = input || 0;
this.mySymbolItem = this.hasSymbolIndex() ? this.doc.symbolItems[this.mySymbolIndex] : false;
}
MySymbol.prototype.hasSymbolIndex = function() {
return this.mySymbolIndex <= this.doc.symbolItems.length - 1;
};
MySymbol.prototype.width = function() {
return this.mySymbolItem ? Math.round(this.mySymbolItem.width) : 0;
};
MySymbol.prototype.height = function() {
return this.mySymbolItem ? Math.round(this.mySymbolItem.height) : 0;
};
MySymbol.prototype.widthAndHeight = function() {
var widthAndHeight = [];
var myWidth = this.width;
var myHeight = this.height;
widthAndHeight.push(myWidth);
widthAndHeight.push(myHeight);
return widthAndHeight;
}
var firstSymbol = new MySymbol(0);
print(firstSymbol.widthAndHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment