durs / node-activex

Node.JS Implementaion of ActiveXObject
MIT License
323 stars 62 forks source link

Interfacing InDesign #17

Open imatasic opened 6 years ago

imatasic commented 6 years ago

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 commented 6 years ago

Hello, any ideas regarding this?

durs commented 6 years ago

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 notifications@github.com:

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 .

imatasic commented 6 years ago

Hello,

Interfacing InDesign with cscript works image

Interfacing InDesign with node+winax does not work image

superdevofficial commented 4 years ago

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.

imatasic commented 4 years ago

@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.