6 Replies Latest reply on May 18, 2011 10:00 AM by SuperMacGuy

    [AS CS5] OSX Scripting print PS file deletes system printers?

    SuperMacGuy Level 2

      Since we've migrated to OSX 10.6, there have been A LOT (as in 100s) of my artists who, after running a script that has ID print and Distill a PS file, often lose all their printers (from the System Pref's printer setup). The script does not at all deal with any print settings at the OS level. It does tell ID to use a printer preset to PostScript the document to their desktop, then have Distill process it, then that PDF is uploaded (via shell: curl) to a server for posting online.

       

      I can't remember this ever happening in 10.5, it seems really to affect 10.6 recently. Does anyone else experience something like this? This exact same script was used without modification in 10.5, and for a while in 10.6. I've recently rebuilt the app using the new Applescript Objective C, but the core of the script is very similar. My IT dept is fixing computers all the time with missing printers, but I can't fathom how the script is involved with it.

       

      Any leads in any direction are appreciated.

        • 1. Re: [AS CS5] OSX Scripting print PS file deletes system printers?
          Harbs. Level 6

          I haven't really wrapped my head around the differences in the printing system in 10.6, but there are a lot...

           

          No idea where to go with this...

           

          Good luck!

           

          Harbs

          • 2. Re: [AS CS5] OSX Scripting print PS file deletes system printers?
            John Hawkinson Level 5

            Can you post the operative excerpt from the script?

            • 3. Re: [AS CS5] OSX Scripting print PS file deletes system printers?
              SuperMacGuy Level 2

              Here's the core of the printing part here. The entire script is about 600 lines.

               

               

               

              my toggleDocForOutput_(true)

                            

                             set lowResProof to (theDesktop & pdfName & ".pdf") as string

                             set highResProof to (theDesktop & pdfName & "-PRINT.pdf") as string

                            

                             --THIS BLOCK ONLY FOR PS-PDF DISTILLING

                             textStatus's setStringValue_("Printing Postscript File")

                             set my progressBarValue to 25

                             outputSheetWindow's displayIfNeeded()

                            

                             set thePSFileString to (theDesktop & pdfName & ".ps")

                             tell application "Adobe InDesign CS5"

                                  tell document 1

                                       tell print preferences

                                            set active printer preset to "Clipper Proof Print"

                                            set printer to postscript file

                                       end tell

                                       tell print preferences

                                            set print spreads to exportSpreads

                                            set print file to thePSFileString

                                       end tell

                                       with timeout of 420 seconds

                                            print without print dialog

                                       end timeout

                                  end tell

                             end tell

                             if loggingState then tell me to log ("postscript file made= " & thePSFileString)

                            

                             textStatus's setStringValue_("Distilling Low Res PDF")

                             set my progressBarValue to 50

                             outputSheetWindow's displayIfNeeded()

                            

                             my distillFile_outputPath_jobOptions_(thePSFileString, lowResProof, theClipperLowJOF)

                            

                             textStatus's setStringValue_("Distilling High Res PDF")

                             set my progressBarValue to 75

                             outputSheetWindow's displayIfNeeded()

                            

                             my distillFile_outputPath_jobOptions_(thePSFileString, highResProof, theClipperPrintJOF)

                             --END OF POSTSCRIPT BLOCK

               

              • 4. Re: [AS CS5] OSX Scripting print PS file deletes system printers?
                John Hawkinson Level 5

                I don't have any good ideas.

                I would try to figure out how to read the list of system printers and see where and how it is going awry.

                 

                At a glance, it looks like they are stored in /Library/Preferences/org.cups.printers.plist but maybe you're supposed to run "defaults read com.apple.print.PrinterProxy" or mess with CUPS on a deeper level.

                 

                Are your users administrators? Perhaps you should have your printers configured such that users can't mess with them even if they were trying.

                 

                I suppose I would probably try to see how the printer list is getting corrupted (are they being just plain removed, or is it more subtle?) and then check for that all throughout the script to see where it happens.

                 

                Sorry this is handwavy and ~useless.

                • 5. Re: [AS CS5] OSX Scripting print PS file deletes system printers?
                  Muppet Mark-QAl63s Level 4

                  I don't have this version of the OS so things could well have changed but this may be worth a try…

                   

                  log (do shell script "lpstat -s")

                   

                  Place in several places throughout your script and see if it changes some where along the line…

                  • 6. Re: [AS CS5] OSX Scripting print PS file deletes system printers?
                    SuperMacGuy Level 2

                    Thanks guys, decent suggestions. I feel like there may be an issue between my app and the problem, but it'll be really inscrutable, and perhaps not even related to anything I'd ever think would affect it.