I don't know javascript I just can hack others code.
// Find the location where this script resides
function findScript() {
var where = "";
try {
FORCEERROR = FORCERRROR;
}
catch(err) {
// alert(err.fileName);
// alert(File(err.fileName).exists);
where = File(err.fileName);
}
return where;
}
var Name = decodeURI(new File(findScript())).replace(/\.[^\.]+$/, ''); // strip the extension off);
var scriptPath = "";
while (Name.indexOf("/") != -1 ) {
scriptPath= scriptPath + Name.substr(0, Name.indexOf("/") + 1);
Name = Name.substr(Name.indexOf("/") + 1 ,);
}
alert("Script Path = '" + scriptPath +"'\rScript Name = '" + Name + "'");