node-activex icon indicating copy to clipboard operation
node-activex copied to clipboard

Interfacing InDesign

Open imatasic opened this issue 8 years ago • 5 comments

InDesign supports OLE and this code works using microsoft jscript from cmd test.js:

var prog = new ActiveXObject("inDesign.Application.CS6");
prog.doScript("alert('Hello from JavaScript',app.name, false);", 1246973031);

cscript //nologo test.js results in an alert box in InDesign.

The same doesn't work from node.js

var winax = require('winax');
var script1 = "alert('Hello from JavaScript',app.name, false);"
var prog = new winax.Object('InDesign.Application.CS6'); //tested both this and ActiveXObject syntax
prog.doScript(script1,1246973031 );

running this does nothing, and console.log() returns undefined

Am I doing something wrong?

imatasic avatar Oct 06 '17 12:10 imatasic

Hello, any ideas regarding this?

imatasic avatar Nov 13 '17 12:11 imatasic

Hello, all is correct, but the problem is unclear. May be "code works using microsoft jscript" only started with wscript.exe? Run the script using the console propgram cscript.exe.

2017-11-13 15:32 GMT+03:00 Matas [email protected]:

Hello, any ideas regarding this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/durs/node-activex/issues/17#issuecomment-343905288, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjGNVdpYY0q5GdKNzAjaYYXdk--sQM2ks5s2DbCgaJpZM4PwaqS .

durs avatar Nov 13 '17 14:11 durs

Hello,

Interfacing InDesign with cscript works image

Interfacing InDesign with node+winax does not work image

imatasic avatar Nov 13 '17 15:11 imatasic

Hello,

This example works with CC 2017 :

require('winax');

var indesign = new ActiveXObject('InDesign.Application.CC.2017',{async:false});

var args = ['Hello from DoScript', 'Your message here.'];
indesign.doScript('alert("First argument: " + arguments[0] + " \\rSecond argument: " + arguments[1]);',1246973031,args);

Hope it will help.

superdevofficial avatar Dec 13 '19 14:12 superdevofficial

@superdevofficial Thank you, I'll try this.

Because cscript was blocking some of the things i needed to do in indesign, i ended up writing my own middleware.

it would definitely be more elegant without it.

imatasic avatar Dec 13 '19 18:12 imatasic