Skip to main content
StrongBeaver
Legend
February 28, 2014
Question

Make a Marquee Selection

  • February 28, 2014
  • 3 replies
  • 767 views

I want the variable ArtSet to "selectAll", which would simple just be selecting the entire canvas a rectangular marquee.  What am I doing wrong ?

app.documents.add(600,200)

var layerRef = app.activeDocument.artLayers.add()

layerRef.name  = "mylayer"

layerRef.blendMode = BlendMode.OVERLAY

var artset = activeDocument.artLayers.add()

artset.name = "goat"

artset.blendMode = BlendMode.SCREEN

// I want the variable artset to be selected or selected all that is not happening ?

artset.activeDocument.selection.selectAll

This topic has been closed for replies.

3 replies

February 28, 2014

Please try:

artSet.parent.selection.selectAll ()

StrongBeaver
Legend
March 2, 2014

It worked.  Too much calling the app.document repeatedly. 

What if I placed the 'artset' in a function, and I call the function later in the script, could I still use the .parent properties or no because it's no longer the parent ?

Chuck Uebele
Community Expert
Community Expert
February 28, 2014

Most people use "docRef" to refer to app.activeDocument, rather than writing that out all the time.  So to select all, you would really only need:

var docRef = activeDocument;

docRef.selection.selectAll();

StrongBeaver
Legend
February 28, 2014

The scripting guides says you can exclude app.document, in this case the word app.  Up to this point I haven't dropped the app word when I code.

c.pfaffenbichler
Community Expert
Community Expert
March 1, 2014

But do you understand why

artset.activeDocument

is nonsensical?

c.pfaffenbichler
Community Expert
Community Expert
February 28, 2014

An active selection is a property of the file, not of a Layer. 

»activeDocument« is no property of Layer, either, so

artset.activeDocument.selection.selectAll

makes no sense.

And even if you remove »artset.« you still miss the brackets.

If you bothered to consult ESTK’s Object Model Viewer you could verify which Properties and Methods exist for an Object (see screenshot for an example for »Layer«).