I got a simple question : is there a way to get the current script path ?
I found the “app.activeScript” statement in the documentation but it returns a Promise and the final value is an curious (useless…?) object.
__filename contains the script name but without the path.
I check natives modules (fs, uxp, storage) but none seems able to help me…
It could be for security reasons. Old ExtenScripts are security nightmare
In plugins you need to add permissions to allow plugin visit any location in your PC. Because there is permission in manifest then PS or InDesign can ask you for consent. Scripts cannot have manifest.
Nobody would like script searching for passwords.txt on the user desktop and sending it to the internet.
@Tristan At the risk of asking a stupid question . . . how are you running extendscript or uxp scripts that are located outside of InDesign’s Scripts Panel folder (I didn’t know you could)?
And sometimes they are located to the Script Panel folder.
Soon we will also have to make some scripts for InDesign Server, I don’t know yet where scripts will have to be located but I guess we will be happy to be able to check their location with the activeScript method
Ah, I see. I thought maybe you had them somewhere outside the folders that InDesign provides. In the applescript world (that I am most familiar with) you can have your scripts anywhere, but I had not found an equivalent using extendscript or now uxp scripts . . . I’m sure someone will correct me if it is possible!
@philipbuckley It can be executed via AppleScript do script. And either in VBS or from ExtendScript with the equivalent command.
tell application id "com.adobe.InDesign"
set target_script to "Macintosh HD:Users:username:Desktop:script_path.idjs" as alias
do script target_script language uxpscript with arguments {} undo mode entire script
end tell