Postscript and Printer presets in Illustrator CS1 and InDesign CS1

I am trying to simply print a postscript file to a watched folder with Illustrator and InDesign, using a printer preset.
I have done this, successfully, with Quark.

Is there an inherent bug in both Illustrator and InDesign that keeps it from doing these things?

In the example below, I’ve told it to print using the default preset, and it doesn’t even want to do that.

tell application "InDesign CS"
	activate
	set user interaction level to never interact
	tell document 1
		print using printer preset default
	end tell
end tell

and of course it fails when i try to print with the preset that i actually want to use.

tell application "InDesign CS"
	activate
	set user interaction level to never interact
	tell document 1
		print using printer preset "xxx"
	end tell
end tell

I work for a financial corp and I don’t think I should include certain things, the name of the preset is not “xxx”, but it’s real name would give some things away.

Can anyone help me out with this?

Model: Dual 2GHz G5, 1 GB
AppleScript: 2.0
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

bradevans,

I don’t really script Indesign but this is what I found:

tell application "InDesign CS"
	activate
	set user interaction level to never interact
	tell document 1
		print using "xxx"
	end tell
end tell

You need to leave out the “print preset” part of the line. The text after the using is the name of the preset to use.

tell application "InDesign CS"
	activate
	set user interaction level to never interact
	tell document 1
		print using default
	end tell
end tell

Hope this helps.

PreTech

Thanks, that’s a start.

Now I’m wondering how I should go about saving the postscript file to the correct directory.

Thanks again.

Model: Dual 2GHz G5, 1 GB
AppleScript: 2.0
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

You have to set the file path to save the PS file to in the printer preset.

set print file of printer preset "X" to "Path:To:PSFile.ps"

I can get it to work with using “printer preset” in the command. It worked either way, with or without.

print document 1 using printer preset "Laser" without print dialog

Thanks Joseph.

I’m still having issues with this though.

tell application "InDesign CS"
	set user interaction level to never interact
	tell document 1
		set print file of (print using "xxxx") to ":Volumes:distiller:In:tester.ps"
	end tell
end tell

For some reason, that doesn’t work for me.

Although, it does make a lot of sense.

Model: Dual 2GHz G5, 1 GB
AppleScript: 2.0
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

I don’t think you can combine the commands in one line like you have it, but I’m not sure. From what I understand of AS, it will try to execute the parenthetical command first then continue on with the rest of the line. So it will first try to 'print using “xxx” then set the print file, which is backwards from how you need it to execute. Try setting the print file of the printer preset in a separate line then try the ‘print using’ line.

Oh, and don’t put it in the ‘tell document 1’ line because printer presets are independent of documents, they are contained by the application object. To be clear: the print line would then be…

print document 1 using "xxx"

Once again, thanks for the help…

I’m getting this error now…

InDesign CS got an error: Can’t set print file to “Volumes:DistillerIHT:In:tester.ps”.

with this script…

tell application "InDesign CS"
	set user interaction level to never interact
	set print file to "Volumes:DistillerIHT:In:tester.ps"
	print document 1 using "IHT - S & P Fund"
	--set print file of (print using "IHT - S & P Fund") to "Volumes:DistillerIHT:In:tester.ps"
end tell

The ‘print file’ object belongs to the ‘printer preset’ object, so you have to change the line to:

set print file of printer preset "IHT - S & P Fund" to "Volumes:DistillerIHT:In:tester.ps"

This is the error I get when I do that…

InDesign CS got an error: File some object wasn’t found.

with this script…

tell application "InDesign CS"
	set print file of printer preset "IHT - S & P Fund" to "Volumes:DistillerIHT:In:tester.ps"
	print
end tell

I think the problem might be with your path. What this path is describing is file “tester.ps” of folder “In” of folder “DistillerIHT” of disk “Volumes”. But you might mean, “DistillerIHT:In:tester.ps”, i.e. file “tester.ps” of folder “In” of disk “DistillerIHT”. I just want to be sure since it should otherwise work.

Run the following script:

tell application "Finder" to exists item "Volumes:DistillerIHT:In:"

If it returns false, then the ID script is failing because the folder to make the PS file in doesn’t exist.

well, volumes is a folder, and a server, when mounter, is simply a folder, either path type should work just fine.

Just so you know, the script you wrote comes out “true” with and without volumes.

this script once, again, doesn’t work…

tell application "InDesign CS"
	set print file of printer preset "IHT - S & P Fund" to "DistillerIHT:In:tester.ps"
	print using "IHT - S & P Fund"
end tell

Does anyone here have experience with this? I have done it very successfully with Quark in the past.
I’m really starting to think that it is a bug or error with the apps.

JOSEPH,

I’m searching around this site for more help, and I’ve come across you’re posting about linescreen issues when printing the .ps file.

Do you think you could send me that script?

Well, it’s a gigantic script with a lot of irrelevant stuff, but here’s the handler that deals with outputting the PS:

on printPS(theFile)
	set docName to ensureDocExists(theFile)
	copy parseJobFileForInfo(theFile) to {lfRange, jobName}
	set psPath to verifyFolderMakeIfNil(containerPath(theFile) & "pdf-ps:", true) as text
	set psPath to psPath & "seps" & lfRange & ".ps"
	set theResult to ""
	tell application "InDesign CS"
		set printSet to printer preset "Output PostScript 100lpi"
		set print file of printSet to psPath
		try
			print document docName using printSet without print dialog
			set theResult to psPath
		on error
			copy "Couldn't print to PostScript" to end of myErrors
			set theResult to "error"
		end try
	end tell
	return theResult
end printPS

One more question: Are you certain printer preset “IHT - S & P Fund” exists?