10 Replies Latest reply on Mar 4, 2009 7:23 AM by CTC Imaging

    [JS][CS3] Print DIalog Box with ESCAPE

    CTC Imaging Level 1
      I am using document.print(true) in my script.

      Is there a way to catch if the user pressed "CANCEL"? So I can keep track of how many prints were "skipped"
      Thank you, Alex.
        • 1. Re: [JS][CS3] Print DIalog Box with ESCAPE
          [Jongware] Most Valuable Participant
          Unfortunately,
          i print
          has a prototype

          >void print ([printDialog:bool][, using:any])

          where the 'void' indicates it does not return a value.

          I wonder if this can be wrapped by the CS4 Event object. That has properties 'cancelable' (if true, cancelling is allowed) and 'defaultPrevented' (if true, default behavior has been cancelled). Idle rambling, because 1. I have no idea at all how to work with Events, 2. most likely, ID does not 'update' the current Print dialog to

          >[..] keep track of how many prints were "skipped"

          (i.e., you still won't know where it was), and 3. I don't even know if you have CS4, or an older version.
          • 2. Re: [JS][CS3] Print DIalog Box with ESCAPE
            CTC Imaging Level 1
            I have CS3, topic [JS][CS3].
            I am looping through documents being batched. So each time the print dialogue would return "null" for a cancel, I would know that document was skipped.
            Unfortunately, like you said print has no return value.

            Would there be a way to test the last keystroke?
            • 3. Re: [JS][CS3] Print DIalog Box with ESCAPE
              Kasyan Servetsky Level 5
              Rorohiko's APID has docPrinted event (sent after the document was printed).
              • 4. Re: [JS][CS3] Print DIalog Box with ESCAPE
                CTC Imaging Level 1
                Nothing on the InDesign side?
                Otherwise it would mean another purchase/plug-in but most annoyingly an install. We're on tight "security" restriction here...
                • 5. Re: [JS][CS3] Print DIalog Box with ESCAPE
                  Kasyan Servetsky Level 5
                  It's indispensable tool for everybody who is serious about scripting.
                  • 6. Re: [JS][CS3] Print DIalog Box with ESCAPE
                    Harbs. Level 6
                    Kasyan_Servetsky@adobeforums.com wrote:
                    > It's indispensable tool for everybody who is serious about scripting.
                    >

                    I second that!

                    --
                    Harbs
                    http://www.in-tools.com
                    • 7. Re: [JS][CS3] Print DIalog Box with ESCAPE
                      CTC Imaging Level 1
                      I went on the website looking for "DocPrinted" but did not find an API plug-in related to printing. I've sent an email to their support with the same question. No response yet.
                      • 8. Re: [JS][CS3] Print DIalog Box with ESCAPE
                        Kasyan Servetsky Level 5
                        Alexandre,

                        I was referencing to the Active Page Item Developer plug-in. You can read detailed information about it and download demo version here: http://www.rorohiko.com/wordpress/indesign-downloads/active-page-item-developer/

                        Kasyan
                        • 9. Re: [JS][CS3] Print DIalog Box with ESCAPE
                          Harbs. Level 6
                          Just a quick illustration of how useful APID is:

                          My wife still uses CS2 at work. We have a Riso digital duplicator which
                          we use for printing booklets, invitations, etc. When printing from
                          InDesign to the Riso machine, color management must be off or the blacks
                          get printed as dark gray (about 95% line screen). Well, I tried to help
                          out by printing a booklet, and like usual, I messed up and forgot to
                          turn off color management. (I'm really good at messing things up!) ;)

                          I decided to put an end to this problem, and create a solution which
                          would always cause InDesign to send to this printer (only) with color
                          management turned off. It took me a total of maybe 15 minutes...


                          // DontManageColorForRiso.jsx
                          // This script should be in the same folder as the document
                          DontManageColorForRisoSourceCS4.indd
                          // It is automatically called by the DontManageColorForRisoController
                          page item.
                          //events: docPrintConfigured,docPrinted
                          // Header - matches anonymous function trailer at bottom
                          (function(thePlugin)
                          {
                          main();
                          function main(){
                          var theEventCode = thePlugin.eventCode;
                          var doc = GetDocFromPageItem(thePlugin);
                          switch(theEventCode){
                          case "docPrintConfigured":TurnOffColorManagement(doc);break;
                          case
                          "docPrinted":app.colorSettings.enableColorManagement=true;break;
                          }
                          }
                          function TurnOffColorManagement(doc){
                          var printer = doc.printPreferences.printer;
                          if(printer.constructor.name!="String"){return}
                          printer=printer.toLowerCase();
                          if(printer.match(/riso/)){
                          app.colorSettings.enableColorManagement=false;
                          }
                          }
                          function GetDocFromPageItem (pageItem){
                          var guid = app.callExtension(0x90B6C,10014,pageItem);
                          return app.callExtension(0x90B6C,10009,guid);
                          }
                          // Trailer - matches anonymous function header at top
                          }
                          )(theItem);

                          --
                          Harbs
                          http://www.in-tools.com
                          • 10. Re: [JS][CS3] Print DIalog Box with ESCAPE
                            CTC Imaging Level 1
                            Marveleous tools. I would not be able to do that fix in 15 min!

                            The event handler sounds a lot like InEventScript plug in.
                            The later has not been transported to CS3 since CS3 handles events.

                            But it seems API is a little more thorough in its functions!

                            One downfall is I have to struggle w/ limited user privilege and installing anything is restricted. If in their good graces I fall...