Skip to main content
January 13, 2026
Answered

AppleScript not working with InDesign 2025 and 2026

  • January 13, 2026
  • 4 replies
  • 204 views

I have a legacy AppleScript that works with InDesign 2024, but has since stopped working with the newer versions. The programmer who wrote the original script is no longer at the agency and the need to fix the script has grown greater due to InDesign 2024 no longer being available. The script takes an open InDesign file and writes out two separate results: one with bleeds and one without, each page separated out into indvidual files, and the names representative of the content. I know it has something to do with POSIX paths and aliases, but can't figure out how to update the script.

 

on SaveAsEPS(indd)

 

set Bleed to "24pt"

set OutlineText to true

 

set ScoreLine to 12

set CutLine to 24

 

set thePrintDirName to "SaveAsEPS"

 

tell application "Adobe InDesign 2024"

-- tell application id "com.adobe.InDesign"

set inddFolder to file path of indd

set inddName to name of indd

--set PDFPreset to PDF export preset named "[High Quality Print]"

 

end tell

 

-- the following sets basename to be the InDesign filename without the .indd extension

 

set AppleScript's text item delimiters to "."

set TextItms to text items of inddName

set LastItem to item -1 of TextItms

if LastItem = "indd" then

set TextItms to reverse of rest of reverse of TextItms

end if

set basename to (TextItms as string)

set AppleScript's text item delimiters to ""

 

 

--tell application "System Events"

--

-- if (exists folder thePrintDirName of desktop folder) is false then

-- tell desktop folder to make folder with properties {name:thePrintDirName}

-- end if

-- set PrintFolder to folder thePrintDirName of desktop folder

 

-- if (exists folder basename of PrintFolder) is false then

-- tell PrintFolder to make folder with properties {name:basename}

-- end if

 

-- set ExportPath to (path of PrintFolder) & basename & ":"

 

--end tell

 

set ExportBasePath to ((path to home folder) as string) & "Library:CloudStorage:OneDrive-Alameda-ContraCostaTransit:Documents:Actium:flagart:Decals:"

set ExportPath to ExportBasePath & "export:"

set ExportBleedPath to ExportBasePath & "export_bleed:"

 

tell application "Adobe InDesign 2024"

-- tell application id "com.adobe.InDesign"

 

set thePDFName to (ExportPath & basename & "_all.pdf") as string

set thePDFBleedName to (ExportBleedPath & basename & "_allbleed.pdf") as string

 

set myBleedOffset to Bleed

 

tell PDF export preferences

set page range to all pages

set bleed bottom to myBleedOffset

set bleed top to myBleedOffset

set bleed inside to myBleedOffset

set bleed outside to myBleedOffset

end tell

 

tell indd

with timeout of 600 seconds

--export format PDF type to thePDFName using PDFPreset without showing options

export format PDF type to thePDFBleedName without showing options

end timeout

end tell

 

tell PDF export preferences

set page range to all pages

set bleed bottom to 0

set bleed top to 0

set bleed inside to 0

set bleed outside to 0

end tell

 

tell indd

with timeout of 600 seconds

--export format PDF type to thePDFName using PDFPreset without showing options

export format PDF type to thePDFName without showing options

end timeout

end tell

 

set pageCount to count of pages of indd

 

 

repeat with thePageNum from 1 to pageCount

 

set myPage to page thePageNum of indd

 

set myPageName to name of myPage

set myPageNumber to (characters -4 thru -1 of myPageName) as string

if (myPageNumber = "-001") then

set myPageName to marker of applied section of myPage

end if

 

tell application "Adobe Illustrator"

 

set user interaction level to never interact

set page of PDF file options of settings to thePageNum

 

-- outline version for decal printing

set thePDFBleedPosixPath to POSIX path of (thePDFBleedName as alias)

open file thePDFBleedPosixPath without dialogs

 

set Ra to artboard rectangle of artboard 1 of current document -- this is the new artboard with lots of bleed

set Rscore to {(item 1 of Ra) + ScoreLine, (item 2 of Ra) - ScoreLine, (item 3 of Ra) - ScoreLine, (item 4 of Ra) + ScoreLine}

-- the score line

set Rorig to {(item 1 of Ra) + CutLine, (item 2 of Ra) - CutLine, (item 3 of Ra) - CutLine, (item 4 of Ra) + CutLine}

-- the real edge of the final

 

set ArtboardRect to make rectangle at beginning of current document with properties {bounds:Rorig, filled:false, stroke width:1, stroke color:{class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:100.0}}

 

set ScoreRect to make rectangle at beginning of current document with properties {bounds:Rscore, filled:false, stroke width:1, stroke color:{class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:100.0}}

 

set theEPSName to (ExportBleedPath & myPageName & "_outl.eps") as string

 

convert to paths text frames of current document

save current document in (theEPSName) as eps with options {CMYK PostScript:true, embed all fonts:true, preview:color TIFF, compatibility:Illustrator 12}

close current document saving no

 

-- non-outline version for incorporating in flags

 

set thePDFPosixPath to POSIX path of (thePDFName as alias)

open file thePDFPosixPath without dialogs

 

set PDFSaveName to (ExportPath & myPageName & ".pdf") as string

save current document in (PDFSaveName) as pdf with options {PDF preset:"[High Quality Print]"}

close current document saving no

 

end tell

 

end repeat

 

 

 

end tell

 

end SaveAsEPS

 

on run {}

 

tell application "Adobe InDesign 2024"

-- tell application id "com.adobe.InDesign"

 

set theInDD to active document

tell me to SaveAsEPS(theInDD)

 

end tell

 

beep

display alert "Done exporting." giving up after 10

 

end run

 

on open Lst

 

tell application "Adobe InDesign 2024"

-- tell application id "com.adobe.InDesign"

repeat with zItm in Lst

set Itm to zItm as alias

set theInDD to open Itm

 

tell me to SaveAsEPS(theInDD)

 

close theInDD saving no

 

end repeat

end tell

 

beep

display alert "Done exporting." giving up after 10

 

end open

Correct answer leo.r

you can simply do this:

 

set ExportBasePath to POSIX path of (((path to home folder) as string) & "Library:CloudStorage:OneDrive-Alameda-ContraCostaTransit:Documents:Actium:flagart:Decals:")

 

etc.

 

that is:

 

POSIX path of yourHFSPath

4 replies

January 15, 2026

Thanks everyone. Yes, it appears that just setting my POSIX path to the HFS path is the way around this change. Unfortunately, there are a few other errors popping up in the script, which are beyond this forum, and will likely mean that I'll need some outside help to resolve. Thanks again. 

Participant
January 22, 2026

sometimes applescript will complain about permissions/security if your running scripts from the cloud. so if it still throws errors explore that. 

leo.r
Community Expert
leo.rCommunity ExpertCorrect answer
Community Expert
January 14, 2026

you can simply do this:

 

set ExportBasePath to POSIX path of (((path to home folder) as string) & "Library:CloudStorage:OneDrive-Alameda-ContraCostaTransit:Documents:Actium:flagart:Decals:")

 

etc.

 

that is:

 

POSIX path of yourHFSPath

Mike Witherell
Community Expert
Community Expert
January 13, 2026

In AppleScripting, the change to POSIX style basically means editing out colons in favor of forward slashes:

  • HFS Paths (AppleScript Native): Use colons : as separators and start with the volume name (e.g., "Macintosh HD:Users:chris:Documents:").
  • POSIX Paths (Unix Style): Use forward slashes / as separators and often omit the startup disk name, starting with a leading slash (e.g., "/Users/chris/Documents/").
Mike Witherell
Participant
January 13, 2026

ai can eventually come up with the right answer it make several iterations of it feeding its errors back to it. 

 

use AppleScript version "2.8"
use scripting additions

------------------------------------------------------------
-- CONFIG
------------------------------------------------------------
property kBleed : "24pt"
property kTimeoutSec : 600
property kExportNoBleedFolderName : "export"
property kExportBleedFolderName : "export_bleed"

------------------------------------------------------------
-- HELPERS
------------------------------------------------------------
on ensureFolderPosix(posixFolderPath)
do shell script "mkdir -p " & quoted form of posixFolderPath
end ensureFolderPosix

on stripInddExtension(inddNameText)
set inddNameText to inddNameText as string

set oldTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set parts to text items of inddNameText
set AppleScript's text item delimiters to oldTID

if (count of parts) < 2 then return inddNameText

set lastPart to item -1 of parts as string
if lastPart is "indd" then
set AppleScript's text item delimiters to "."
set baseParts to items 1 thru -2 of parts
set baseName to baseParts as string
set AppleScript's text item delimiters to oldTID
return baseName as string
else
return inddNameText as string
end if
end stripInddExtension

on endsWith001(pageNameText)
set pageNameText to pageNameText as string
try
set tail4 to (characters -4 thru -1 of pageNameText) as string
return (tail4 is "-001")
on error
return false
end try
end endsWith001

on replaceText(theText, searchString, replacementString)
set theText to theText as string
set searchString to searchString as string
set replacementString to replacementString as string

set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to searchString
set theItems to text items of theText
set AppleScript's text item delimiters to replacementString
set newText to theItems as string
set AppleScript's text item delimiters to oldTIDs
return newText as string
end replaceText

on safeFileName(s)
set t to s as string
set t to my replaceText(t, ":", "-")
set t to my replaceText(t, "/", "-")
set t to my replaceText(t, return, " ")
set t to my replaceText(t, linefeed, " ")
return t as string
end safeFileName

on exportPDF(inddDoc, outFileSpec)
tell application "Adobe InDesign 2026"
tell inddDoc
with timeout of kTimeoutSec seconds
export format PDF type to outFileSpec without showing options
end timeout
end tell
end tell
end exportPDF

------------------------------------------------------------
-- MAIN WORKER
------------------------------------------------------------
on ExportTwoSetsPerPage(inddDoc)
-- Desktop output paths (POSIX)
set desktopPosix to (POSIX path of (path to desktop folder)) as string
set exportNoBleedPosix to (desktopPosix & kExportNoBleedFolderName & "/") as string
set exportBleedPosix to (desktopPosix & kExportBleedFolderName & "/") as string

my ensureFolderPosix(exportNoBleedPosix)
my ensureFolderPosix(exportBleedPosix)

-- Document name → basename, and page count
tell application "Adobe InDesign 2026"
set inddName to (name of inddDoc) as string
set pageCount to (count of pages of inddDoc) as integer
end tell

set baseName to my stripInddExtension(inddName)

repeat with p from 1 to pageCount
-- Determine page name with legacy behavior
tell application "Adobe InDesign 2026"
set pg to page p of inddDoc
set pgName to (name of pg) as string

if my endsWith001(pgName) then
try
set pgName to (marker of applied section of pg) as string
end try
end if
end tell

set pgName to my safeFileName(pgName)

-- Build output paths
set outNoBleedPosixFile to (exportNoBleedPosix & baseName & "_" & pgName & ".pdf") as string
set outBleedPosixFile to (exportBleedPosix & baseName & "_" & pgName & ".pdf") as string

-- IMPORTANT: file spec, not alias
set outNoBleedFileSpec to POSIX file outNoBleedPosixFile
set outBleedFileSpec to POSIX file outBleedPosixFile

------------------------------------------------
-- BLEED EXPORT (per page)
------------------------------------------------
tell application "Adobe InDesign 2026"
tell PDF export preferences
set page range to (p as string)
set bleed top to kBleed
set bleed bottom to kBleed
set bleed inside to kBleed
set bleed outside to kBleed
end tell
end tell
my exportPDF(inddDoc, outBleedFileSpec)

------------------------------------------------
-- NO-BLEED EXPORT (per page)
------------------------------------------------
tell application "Adobe InDesign 2026"
tell PDF export preferences
set page range to (p as string)
set bleed top to 0
set bleed bottom to 0
set bleed inside to 0
set bleed outside to 0
end tell
end tell
my exportPDF(inddDoc, outNoBleedFileSpec)
end repeat
end ExportTwoSetsPerPage

------------------------------------------------------------
-- ENTRY POINTS
------------------------------------------------------------
on run
tell application "Adobe InDesign 2026"
if not (exists document 1) then
display alert "No InDesign document is open."
return
end if
set inddDoc to active document
end tell

my ExportTwoSetsPerPage(inddDoc)

beep
display alert "Done exporting." giving up after 10
end run

on open fileList
tell application "Adobe InDesign 2026"
repeat with f in fileList
set inddDoc to open (f as alias)
my ExportTwoSetsPerPage(inddDoc)
close inddDoc saving no
end repeat
end tell

beep
display alert "Done exporting." giving up after 10
end open