5 Replies Latest reply on Oct 15, 2018 5:42 AM by Dirk Becker

    Filename of script usable in startup-script?

    DBLjan Level 3

      Hey guys,


      i have this neat startup-script, and i'm wondering if it would be possible to use its filename as content of a variable?


      #targetengine "session"
      function main()
       var myEventListener1 = app.addEventListener("beforeSave",  setMetadata, false);
       var myEventListener2 = app.addEventListener("afterSaveAs",  setMetadata, false);
       var myEventListener4 = app.addEventListener("beforeExport", setMetadata, false);
        var myEventListener5 = app.addEventListener("afterPrint", setCopys, false);
           function setMetadata()
           app.activeDocument.metadataPreferences.author = "XXX";
            app.activeDocument.metadataPreferences.documentTitle = app.activeDocument.name; 


      As you see, I need to edit the author ('XXX') for every workspace the script is rolled out to.

      My idea is to use the filename for that. This way I could prepare the scripts' filename and dont need to touch the content.

      Is it possible to use fn for this, exspecially start-up scripts?