0

Is there a way to create automated tests for InDesign in Windows? For example:

  • Open InDesign
  • Open a Document
  • Run a JSX Script
  • Close file
  • Close InDesign

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.

Elkas
  • 603
  • 12
  • 27
  • I don't know vb script but got a lot of experience with AS/ASOC. If this is still an option show what you've got. – Pat_Morita Apr 11 '17 at 05:22
  • Hello Pat_Morita. I was able to use C# to get what I needed. I've posted here the solution – Elkas Apr 13 '17 at 10:25

1 Answers1

1

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:

  • Windows 10 Pro
  • Visual Studio 2017 Pro (Trial)
  • InDesign CC 2017

Now the steps of how I did it:

  • Start InDesign as admin to create a file so I could use as reference in my Visual Studio Project
  • Create a new Console project (This was my case)
  • Add the COM Reference to the project. In the tab COM, you will find a reference to an Indesign tlb file COM References

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.

Elkas
  • 603
  • 12
  • 27