Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to Run Indesign Script in a file from plugin code in CS4?

New Here ,
Mar 30, 2009 Mar 30, 2009
Hi,<br />I have the code to execute the InDesign script stored in external file for InDesign CS3.<br /><br />InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss)); <br />InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID()); <br /> IDFile scriptFile(scriptFilePath); <br /> if (scriptRunner->CanHandleFile(scriptFile)) <br /> { <br /> ScriptData returnValue; <br /> PMString errorString; <br /> ErrorCode error = scriptRunner->RunFile(scriptFile); <br /> ASSERT(error == kSuccess); <br /> } <br /><br />But the RunFile() method is cs4 expects an additional argument of the type RunScriptParams. <br />Someone please show me with a code snippet on how to excute a script file in CS4??
TOPICS
SDK
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 30, 2009 Mar 30, 2009
You can create a RunScriptParams by passing in the script runner i.e.:

RunScriptParams params(scriptRunner);

and then pass back in the call to runFile.

Ian
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 02, 2009 Jun 02, 2009
LATEST

Dear Ian

  Here I'm used the below coding in CS3, Its working fine....

//In CS3 Coding

  PMString jsFullPath("c:\\windows\\sample.jsx"); // a path to my java script file

do

{

const

IDFile outFile(jsFullPath);

InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));

ASSERT( scriptManager ) ;

InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());

ASSERT( scriptRunner ) ;

if

(scriptManager)

{

InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());

RunScriptParams params(scriptRunner);

ErrorCode err = scriptRunner->RunFile(outFile, kTrue, kFalse);

}

}

while(kFalse);

But the same time I used this coding in CS4, Its not woking

//In CS4 Coding

PMString jsFullPath("c:\\windows\\MacID\\BIN\\sample.jsx"); // a path to my java script file

do

{

const

IDFile outFile(jsFullPath);

InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));

ASSERT( scriptManager ) ;

InterfacePtr<IScriptRunner> scriptRunner(scriptManager,UseDefaultIID());

ASSERT( scriptRunner ) ;

if

(scriptManager)

{

InterfacePtr<IScriptRunner>scriptRunner(scriptManager,UseDefaultIID());

RunScriptParams params(scriptRunner);

ErrorCode err = scriptRunner->RunFile(outFile, params);

}

}

while(kFalse);

I changed the "RunFile" arguments also

RunScriptParams params(scriptRunner);

ErrorCode err = scriptRunner->RunFile(outFile, params);

But Still I'm facing the problem in InDesign CS4.  That's mean  "Adobe InDesign CS4" shout down for serious error happend.

Please kindly help me, for solving this problem.

Thanks & Regards

T.R.Harihara Sudhan

Message was edited by: Adobe-InDesign CS4

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2009 Mar 30, 2009
Thanks Ian.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines