Use $.fileName - you must launch the script from InDesign though, it does not work from ESTK targeting InDesign.
1 person found this helpful
I think $.fileName will work from ESTK targeting InDesign as long as the script is saved.
If it's not saved then it won't work as there's no file path.
Purrrrfect – thanks you guys!
I squished the filename down with this…
var username = $.fileName.replace(/^.*(\\|\/|\:)/, '').slice(14).replace(/\.[^.$]+$/, '').split(".");
app.activeDocument.metadataPreferences.author = username+" "+username;
to get the user from the fn:
Not sure you are looking for this but to get the username you can use $.getenv($.os==='M' ? 'USER' : 'username');
Trevor, I mixed that up with app.activeScript occasionally not working.
Haven't done any serious scripting in a while.