Is there a way to create automated tests for InDesign in Windows? For example:
From what I've researched I didn't find an straight forward way to do it. What I found was a mix of languages. VBScript with JSX. I had this with AppleScript instead of VBScript but it was messy. It could crash at any moment without an easy way of recover it.
I was able to create an automated test using C#. Before I start I needed to do a couple of steps in order to have a good environment to develop.
This is the setup I used:
Now the steps of how I did it:
Now to create an Indesign instance I used the following code:
Type inDesignAppType = Type.GetTypeFromProgID("InDesign.Application.CC.2017");
InDesign.Application myInDesign = (InDesign.Application)Activator.CreateInstance(inDesignAppType);
After this, to run an InDesign script I used:
String myString = myInDesign.DoScript("return \"My String\"", InDesign.idScriptLanguage.idJavascript, new object[] {""});
I hope my solution helps someone else.