AS for indesign export presets?

Greetings all,

I’ve been trying to make a script that will create a PDF doc simply by dropping an .indd onto it. I’ve got some presets in my indesign export that I would like to have separate scripts for. But I can’t seem to get it right. I’m a novice in Applescript, though eager to learn. Can anyone help me?

thnx in advance

Hi there,
if you save this script as an application and drop your Indesign file on it it will print the file using your specified print preset.

on open thefile
	tell application "Adobe InDesign CS2"
		activate
		open thefile
		print active document using "A4_to_Mosaic_PDF" without print dialog
		tell active document to save
		tell active document to close
	end tell
end open

:lol:

Thnx m8! Is it possible to create a hotfolder for it? I mean like: drop the .indd doc into the folder and it generates the desired PDF?

I’m beginning to love AS!

?

Weird, the script opens InDesign CS alright but then it stops and gives me the following message:

<> of application “InDesign CS” doesn’t understand the print message

I guess this is because I’m using Adobe InDesign CS instead of CS2, I’m hopeless behind in apps I know, but is it possible to adept the script to CS?

I’ve tried to do this myself, see my attached script

on open thefile
	tell application "InDesign CS"
		activate
		open thefile
		print active document using "LeesPDF" without print dialog
		tell active document to save
		tell active document to close
	end tell
end open

Hi rangata,
this should do the trick for CS!

on adding folder items to this_folder after receiving added_items
	repeat with i from 1 to the number of items of added_items
		set thisitem to item i of added_items
		tell application "InDesign CS"
			activate
			open thisitem
			print document 1 using "CHOT_to_Mosaic_PDF" without print dialog
			tell document 1 to save
			tell document 1 to close
		end tell
	end repeat
end adding folder items to

Save this into the Folder Action Scripts folder and attach it to your folder.

This looks very promissing! All goes well (I think), but where is the newly made PDF placed? I can’t seem to find it, not even with cmnd-f.

If you’re using a Print Preset then the file will be printed to whatever Printer is selected in your Preset. You can choose to print to a Postscript file but this will have to be distilled separately so maybe the best way of creating a PDF from your Indesign file would be to Export as a PDF rather than printing using a preset!

Hmmmzzz is it possible to change the script to export instead of printing? In some export presets I’m using the PDF-layers option, if I Distill a PS I’ll lose this setting.

Hi there, this will export as a pdf, make sure you have an export preset setup though.

on adding folder items to this_folder after receiving added_items
	set myFileName to "thispdf.pdf"
	repeat with i from 1 to the number of items of added_items
		set thisitem to item i of added_items
		tell application "InDesign CS"
			activate
			open thisitem
			set the_container to (file path of document 1 as string)
			set doc_name to (name of document 1 as string) & ".pdf"
			export document 1 format PDF type to the_container & doc_name using PDF export preset "EMAP_to_Mosaic_PDF" without showing options
			tell document 1 to close with saving
		end tell
	end repeat
end adding folder items to

:smiley:

YIPPIE!!! Thnx blend3! This works perfectly, exaclty what I needed! Looking at the script it tells me I’ve got to learn a lot (I know this isn’t a very hard one, but still…). Now, if I’m really lazy I’d try to build in a ‘close current doc’ command, I’m going to try this myself, otherwise I would not learn AS now, would I?

:wink:

Thnx again blend3!