Created
May 24, 2012 21:46
-
-
Save hilukasz/2784422 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mySymbol(input){ | |
var idoc = app.activeDocument; | |
if (input <= idoc.symbolItems.length-1) { | |
alert(idoc.symbolItems.length); | |
if (input) { | |
this.mySymbolIndex = input; | |
} else { this.mySymbolIndex = 0; }; //set up default symbol to first one if none is defined | |
this.width = function () { | |
var symbolWidth = Math.round(idoc.symbolItems[this.mySymbolIndex].width); //convert float to int | |
return symbolWidth; | |
} | |
this.height = function () { | |
var symbolHeight = Math.round(idoc.symbolItems[this.mySymbolIndex].height); //convert float to int | |
return symbolHeight; | |
} | |
} | |
else { | |
alert('There are only '+idoc.symbolItems.length+'symbols in your library, you selected '+input+'try a lower number'); | |
this.height = 0; | |
this.width = 0; | |
} | |
} | |
var firstSymbol = new mySymbol(1); | |
firstSymbol.width(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment