Search code examples
adobe-indesignextendscript

How to determine whether a script is run at startup or manually?


By having a script located in a subfolder startup scripts of e.g. the user script folder, one can have a script run at startup. What I would like to achieve now is having the script determine whether it is run due to that startup (and e.g. create menu items for its functions) or whether it was run manually (and then perform its main function, not caring about its startup function). How can this be achieved?


Solution

  • Given that the script is located within the Startup Scripts Folder:

    var scriptKind = (app.activeScript.parent.name=="Startup Scripts")? "startup":"normal";
    alert( scriptKind );