Skip to main content
zeRafio
Inspiring
April 24, 2026
Question

InDesign 21.3 AppleScriptObjC script wont load fondation framework

  • April 24, 2026
  • 6 replies
  • 117 views

I’m using Startup Scripts that loads the macOS Fondation Framework.

They’re running without any problem with all InDesign versions from 2016 to 2025.

At this time, I’m on a MacStudio M4, running macOs Sequoia and InDesign 20.5.3.

The scripts works well. But if I install InDesign 2026 (v21.3) the Framework won’t load.

 

Here is an example of code:

use framework "Foundation"
use scripting additions

tell application id "InDn"
make event listener with properties {event type:"afterOpen", handler:testHandler, name:"testHandler"}
end tell

on testHandler()
set theString to current application's NSString's stringWithString:"test"
end testHandler

 

What’s new in InDesign that prevent the script to run?

Is there a workaround?

    6 replies

    zeRafio
    zeRafioAuthor
    Inspiring
    April 27, 2026

    Do script is really messy:

    tell application id "InDn"
    activate
    set theScript to " set {theAlert, theMess} to arguments
    display alert (theAlert as string) message theMess"
    do script theScript undo name "undoName" undo mode fast entire script with arguments {"La sélection n'est pas compatible.", "Aucun bloc image reçu."}
    end tell

    The code runs, but the text encoding is not right:

    Can someone confirm this bug?

    Legend
    April 27, 2026

    How do you store the outer script? I confirm your dialog with .applescript (text) with some variations of Unicode (UTF8 / UTF16 with/without BOM),  run via AppleScript script menu and from within Script Editor. Would not expect better from InDesign’s script palette.
    In Script Editor event log the string still looks ok.


    When I store “theAlert as string” as a variable and return that from doScript, I also get your wrong encoding. I guess passing the argument thru doScript already passes the internal utf8 string as old MacRoman.

     

    This major rewrite is severely buggy. I must admit I skipped any testing when my suggestion to keep the handlers working was ignored.

    Btw for cosmetics, I’ve never seen that id “InDn” form (while I still remember four char codes).  I nowadays use the bundle id “com.adobe.InDesign” . Irrelevant to your problem though.

    zeRafio
    zeRafioAuthor
    Inspiring
    April 27, 2026

    I made 4 tests with the script saved as a text file (.applescript):

    • Script Debugger 8 with LF ends of line,
    • Script Debugger 8 with CR,
    • Script Editor with LF,
    • Script Editor with CR.

    They all give the same result.

    I use creator codes (like “InDn”) because it’s faster. [Never had any problem with it]

    Anyway, thank you for confirming there’s a bug here.

    And yes, InDesign 2026 is severely buggy. I’m reporting to Adobe via Uservoice, even if I’m sure nobody will respond…

    Legend
    April 26, 2026

    I’ve mentioned this discussion in the original thread of the 2025 AppleScript change announcement, in the hope that someone from Adobe adds your suggested OSAAppleScriptObjCEnabled to the application bundle and tries that example from the top.

    rob day
    Community Expert
    Community Expert
    April 26, 2026

    Hi ​@zeRafio , Have you tried running a simple alert as a startup script just to make sure your startup scripts folder is working at all? Something like:

    tell application id "InDn"
    display dialog "Hello World"
    end tell

     

    zeRafio
    zeRafioAuthor
    Inspiring
    April 26, 2026

    Sure!

    I made simplified versions of my scripts that does not make any call to a framework.

    They run perfectly.

    Legend
    April 26, 2026

    Sounds like a separate issue, and solvable at that. There once was a case where even a simple tell Finder did not work any more, because one of these Apple security flags was missing. While it took a while to trickle thru, the solution was adopted with a later application release, also including Illustrator if I remember correctly.

    I also have one experimental UXP plugin where I use AppleScript to access the contacts framework to populate a QR code. Haven’t touched it in a while but I can look later today whether it still works. If the separate handler file gives you performance problems, using any of the javascript technologies as a launch vehicle could be an alternative to you. On the other hand my main logic is at the UXP side, and I did not keep anything open between the calls.

    zeRafio
    zeRafioAuthor
    Inspiring
    April 26, 2026

    Thanks Dirk for the clarification.
    Your suggestion to run the script with JavaScript is interesting.
    Could you give me an example?

    Legend
    April 26, 2026

    I just retried that plugin and the code (from early 2024) already fails with a “tell application Contacts”. System Settings » Automation still has a correct entry. Given that Apple privacy paranoia is even worse about Contacts it could be very specific or just a re-run of the old problem. Haven’t yet found links to that issue either.

    Anyway, the framework use in that script looks pretty similar to yours, use framework “Foundation” and so forth, all wrapped into a javascript app.doScript(…, ScriptLanguage.APPLESCRIPT_LANGUAGE,arguments);

    But as of above I did not even reach that call. Sorry.

    Legend
    April 24, 2026

    The change was announced and discussed past year, the 20+ years old AppleScript binding used plenty deprecated hacks.

    https://forums.creativeclouddeveloper.com/t/july-23-indesign-office-hours-applescript-event-handlers-upcoming-breaking-change/11200

    Among others the equivalent to ExtendScript named targetengines was lost, including your use of event handlers that would live on in such a session/targetengine.

    As a work around use a separate applescript based application for anything long term, and attach script files as event listener instead of your testHandler method, so they can bridge the event over to that external application/applet.

     

    leo.r
    Community Expert
    Community Expert
    April 24, 2026

    What specifically tells you that the framework won’t load?

     

    In any case, I think that calling a handler from the same script won’t work in InDesign 2026:

     

    make event listener with properties {event type:"afterOpen", handler:testHandler, name:"testHandler"}

     

    You need to save the handler in a separate script and supply the path to that script.

     

    There were discussions about this change here and on prerelease forums, I’ll try to find them.

    zeRafio
    zeRafioAuthor
    Inspiring
    April 25, 2026

    What specifically tells you that the framework won’t load?

    I'm getting errors like: "Class NSString does not understand the message 'stringWithString'".
    This is typical. In Applets or Bundled scripts, we can add OSAAppleScriptObjCEnabled in info.plist. But it's not possible here.

    After hours and dozens of attempts, I concluded that regardless of the method used to execute an external script, an error will occur if it contains a call to a framework.
    The only solution I found to workaround this issue is to embed the part of the script that uses the framework into a library.
    So I have a startup script that launches a handler that calls a library!

    Thanks anyway to both of you, you gave me some excellent clues.