Hi Michael,
this one by Loic.Aigon will be a very good starting point for you:
Re: Custom text variable from javascript
Instead of using word or character count as contents of the variable you could use the name of the document that is truncated by a little regular expression.
Just before line 28 add this. The regular expression returns the first 7 characters of the name of the active document:
var truncatedName = doc.name.match(/^.{7}/)[0];
And change line 28 to that:
tv.variableOptions.contents = truncatedName;
The return value of variable truncatedName is now assigned to the contents of the text variable.
Remove the whole function starts with:
var countWords = function F(every)
You will not need it.
You have to run this script as startup script if you want full automation; means that it will run on every document you have open.
You may also change the name of the text variable the script creates and perhaps the name of the idleTask and the functions…
Regards,
Uwe