Skip to main content
vnh68
Inspiring
June 26, 2023
Answered

UXP script for calling executable file (Windows, *.exe) with arguments

  • June 26, 2023
  • 5 replies
  • 3247 views

I want to call a program (*.exe ) from the UXP *.idjs script. Certain arguments need to be passed to *.exe. The result of the action is the creation of a PDF file that needs to be linked to the *.indd file. Is it possible to do this at this stage of development of idjs scripts in InDesign?

This topic has been closed for replies.
Correct answer Peter Kahrel

No, not possible.

5 replies

Robert at ID-Tasker
Legend
July 5, 2023
Peter Kahrel
Community Expert
Community Expert
July 1, 2023

Not sure where UXP is with doScript at the moment,

 

doScript() now works in UXP.

Community Expert
July 1, 2023

Hi Peter,

I still cannot see InDesign 18.4 as an update here in Germany.

So it could be that @vnh68 also has no access. Should be a matter of days perhaps, but I do not think, that doScript() for UXP is supported with InDesign 2023 version 18.3.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Peter Kahrel
Community Expert
Community Expert
July 1, 2023

I do not think, that doScript() for UXP is supported with InDesign 2023 version 18.3.

 

Correct. But it does work in 18.4

Community Expert
June 29, 2023

Hi @vnh68 ,

even with ExtendScript I'm not sure if you could pass arguments to an app you are starting with file.execute().

Though, I'm not sure what you are exactly want to do in the moment you are using ExtendScript's method execute().

 

Regards,
Uwe Laubender
( Adobe Community Expert )

vnh68
vnh68Author
Inspiring
June 29, 2023

Suppose we have a formula as text:

$\rm \sigma(\textit{X}_{\textit{i}}) = \sqrt{\displaystyle\sum\limits_{\textit{i}\, =\, 1}^{34}\,\left(\textit{X}_{\textit{i}} - \textit{M}(\textit{X}_{\textit{i}})\right)^2},$

 

And this is how part of the page looks after the script has completed its work:

 

 

The program creates a high-quality PDF of the formula, it just needs to call the program from the script and paste (using the script) the resulting PDF in the right place on the page.

When calling the program (*.exe), we need to pass the text of the formula as an argument. 

The program itself determines all the sizes of characters, knowing only that the size of the surrounding text is 11 pt.

Also, instead of formulas, there can be TikZ graphics (function graphs, diagrams, etc.)...

 

Loic.Aigon
Legend
June 30, 2023

Not sure where UXP is with doScript at the moment, but with ExtendScript that was pretty much the way to go to execute command line tools from Javascript. You can give it a try.

https://developer.adobe.com/indesign/dom/api/a/Application/

Loic.Aigon
Legend
June 26, 2023

"The result of the action is the creation of a PDF file that needs to be linked to the *.indd file"

 

What do you need an exe app for in that case? Creating the pdf file is basically done in your idjs. And for attachments, you can embed the pdf. 

 

Or is it the other way around to attach the indd file inside the PDF file?

vnh68
vnh68Author
Inspiring
June 27, 2023
I must compile *.tex files to *.pdf (alone formulas or scientific
graphics).
The source text of formulas can be stored directly in the InDesign file as
text; when the formula is changed, the text can be immediately recompiled
to pdf and inserted into the layout InDesign file.

TEX is very inconvenient in detail (support for CMYK, text tables, and
more), and InDesign does not work with math formulas directly. I want to
automate the matching routine.
Loic.Aigon
Legend
June 28, 2023

Have you considered MathMagic? Looks to me that is the go-to plugin for tex files processing:

http://www.mathmagic.com/product/pro.html

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
June 26, 2023

No, not possible.