Compiled Scripts

Is there a way to reuse/load compiled scripts instead of recompiling on startup? Currently we have 100 or so scripts that is compiled and executed on schedules and events.
Hi Michael,
You can save results of script compilation on disk as .net assemblies and re-use it when running scripts.
I've uploaded sample demo there:
Thank you for the example.
Is there also a way to load the files generated by the following:
_scriptRun.ScriptLanguage = ScriptLanguage.JavaScript;
_scriptRun.ScriptHost.ModulesDirectoryPath = @"My Temp Directory";

e.g. The files generated from the above:
Folder: AlternetScripterTsComplation_b2d9b3...
Files: AlternetSystemSupport.js,, AlternetSystemSupport.ts, MyScript.js and

If possible, i would like to load "AlternetScripterTsComplation_b2d9b3...
" directly without having to call "Compile()" again. The scenario is that the user opens a schematic window which needs to run scripts behind the scene, but i don't want the scripts to be recompiled each time they open the window, it would be preferable to just load everything from file(My assumption is that this would be faster).
Hi Michael,
Thank you for the explanation. Right now we do compilation every time indeed; we will look at how this can be optimized and if we can get this optimization into the coming update.
Thank you
Has there been any progress on this issue?
Hello Michael,
We are busy resolving this issue right now. We will send you the updated packages as soon as they are ready.
Actually, it seems that the problem has already been fixed since last year :) If you set ModulesDirectoryPath property like this:
scriptRun.ScriptHost.ModulesDirectoryPath = @"C:\MyTempPath";
Scripter will check the file timestamps to determine if the compilation results are up-to-date, so the scripts are not recompiled.
So does this mean that if I have a single scriptrun object that runs multiple different scripts each time an individual script is reloaded into the scriptrun object to run it will not need to be compiled before running it after the first time?
When you set ModulesDirectoryPath property on your ScriptRun object, you tell Scripter to store the compilation results for a given set of script source files in the specified directory. So if you want to avoid recompilation you need to have different ModulesDirectoryPath folder specified for each script files set. So instead of reusing the same ScriptRun object and ModulesDirectoryPath you need to have separate a ScriptRun object with a different ModulesDirectoryPath for each script file set.