EST. 2007
ADMISSIONS OPEN
Apply Now
← Creative Hut Library
Editing and design · Portfolio

Run AI Scripts in InDesign

What JSON, JSX and UXP files are, how to add the script pack to InDesign, how to test it and what to do when a script fails.
7 min read

By Abin Alex and Anu Joseph

Creative Hut Academy Library · Updated 28 November 2026

Abstract

A technical guide to running AI-written scripts in Adobe InDesign 2026. It explains what JSON, JSX and UXP files are, how to add the Creative Hut script pack to the Scripts panel, how to test that scripts run on your computer, and how to fix an error with a chatbot. It ends with a check to make before you print. The design method is in guide 4.2.

Keywords: InDesign script, JSX, UXP, JSON, Scripts panel, run script in InDesign, AI script for InDesign, ChatGPT, Claude, Gemini, Grok

01 · JSON, JSX and UXP

What are JSON, JSX and UXP files?

Short answer. JSON holds your text, JSX builds the page, and UXP is a newer script type that does the same job as JSX.

Definition
A script is a short program that builds the page for you. It uses two kinds of file. A JSON file (.json) is plain text that holds only data, such as the heading, the entries and the photograph names. A JSX file (.jsx) is a script in ExtendScript, the older InDesign script language, that reads the data and builds the page. A UXP script (.idjs) is the newer InDesign script type, written in modern JavaScript. JSX and UXP do the same job.

Key facts

  • JSON is data only. It does nothing until a script reads it, and any text editor can open it.
  • JSX runs in InDesign 2026. ChatGPT, Claude, Gemini and Grok can all write it, so try the same prompt in each.
  • UXP (.idjs) is newer and has fewer examples online, so chatbots make more mistakes with it. Build the JSX first.
  • Keep the layout in the JSX and the words in the JSON. To change a title, edit the JSON and run the script again.
  • Use one script type per document. Do not run the JSX and the UXP version on the same file.
How to
Sample: toc_example.json
{
  "heading": "Table of Contents",
  "entries": [
    { "num": "01", "title": "Unwatched" },
    { "num": "02", "title": "Tide of Hands" },
    { "num": "03", "title": "Ritual in Red" },
    { "num": "04", "title": "Rituals of Belonging" }
  ],
  "photos": ["images/photo1.jpg", "images/photo2.jpg", "images/photo3.jpg"]
}
Cham tip
Open the JSON in Notepad or TextEdit, not Word. Word adds hidden characters that break the file.
Cham task
Open toc_example.json from the pack, change the first title, and save it.
End of 01 · JSON, JSX and UXPNext: 02 · Add the pack
02 · Add the pack

How do you add a script to InDesign?

Short answer. Extract the pack, open the Scripts panel, reveal the Scripts Panel folder and copy the Creative Hut folder into it.

Definition
InDesign runs scripts from a Scripts Panel folder. Any script placed there shows in the Scripts panel inside InDesign.
How to
  1. Extract the zip. You get one folder called Creative Hut.
  2. In InDesign open Window > Utilities > Scripts.
  3. In the panel, right-click User and choose Reveal in Finder (Mac) or Reveal in Explorer (Windows).
  4. Open the folder called Scripts Panel.
  5. Copy the whole Creative Hut folder into it.
  6. If it does not show in the panel, close and reopen InDesign.
Keep each .json file in the same folder as its script. The script reads its text from it.
Cham task
Find Creative Hut under User in the Scripts panel and open each folder.
End of 02 · Add the packNext: 03 · Test the scripts
03 · Test the scripts

How do you test that scripts work on your computer?

Short answer. Run CH_Test_Setup. If it says Setup works, run the example script and open the Output folder.

Definition
The test script only opens a page with grid guides and shows a message. It saves nothing, so it is safe to run. The example script then builds the table of contents page from guide 4.2.
How to
  1. In the Scripts panel open Creative Hut > 00_Test_Setup and double-click CH_Test_Setup.
  2. A page opens and an alert says Setup works. Close the document without saving.
  3. Install the Montserrat font if you have not.
  4. Open 01_Example_Table_of_Contents and double-click CH_TOC_Example_Page05.
  5. When it finishes, open the TOC_Example_Output folder next to the script.

The Output folder holds

  • The .indd file
  • A backup copy with the date and time
  • A print PDF with 3 mm bleed and crop marks
  • A screen PDF
  • A package folder
The script looks for photo1.jpg, photo2.jpg and photo3.jpg in the images folder. If they are missing it draws grey frames and warns you.
Cham task
Put three of your own photographs in the images folder, name them photo1.jpg, photo2.jpg and photo3.jpg, and run the example again.
End of 03 · Test the scriptsNext: 04 · Fix and check
04 · Fix and check

What do you do when a script fails?

Short answer. Copy the exact error and line number, paste them into the same chat with Prompt 3, and run the corrected script.

Definition
A script can fail on the first run. InDesign shows an error window with a message and a line number. A chatbot fixes errors quickly when you give it the exact text.
How to
Prompt 3: Fix an error
The script gave this error in InDesign 2026, version 22:
[paste the exact error text and line number]

Or the page looks wrong in this way: [describe what is wrong, and attach a screenshot]

Fix only this problem. Do not change anything else. Give me the complete corrected script in one code block, and tell me in one line what changed.
Prompt 4: Convert a working JSX to UXP
This ExtendScript (.jsx) works in InDesign 2026, version 22. Convert it to a UXP script (.idjs) for the same InDesign version.

Rules: use the official Adobe InDesign UXP scripting API and modern JavaScript, load the app with require("indesign"), read page.json with the UXP file system, keep the same layout, styles, colours and export steps, and do not mix in ExtendScript code.

Give me the full .idjs code in one code block, and tell me in three lines what changed from the JSX.

[paste the working JSX]
Use Prompt 4 only after the JSX runs without errors.

Check before you print

  • Margins, grid and fonts match your page values.
  • The page number shows the number you set.
  • No text overflows its frame.
  • The print PDF has bleed and crop marks.
  • The files are in sRGB. Ask your printer whether they need CMYK before you send files.
  • Save each working script under a new name before you ask for changes.
Cham tip
If a script keeps failing, paste the same prompt into a second chatbot and compare.
End of 04 · Fix and check

Questions beginners ask

What is the difference between JSX and UXP?

Both are InDesign script types that do the same job. JSX is the older ExtendScript style and is the safer place to start. UXP (.idjs) is the newer style, written in modern JavaScript.

Do I need to know how to code?

No. A chatbot writes the script. You need to give exact values, copy the files into the right folder and paste any error back into the chat.

Can I use ChatGPT, Claude, Gemini or Grok?

Yes. Paste the same prompt into any of them. They only write the script. InDesign runs it.

Why does the script not show in the Scripts panel?

The folder is probably in the wrong place. Right-click User in the Scripts panel, choose Reveal, and check that Creative Hut is inside the Scripts Panel folder. Then restart InDesign.

Which InDesign version do I need?

The pack and prompts are written for InDesign 2026 (version 22). Tell the chatbot your exact version if you use another one.

© 2026 Creative Hut Academy. Written by Abin Alex and Anu Joseph. Last updated 28 November 2026. To copy, republish, translate or adapt any part of it, you need written permission. Ask through the contact page.
Next: 4.2, Design Your Book’s Table of Contents with AI →More guides in the Library →
Learn this hands on

Make this your craft at Creative Hut Academy

Creative Hut Academy in Mattakkara, Kottayam, Kerala teaches photography, cinematography, editing, sound and AI filmmaking in one-year residential diplomas. Students come from across India.

Want to talk? Message us on WhatsApp, or ask Cham, our AI mentor, a study doubt.