3 Replies Latest reply on Jul 27, 2013 6:12 PM by Dizz Hicks

    Export current page to JGB with no confirmation?

    Dizz Hicks

      Hello,

       

      I'd like a script to export just the current page as a JPG to my desktop, with specific spec, without confirmation, with an automated filename (filename+date+time+".jpg").

       

      I've found one or two that export all pages, or have other needs, but nothing like this.

       

      My remote bosses like to see quick shots of pages I'm working on, but as they print a lot of them I'd like higher resolution than screen shots, which is how I'm doing it now. I can go the normal File>Export route, but that's too painful for the frequency and speed I need to fire these out. I just want to hit a keystroke which fires the script which results in a JPG on the desktop for me to jam into iChat.

       

      It would be too much to ask to have a keyline around the page, I suppose? Do dreams come true?

       

      I'm on CS5.5.

       

      Thank you for any help!

        • 1. Re: Export current page to JGB with no confirmation?
          Peter Kahrel Adobe Community Professional & MVP

          If you're willing to pay, all dreams come true!

           

          Peter

          • 2. Re: Export current page to JGB with no confirmation?
            Kasyan Servetsky Level 5

            Adjust "Export JPEG" options according to your needs (see comments).

             

            /* Copyright 2013, Kasyan Servetsky
            July 27, 2013
            Written by Kasyan Servetsky
            http://www.kasyan.ho.com.ua
            e-mail: askoldich@yahoo.com */
            //======================================================================================
            var scriptName = "Export current page to JPG - 1.0";
            
            Main();
            
            //===================================== FUNCTIONS  ======================================
            function Main() {
                if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);
                var doc = app.activeDocument;
            
                if (app.activeWindow.constructor.name != "LayoutWindow") ErrorExit("Unable to get page number. Quit story editor.", true);
            
                var page = app.activeWindow.activePage;
            
                with (app.jpegExportPreferences) {
                    exportingSpread = false;
                    jpegExportRange = ExportRangeOrAllPages.EXPORT_RANGE;
                    pageString = page.name;
                    exportResolution = 300; // The export resolution expressed as a real number instead of an integer. (Range: 1.0 to 2400.0)
                    antiAlias = true; //  If true, use anti-aliasing for text and vectors during export
                    embedColorProfile = false; // True to embed the color profile, false otherwise
                    jpegColorSpace = JpegColorSpaceEnum.RGB; // One of RGB, CMYK or GRAY
                    jpegQuality = JPEGOptionsQuality.HIGH; // The compression quality: LOW / MEDIUM / HIGH / MAXIMUM
                    jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING; // The rendering style: BASELINE_ENCODING or PROGRESSIVE_ENCODING
                    simulateOverprint = false; // If true, simulates the effects of overprinting spot and process colors in the same way they would occur when printing
                    useDocumentBleeds = false; // If true, uses the document's bleed settings in the exported JPEG.
                }
            
                var fileName = doc.name.replace(/\.indd$/, "") + "_" + GetDate() + ".jpg";
                var file = new File("~/Desktop/" + fileName);
            
                doc.exportFile(ExportFormat.JPG, file);
            }
            //--------------------------------------------------------------------------------------------------------------------------------------------------------
            function GetDate() {
                var date = new Date();
                if ((date.getYear() - 100) < 10) {
                    var year = "0" + new String((date.getYear() - 100));
                }
                else {
                    var year = new String((date.getYear() - 100));
                }
                var dateString = (date.getMonth() + 1) + "-" + date.getDate() + "-" + year + "_" + date.getHours() + "-" + date.getMinutes() + "-" + date.getSeconds();
                return dateString;
            }
            //--------------------------------------------------------------------------------------------------------------------------------------------------------
            function ErrorExit(error, icon) {
                alert(error, scriptName, icon);
                exit();
            }
            //--------------------------------------------------------------------------------------------------------------------------------------------------------
            
            • 3. Re: Export current page to JGB with no confirmation?
              Dizz Hicks Level 1

              Kasyan: that's perfect. Thank you.

               

              Peter: if I was paid for all the design/software help I've given to people over 20 years, I'd be, well, less in debt than I am now. We all help each other and I'm very grateful… ach, I feel like singing something hippyish.

               

              By the way, "JGB"? How did I type that and not notice it? I'll blame the Friday evening beer.