Friday, December 15, 2017

#1 2015-09-25 07:21:34 am

meadsy25
Member
Registered: 2015-09-21
Posts: 4

PDF to the same folder

Hi, I'm a noob to Applescripting and trying to work my way through all the great advise on this site.

I've found different parts of the script I want to create but really struggle to combine them.

Basically I'd like the script to find an InDesign with the same folder then PDF it into that same folder?

Is that possible and can anyone give me any pointers please?

Cheers
Rich

Offline

 

#2 2015-09-28 05:23:33 am

meadsy25
Member
Registered: 2015-09-21
Posts: 4

Re: PDF to the same folder

So far I have the following:

Applescript:



set x to path to me
tell application "Finder"
   set tFile to (file "template.indd" of (container of x)) as alias
end tell

tell application "Adobe InDesign CC 2015"
   open tFile
   
   set _NoCrops to PDF export preset "[Press Quality]"
   set _dest to path to me as string
   set _Name to name of active document as string
   
   tell active document
       export format PDF type to (_dest & _Name & " - No Crops X" & ".pdf") using _NoCrops without showing options
   end tell
   
   close active document saving yes --or no
   
end tell

I don't get an error, so I assume its correct. The script appears to open and close the indesign file, however I get no PDF. I am assuming its the destination as when changed to desktop it all works.

I'd really like to get this to save in the same folder that the indesign file.

Any help greatly appreciated.

Offline

 

#3 2015-09-28 06:01:21 am

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

Re: PDF to the same folder

Hi,

first of all, welcome to MacScripter.

Second of all, please post questions regarding AppleScript into the AppleScript | OS X forum. AppleScript Studio is an old developer environment in Xcode.

The destination folder is the container of the script

Applescript:


set x to path to me
tell application "Finder"
   set destinationFolder to container of x as text
   set tFile to (file "template.indd" of folder destinationFolder) as text
end tell

tell application "Adobe InDesign CC 2015"
   open tFile
   
   set _NoCrops to PDF export preset "[Press Quality]"
   set _Name to name of active document as string
   tell active document
       export format PDF type to (destinationFolder & _Name & " - No Crops X" & ".pdf") using _NoCrops without showing options
   end tell
   
   close active document saving yes --or no
   
end tell

Last edited by StefanK (2015-09-28 06:04:43 am)


regards

Stefan

Offline

 

#4 2015-09-28 06:35:33 am

meadsy25
Member
Registered: 2015-09-21
Posts: 4

Re: PDF to the same folder

Great thank you. Works a treat.

Sorry about that, was following a lead from previous thread.

My next issue lies with updating links. Would you mind giving me a pointer there please? I have the following:

Applescript:



set x to path to me
tell application "Finder"
   set destinationFolder to container of x as text
   set tFile to (file "template.indd" of folder destinationFolder) as text
end tell

tell application "Adobe InDesign CC 2015"
   open tFile
   
   tell document 1
       set linkList to every link
       repeat with aLink in linkList
           if status of aLink is link out of date then
               update aLink
           end if
       end repeat
   end tell
   
   set _NoCrops to PDF export preset "[Press Quality]"
   set _Name to name of active document as string
   tell active document
       export format PDF type to (destinationFolder & _Name & " - No Crops X" & ".pdf") using _NoCrops without showing options
   end tell
   
   close active document saving yes --or no
   
end tell

I could be completely wrong but this is what comes of trying to cobble code together.

Cheers

Offline

 

#5 2015-09-28 07:50:55 am

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

Re: PDF to the same folder

Sorry I'm not that familiar with Indesign


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)