Highlighted

Scripting inDesign with Python on Mac OS using inDesign ExtendScript API

Explorer ,
Nov 02, 2020

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

TOPICS
Scripting

Views

89

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Scripting inDesign with Python on Mac OS using inDesign ExtendScript API

Explorer ,
Nov 02, 2020

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

TOPICS
Scripting

Views

90

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 02, 2020 0
Adobe Community Professional ,
Nov 02, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 02, 2020 0
Explorer ,
Nov 03, 2020

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 ?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 03, 2020 0
Advisor ,
Nov 03, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 03, 2020 0
Adobe Community Professional ,
Nov 03, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 03, 2020 0
Explorer ,
Nov 03, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 03, 2020 0
Participant ,
Nov 03, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 03, 2020 1