4 Replies Latest reply on Nov 6, 2013 6:48 AM by DanielHassler

    Is there a script to create a button to set an activated frame to document size + bleed?

    DanielHassler

      Please see my question above. Thanks in advance!

        • 1. Re: Is there a script to create a button to set an activated frame to document size + bleed?
          [Jongware] Most Valuable Participant

          Here is a script that creates a script that creates a button that sets an activated frame to document size + bleed.

          Why do you need a script to create a button that sets an activated frame to document size + bleed? You might as well have a script that sets an activated frame to document size + bleed, because you already need to double-click the script that sets an activated frame to document size + bleed and so there is no need to show another button that you can click to set an activated frame to document size + bleed in that.

           

          theScript = 'var w = new Window("dialog", "Reframe");\n'+
          'w.b = w.add("button", undefined, "Click me!");\n'+
          'w.b.onClick = function(){ w.close(3); };\n'+
          'if (w.show() == 3)\n'+
          '{\n'+
          'dp = app.activeDocument.documentPreferences;\n'+
          'app.selection[0].geometricBounds = [\n'+
          'app.layoutWindows[0].activePage.bounds[0]-dp.documentBleedTopOffset,\n'+
          'app.layoutWindows[0].activePage.bounds[1]-dp.documentBleedBottomOffset,\n'+
          'app.layoutWindows[0].activePage.bounds[2]+dp.documentBleedInsideOrLeftOffset,\n'+
          'app.layoutWindows[0].activePage.bounds[3]+dp.documentBleedOutsideOrRightOffset];\n'+
          '}';
          writeFile = new File (app.activeScript.parent+'/new script.jsx');
          writeFile = writeFile.saveDlg( 'Save script', File.fs == "Windows" ? "Script:*.jsx,All files:*.*" : function(file) { return file instanceof Folder || (!(file.hidden) && file.name.match(/\.jsx$/i)); } );
          if (writeFile != null && writeFile.open("w"))
          {
            writeFile.encoding = "utf8";
            writeFile.write (theScript);
            writeFile.close();
          }
          
          • 2. Re: Is there a script to create a button to set an activated frame to document size + bleed?
            DanielHassler Level 1

            Hi Jongware,

             

            thanks for your help, this is what i was looking for! Sorry for my weird description with the button, i dont have any experience with scripting in ID.

            As you already said, the button is unnecessary. Nevertheless, your script works fine for me, but how can i now drop the button, so i just have to

            click the script?

             

            You are awesome, thank you so much!

            • 3. Re: Is there a script to create a button to set an activated frame to document size + bleed?
              [Jongware] Most Valuable Participant

              Yeah, that's what I figured This is the bare essentialness of what it does:

               

              dp = app.activeDocument.documentPreferences;
              app.selection[0].geometricBounds = [
              app.layoutWindows[0].activePage.bounds[0]-dp.documentBleedTopOffset,
              app.layoutWindows[0].activePage.bounds[1]-dp.documentBleedBottomOffset,
              app.layoutWindows[0].activePage.bounds[2]+dp.documentBleedInsideOrLeftOffset,
              app.layoutWindows[0].activePage.bounds[3]+dp.documentBleedOutsideOrRightOffset];
              
              • 4. Re: Is there a script to create a button to set an activated frame to document size + bleed?
                DanielHassler Level 1

                Awesome! For you, these are just simple commands, for me this will save me a lot of tiime every month! KCCO!