Skip to main content
Inspiring
May 2, 2018
Question

set thepath to (full name of document 1) as string

  • May 2, 2018
  • 1 reply
  • 587 views

In the ExportSinglePdfs script, there is a line that grabs the path with this line:

set thepath to (full name of document 1) as string

Later in the applescript, it makes single pdfs and saves/names them with this:

export document 1 to file (thepath & "-" & i & ".pdf") format PDF type using PDF export preset thePreset without showing options

The pdfs are made in the same parent folder as the Indesign document.

My issue is that our job folder structure has another sub-folder called "PDF XMF" which would be a better place for them so they don't have to be moved later. It's not a big issue.

I was trying to rebuild the path but had no luck using other variable like these:

set myDocument to (active document)

set myDocumentname to (name of myDocument)

set thepath to (file path of document 1) as string

set thepath to thepath & "PDF XMF" & (document title of document 1)

Anyone know how to edit thePath to use a subfolder named "PDF XMF"?

This topic has been closed for replies.

1 reply

Inspiring
May 2, 2018

tell application "Adobe InDesign CC 2018"

  set myDocument to (active document)

  set myDocumentname to (name of myDocument) as string

  set thepath to (file path of myDocument) as string

end tell

set shortName to findReplace(".indd", "", myDocumentname)

set thepath to thepath & "PDF XMF" & shortName & ".pdf"

tell application "Adobe InDesign CC 2018"

  -- Export to PDF

end tell

on findReplace(findText, replaceText, sourceText)

  set ASTID to AppleScript's text item delimiters

  set AppleScript's text item delimiters to findText

  set sourceText to text items of sourceText

  set AppleScript's text item delimiters to replaceText

  set sourceText to "" & sourceText

  set AppleScript's text item delimiters to ASTID

  return sourceText

end findReplace

tlotzerAuthor
Inspiring
May 2, 2018

Thank you. I figured it was more complicated than I figured.