Skip to main content
Known Participant
April 13, 2023
Question

Call the Javascript in the SDK

  • April 13, 2023
  • 1 reply
  • 281 views

Hi,

I need to call the javascript file in the Adobe InDesign SDK. I have used the below code call the script but I cannot able to call the script while clicking the button in the plugin panel.

if (view->GetWidgetID() == kColumnSetUpButtonWidgetID)
		{
			ScriptData script;
			IDFile f(PMString("D:\\Adobe InDesign 2020\\Adobe InDesign 2020\\Plug-Ins\\TradingBell\\HND\Scripts\\demo_script.jsx"));
			script.SetFile(f);
			ScriptData result;
			PMString errorString;


			InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
			InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
		//	Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner, script, arg, result, errorString, kTrue);
			PMString retval;
			result.GetPMString(retval);
			CAlert::InformationAlert(retval);

		}

 

 

This topic has been closed for replies.

1 reply

Legend
April 13, 2023

When you say "plugin panel" is that by any chance a modal dialog rather than a palette panel?

Modal dialogs have a ton of overhead to support undo on abort, preview and so forth.

For that reason only few explicitly allowed script requests are permitted when a modal dialog is open.