Copy link to clipboard
Copied
Hi everybody! I have a project of creating a software/application that collects my invoice datas from an API and to use inDesign to create a better looking invoice. I have no problem to get my datas using the API but I wanted to know if what I have in mind is possible before to spend hours to look for the solution. I am using Python to get my datas and I was wondering if the inDesign ExtendScript API was supposed to work also with Python on MacOS (I know it works with javascript). I should stay on Python for the GUI and collecting the datas and ideally I would love to stay on Python for the whole process. Let me know if it is possible and if it is not, what would be the best alternatives. I would appreciate a lot ! While waiting for your answer I wish you the best in this difficult period. Take care,
Antoine
Copy link to clipboard
Copied
Hi @Tonio1812,
This is possible, though I have not tested it personally. See the following Github repo for a starting point
https://github.com/lohriialo/indesign-scripting-python
-Manan
Copy link to clipboard
Copied
Hi @Manan Joshi thank you for your answer. I already checked this and I succeeded to print the classic "Hello World" on a new page in inDesign but it was from my windows 10 pc. As I said the final product should run on macOS thats where the problems seem to start because all the documentation from lohriialo is using COM and it does not seem supported by macOS. Or at least it is what I read. Thats the reason of my post. I know I could do it from Applescript but I dont think the other parts would work with that language... But in other hands the inDesign ExtendScript API remains an API and should be useable by everybody, no ?
Copy link to clipboard
Copied
InDesign traditionally supports the platform's way for its scripting API - that is COM on Windows, and AppleEvent / OSA for MacOS.
Unfortunately when I search for Python and AppleEvent or OSA I only find documents from version 2.7.x with deprecation warnings all over the place - that would be a decision of the Python maintainers.
For the historically interested one other, even older finding: https://bugs.python.org/issue586998
Copy link to clipboard
Copied
On the same repo. Allo mentioned a package for python that creates a bridge with AppleScript and hence providing access to the InDesign DOM. See the following
https://github.com/lohriialo/photoshop-scripting-python/tree/master/mac_scripting
So definitely it's possible it's just a matter of finding the right packages which are still updated(the one mentioned in the repo is quite old as mentioned by @Dirk Becker as well).
-Manan
Copy link to clipboard
Copied
Thank you for the link. I already found it and tried to understand this documentation. Maybe I dont know how to use the syntax but the only thing I managed to do is reproduced the exemple of lohriialo. The other functions were not recognized by Python. I tried desperately to add a layer (I even found someone that actually did this) but it did not work. I am running out of ideas... And the fact that the author did not write any other script makes me a bit sceptical.
Copy link to clipboard
Copied
This fellow wrote an excellent book on Applescript and has made a lot of "bridge" type products for AS, Python, etc.: https://twitter.com/hhas02/with_replies