Wednesday, July 18, 2018

#1 2010-10-03 12:39:16 pm

elsakippy
Member
Registered: 2005-08-15
Posts: 18

Put path in code? Indesign to PDF

Hi
Here's a piece of code that makes two types of pdf (Hi-Res and Low-Res) from any Indesign file, selected in the Finder. One thing that I can't seem to figure out: all files end up on my desktop. I'd like to land them IN A FOLDER on my desktop. Can anyone help me?

---

Applescript:


tell application "Finder"
   set myfiles to the selection
end tell

tell application "Adobe InDesign CS5"
   activate
   repeat with i in myfiles
       open i
       
       --THIS PRESET NAME SHOULD BE PRESENT IN InDesign!!
       --CHECK: file -> PDF export presets
       set thePreset to "PDF ELS HI-RES"
       
       set theDesk to path to desktop as string
       set f to (name of i as string)
       set thepath to theDesk & f
       
       export document 1 to file (thepath & "_HR.pdf") format PDF type using PDF export preset thePreset without showing options
       
       set thePreset to "[Smallest File Size]"
       
       set theDesk to path to desktop as string
       set f to (name of i as string)
       set thepath to theDesk & f
       
       export document 1 to file (thepath & "_LR.pdf") format PDF type using PDF export preset thePreset without showing options
       
       close active document saving no
   end repeat
end tell

===

Thx

Elszy


Filed under: PDF Indesign Path

Offline

 

#2 2010-10-03 12:52:10 pm

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11499
Website

Re: Put path in code? Indesign to PDF

Hi,

you haven't specified a custom folder

Applescript:


…
set theDesk to (path to desktop as text) & "myFolder:"
…

without any additional code the script assumes that the folder "myFolder" exists.
The trailing colon is important

I doubt, that Indesign can open a Finder file specifier, better write

Applescript:


…
open (i as alias)
…


regards

Stefan

Offline

 

#3 2010-10-03 02:30:14 pm

elsakippy
Member
Registered: 2005-08-15
Posts: 18

Re: Put path in code? Indesign to PDF

Thank you Stefan, that works just fine. Exactly what I need, so much obliged!

Elsa

Offline

 

#4 2010-10-12 01:33:27 pm

Matt-Boy
Member
Registered: 2005-10-21
Posts: 480

Re: Put path in code? Indesign to PDF

If you want to make sure the user didn't delete the target folder, put this at the beginning of the script:

Applescript:

tell application "Finder"
   if not (exists folder "myFolder") then
       make new folder at desktop with properties {name:"myFolder"}
   end if
end tell

Offline

 

#5 2010-10-12 02:38:57 pm

elsakippy
Member
Registered: 2005-08-15
Posts: 18

Re: Put path in code? Indesign to PDF

Great! Thank you!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)