Currently we are using the LBQ (load balancing) to queue up scripts to be run on our instances in IDS. After the scipt is run, we're trying to (within our .NET code) delete the script file. This works most of the time, but every once in a while we get an IO exception stating that "the file cannot be deleted because it is in use." I've run several tests and narrowed it down to being directly related to IDS executing the script, but thats about as far as I've gotten.
One idea that came up was to see if IDS could possible open up a copy of the script file and execute it (whether that be an option of the LBQ EnqueueJob() method, or a configuration setting on the server itself). I know that from within a script you can open up other files "as copies" but I wasn't sure if IDS had a similar ability. This would be nice because it wouldn't have to open the physical script file, thus we'd never have any trouble deleting it.
Has anyone ever done anything like this or know of something similar we could try?
Many thanks in advance!
Wow I didn't think that would be an option. That worked perfectly!
Do you know how exactly it handles that, though? It just seems odd that I couldn't delete the file for up to 15 seconds after the script was done being executed, but IDS can delete it immediately while the script is open and in use?
InDesign parses the script file when it opens and reads it. Once it's parsed, it's not really needed anymore.
Any process other than InDesign can't remove it though, because InDesign has it open. Since InDesign owns the file, it can delete it.
BTW, regarding your original question, you can have one script open another script file, read it and execute it if you have the need. You can use either eval(scriptString) or app.doScript(scriptString).