Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Select All using AppleScript

New Here ,
Aug 14, 2008 Aug 14, 2008
I saw the posting for selecting all objects using JavaScript. How do you do this with AppleScript?
TOPICS
Scripting
8.5K
Translate
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 Expert ,
Aug 14, 2008 Aug 14, 2008
Look in the Illustrator Applescript Reference. See esp. page 100.
Translate
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
Community Beginner ,
Oct 20, 2009 Oct 20, 2009

Since this answer is utterly unhelpful when there are multiple versions of the Illustrator AppleScript Reference Guide, here is the answer for future reference:

set the selection to every page item of current document

Translate
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
New Here ,
Jan 15, 2010 Jan 15, 2010

I don't script in AppleScript, but I noticed a much more efficient method for selecting all objects in the JavaScript language.  It looks like it should work for AppleScript, too.

Basically, set the "has selected artwork" property of each layer to true.

There are usually many fewer layers than objects, so looping through all layers is much quicker than looping through all PathItems.

Not vouching for syntax here, at all; I imagine it will look something like this:

tell application "Adobe Illustrator"

     set has selected artwork of (every layer of document 1) to true
end tell

The more brute force method probably looks something like this:

tell application "Adobe Illustrator"
     set selected of (every page item of current document) to true
end tell

I would be curious to hear whether this works in AppleScript.

Translate
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
Guide ,
Jan 16, 2010 Jan 16, 2010

Both of these work your syntax is fine. The layers method is fractionally quicker but I would consider this to be the more brute force method.

This will move all items even if they are locked!!!

tell application "Adobe Illustrator"

set has selected artwork of (every layer of document 1) to true

translate selection delta x -1000 delta y -1000

end tell

This will fail and error if there are locked page items

tell application "Adobe Illustrator"

set selected of (every page item of current document) to true

translate selection delta x 1000 delta y 1000

end tell

Translate
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
New Here ,
Jan 20, 2010 Jan 20, 2010

Muppet Mark :

I have tried your first script. Works fine but AI returns an error if the layers are locked.

(i am using CS4)

Translate
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
Explorer ,
Mar 01, 2011 Mar 01, 2011

Does anyone have any idea how to select all text frames in a document? I want to be able to copy them to a new document.

Translate
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
Guide ,
Mar 02, 2011 Mar 02, 2011

Do you need to do this with script? If selecting just the 'Text Fames' is all you need to do then this can be done in the GUI? If you need script to do this and other stuff to then post which scripting language you want to do it in… (it helps)…

Translate
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
Explorer ,
Mar 02, 2011 Mar 02, 2011
LATEST

Thanks for the lead guys. I worked on GUI scripting and came up with this

tell application "Adobe Illustrator"
     activate
end tell

tell application "System Events"
     tell process "Adobe Illustrator"
          tell menu bar 1
               tell menu bar item "Select"
                    tell menu "Select"
                         tell menu item "Object"
                              tell menu "Object"
                                   click menu item "Text Objects"
                              end tell
                         end tell
                    end tell
               end tell
          end tell
     end tell
     
end tell

I noticed that Events and Replies in the AS Editor wrote it differently:

tell application "Adobe Illustrator"
     activate
end tell

tell application "System Events"
     click menu item "Text Objects" of menu "Object" of menu item "Object" of menu "Select" of menu bar item "Select" of menu bar 1 of process "Adobe Illustrator"
end tell

Translate
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
New Here ,
Mar 02, 2011 Mar 02, 2011

A bit of GUI scripting may be the answer here.

tell application "Adobe Illustrator"

activate

end tell

tell application "System Events"

tell process "Adobe Illustrator"

tell menu bar 1

tell menu bar item "Select"

tell menu "Select"

click menu item "All"

end tell

end tell

end tell

end tell

end tell

Translate
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