Skip to content

Instantly share code, notes, and snippets.

@DieterHolvoet
Created March 27, 2016 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DieterHolvoet/ac8130bdf0f0c6c6602b to your computer and use it in GitHub Desktop.
Save DieterHolvoet/ac8130bdf0f0c6c6602b to your computer and use it in GitHub Desktop.
A series of Document prototype functions for Adobe Extendscript
/* Get file extension of document */
Document.prototype.getFileExtension = function() {
var str = this.fullName.fsName;
return str.substring(str.lastIndexOf(".") + 1);
};
/* Get file name of document */
Document.prototype.getFileName = function() {
var str = this.fullName.fsName;
return str.substring(str.lastIndexOf("\\") + 1, str.lastIndexOf("."));
};
/* Get full path of document */
Document.prototype.getFullPath = function() {
return this.fullName.fsName;
};
/* Get full path of the folder of the document */
Document.prototype.getFolderPath = function() {
var str = this.fullName.fsName;
return str.substring(0, str.lastIndexOf("\\"));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment