Print Without Dialog Photoshop CS4 - Applescript

I have a script working perfectly with one exception… The printing dialog… I can’t figure out how to print without it showing up. This is the work flow:

  • Initialize script variables

  • Get information from FileMaker Pro 10 Database.

  • Change layers in Photoshop file with FMP10 Information.

  • Print (I can do this but I must push the ‘Print’ button in the Print dialog box every pass)

  • Go back to the FMP10 Database and repeat until all items are processed.

On the print phase i want to select print settings the first time through the process and then have it use those settings for every following pass until all items are processed. I can handle this if i can figure out how to get it to print with out dialog. I have searched the forums and tried to several things suggested but have not been able to get any of them to work. It seems that once the print widow comes up that the script stops and waits for user input (Press Print). I could not get the System Keystroke commands to work or Print Without Dialog commands that were posted in other threads.

If somebody could tell me how to modify this simple command to print with out dialog i would be grateful.

			tell application "Adobe Photoshop CS4"
				print document "Temp.psd"
			end tell

Ok i got the automated print working… I forgot that with the the - keystroke “p” using {command down} - photoshop needed two returns to print and enough time to print to the queue.

Now that i have fix that part i need to find a way to bring up the same print menu that - keystroke “p” using {command down} - brings up but then i need the script to stop while i select all the settings for the first print loop then to resume and print that first document before looping again. Anyone have any ideas as how to do this?

			if FirstPassCheck = 1 then
				-- Need a command to access the print set up page and stop the script until i am done
				set FirstPassCheck to 0
				
			else
				
				tell application "System Events"
					keystroke "p" using {command down}
					-- delay 1
					keystroke return
					-- delay 1
					keystroke return
					delay 5
				end tell
				
			end if

Model: MAC Pro
AppleScript: Version 2.2.1 (100.1)
Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)

Don’t have CS4 and I actually haven’t printed right out of PhotoShop with CS3, so I can only offer general advice.

Have you looked up the print command in PhotoShop’s scripting dictionary. In CS3 I don’t see any “without dialog” or anything like that but maybe there is an option in CS4. You could try supplying all of the parameters that are available to see if that fixes it. In CS3 they all say there are defaults but maybe you need to specify one specifically so it doesn’t “think” it needs to ask you for that info.

in CS3:

print‚v : print the specified object(s)

print any : the file(s) or document(s) to be printed

[postscript encoding ASCII/binary/JPEG] : encoding type ( default: binary )
[source space document space/proof space] : color space for source ( default: document space )
[print space text] : color space for printer. Can be nothing (meaning same as source); ‘Working RGB’, ‘Working CMYK’, ‘Working Gray’, ‘Lab Color’ (meaning one of the working spaces or Lab color); or a string specifying a specific colorspace (default is same as source)
[intent absolute colorimetric/perceptual/relative colorimetric/saturation intent] : if the print space is different from the source space, this argument will be used as the color conversion intent ( default: relative colorimetric )
[blackpoint compensation boolean] : if the print space is different from the source space, this argument indicates if the color conversion should use black point compensation ( default: true )

Model: iMac Intel 10.5.5
Browser: Firefox 3.0.2
Operating System: Mac OS X (10.5)

I worked out how to get it to print with out me having to click print for every pass in the else part of the if statement.

It is the first part of the if statement i am trying to idiot proof (For myself) so that on the first pass i can select all the information to be how i want it. I can put a huge delay to give me time to do that but if i get distracted or interrupted and don’t finish processing the first print command before the delay expires it will cause problems. My thought would be for the script to (and i don’t know how to do this) create a window that has a button to click after i print the first document then continue running the script.

Photoshop CS4 can “print the document” with the print command and it will hold on the print screen until i complete the button pressing process. This does not however give me the first print setup window i get when selecting print from PS CS4. I need access to both those print screens because the documents are either 8.5x11 or 13x19 and i need to setup the paper size and other settings in the first window.

          if FirstPassCheck = 1 then

               tell application "System Events"
                   keystroke "p" using {command down}
              ------------------------------------------------------------------------------------------------------------------------------------------------
              ---- I need something right here to pause the script while i process the first print process.
             ------------------------------------------------------------------------------------------------------------------------------------------------
               end tell


               set FirstPassCheck to 0
               
           else
              ------------------------------------------------------------------------------------------------------------------------------------------------
              ---- This is working and prints with out me having to interact and i don't really care if the print screen comes up each time
             ------------------------------------------------------------------------------------------------------------------------------------------------
  
               tell application "System Events"
                   keystroke "p" using {command down}
                   -- brings up the photoshop print options

                   keystroke return
                   -- continues past the photoshop print setup

                   keystroke return
                   -- tells the print screen to print the document

                   delay 5
                   -- gives the computer time to load the printer before running the loop again.

               end tell
               
           end if

When you are in photoshop you can print without any dialog boxes by pressing “cammand” “option” “shift” and “p”.
It print the actual document using the last print settings used for THIS document.

So for one of my script i used this command:


tell application "System Events"
	keystroke "p" using {command down, option down, shift down}
end tell