Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

RunScript in CS5 and CS4? How do I set up RunScriptParams

$
0
0

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


Viewing all articles
Browse latest Browse all 238792

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>