Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Script to copy artboard bounds to clipboard.

Participant ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Hi, I wondered if anybody has a script that can copy just what is contained inside the bounds of your current artboard to the Windows clipboard? Thanks

TOPICS
Import and export, Scripting

Views

280

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

... to do what afterwards?

Please explain this in more detail.

 

At the moment I think:

 

select all in active artboard
and
copy

 

should be sufficient enough.

 

 

Or not?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Hi, thanks for the reply. I want it to be cropped at the bounds of the artboard. I also want it loaded to the clipboard as a jpeg. As for ... to do what afterwards? I want to use the clipboard in another program?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Salut!

Si j'ai bien compris...

// JavaScript Document for Illustrator
var doc = app.activeDocument;
    with(doc) {
      selectObjectsOnActiveArtboard();
      fitArtboardToSelectedArt( artboards.getActiveArtboardIndex() );
    }
    app.copy();

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Hi, thanks so much for trying. I do not want to move the artboard to encase the art. I want to use the Artboard as a crop for what Is shown. What you wrote moves the artboard to the art. If a piece of art is outside of the artboard I want it cropped (not included) in what is copied as a jpeg.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

2021-01-28_19h07_13.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Would this help you? It saves artboard 0 to a png file to your computer.

 

Save_PNG('local file path here/', 'test2.png'); 
function Save_PNG(SaveLocal, fileName) {
    var aDoc = app.activeDocument;
    var MyOpt = new ImageCaptureOptions;
    var myBounds = aDoc.artboards[0];
    myBounds.fillColor = aDoc.swatches[0].color;
    MyOpt.antiAliasing = true;
    MyOpt.matte = false;
    MyOpt.resolution = 300; // screen PPI  
    MyOpt.transparency = false;
    var Filename = new File(SaveLocal + fileName);
    aDoc.imageCapture(Filename, myBounds.visibleBounds, MyOpt);
}

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

I already have a good script that does that. I find it too much trouble to go and retrieve the file every time. I want art that I shift around on a page to be quickly copied. I also want to be cropped by the artboard. Thank you for the additional script anyway, and thanks for the reply 🙂

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Salut!

Peut-être maintenant ?

// JavaScript Document for Illustrator
// Masque copy.js
// Landry R Fri, 29 January 2021 14:29:26 GMT
  var doc = app.activeDocument;
  var idx  = doc.artboards.getActiveArtboardIndex();
  var ab  = doc.artboards[idx];
  var rect = ab.artboardRect;
  var newGroup = doc.groupItems.add();
    doc.selectObjectsOnActiveArtboard();
    sel = selection;
    doc.selection == null;
      for (var k = 1; k < sel.length; k++) {
       sel[k].move(newGroup,ElementPlacement.PLACEATEND);
      }
  var path0 = newGroup.pathItems.rectangle(rect[1],rect[0],rect[2]-rect[0],rect[1]-rect[3]);
      newGroup.clipped = true;
      newGroup.selected = true;
      app.copy();
      app.executeMenuCommand("undo");

Cordialement René

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Thank you so much for your effort in helping me. I am enjoying seeing what the code can do. However, this is still not what I want. The last script you provide centers the art in a new rectangle. The new rectangle cuts the artwork into the center. I just want the artboard to crop out the artwork sometimes the artwork will be full and there will be no whitespace. But if there is whitespace I only need it to just like the Artboard. Thanks

2021-01-29_11h09_08.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Another thing is I do not need it to crop the artwork in the illustrator file. I want everything in the Illustrator file to stay the same. I just want the copied crop of the Artboard area. All overlapping art should stay the same. Thanks

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Salut!

J'ai utilisé un masque d'écrêtage, mais on conserve ce qui est à l'extérieure du masque, ce qui explique le décalage.
Je ne vois pas par script comment faire le découpage exact, sauf par l'export.

Cependant, en faisant la manipulation suivante on évite l'enregistrement;
Enregistrer pour le web puis cliquer sur le bouton aperçu (web)
Faire un clic droit sur l'image et choisir copier
Puis Terminer
Coller dans l'autre application.

René

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 16, 2021 Feb 16, 2021

Copy link to clipboard

Copied

LATEST

I understand totally, what you mean. However, I do not want it to work this way. I have already made some scripts that move the exported artboard into my clipboard, but it is still too many steps. I want to quickly position art inside an Artboard and copy it with the Artboard bounds clipping what is outside. I will keep looking. I will also try to advance my knowledge of Illustrator scripting. I know this can be done. Thanks for all the help

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines