Hello
In SC3, I was able to run javascripts in Indesign using the following code:
// add my arguments
Utils<IScriptArgs>()->Save(); // create new script-args context on the stack
for(int32 i=0; i < paramN.size(); i ++) {
Utils<IScriptArgs>()->Set(paramN[i], paramV[i]);
}
// Get a handle on the ExtendScript Manager
InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMg rBoss));
if (!scriptManager)
break;
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
if (! scriptRunner)
break;
scriptRunner->RunScript(scriptStr2);
In CS5, this fails:
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
if (! scriptRunner)
break;
I have solved the problem by writing the script to a file and using:
InterfacePtr<IScriptRunner> scriptRunner( Utils<IScriptUtils>()->QueryScriptRunner(IDFile(pathToFile));
It works, but I do not want to have to write the script down to file before executing it.
Is there a way around this?
Best regards
/ Pontus