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

Iterate shapes and convert them to Compound Shapes

Community Beginner ,
Nov 21, 2014 Nov 21, 2014

In order to keep shapes as shape layers in Photoshop when exporting from .ai to .psd, one has to convert all shapes to Compound Shapes.
At the moment, i'm using an action that converts the shape, then selects the shape above. Starting with the bottom shape, i have to click

the action for every shape.

Is there a way to make a script cycle through all shapes and groups, converting them to Compound Shapes?

At the end of the script, it would be nice to have it make an export of the file to .psd aswell.

I'm somewhat familiar to javascript, but i would really appreciate some guidelines in creating this.

TOPICS
Scripting
1.7K
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
Valorous Hero ,
Nov 24, 2014 Nov 24, 2014

Are you using CC, or at least CS6?  Are the items you need to be thus converted just top-level items in a top-level layer?  Because that can be done!  Otherwise, it can also be done with more work..

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 ,
Nov 25, 2014 Nov 25, 2014

I'm on CS5. I don't fully understand what you are suggesting i'm sorry. I need all shapes in all layers to be converted.
I've come up with a script that converts all shapes to compound shapes, but they need to be converted via the options

in the Pathfinder panel. Otherwise Photoshop won't make them into shape layers. I don't know why this is.

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
Valorous Hero ,
Nov 25, 2014 Nov 25, 2014

Okay, CS5.. are you on PC or Mac now?

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 ,
Nov 25, 2014 Nov 25, 2014

Windows 7 64bit.

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
Valorous Hero ,
Nov 25, 2014 Nov 25, 2014

Ok, do you use AutoHotKey already?  The solution I am thinking of, involves using AHK scripts to trigger the action which makes the compound shape.

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 ,
Nov 25, 2014 Nov 25, 2014

Yes i do use AHK for some minor stuff. I've never done any big complex scripts.
Do you have any ideas how i should build it?
The only thing i can come up with is to map the action to an F-key. Then make the

AHK perform som click-actions when i press the F-key. But how will AHK know when there

is'nt any more shapes to convert?
As i said, i'm not anywhere near a true AHK-haxXer

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
Valorous Hero ,
Nov 25, 2014 Nov 25, 2014

It okay is, because this will be great learning for our minds!  There is a way, to have your Extendscript execute the AHK script which tells it to "send" the F-keys as if it came from your keyboard.  The action will go, but I am not very clear on how out of synch the action will be with the script.  At first thought , putting $.sleep() may do the trick, especially if your action does not take long & there's not a big chance of it having to take long.  Well, anywho, after the time break, it will go do its script thing, which is select the next shape or group (pageItem).  And at the end, hey, you can try tacking on the PSD saving using the export with ExportOptionsPhotoshop- but that's later!  imagecollection has some examples here of executing an AHK script from the jsx script, check 'em out!

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 ,
Nov 25, 2014 Nov 25, 2014

Thanks for the support!
I can't find any posts on the subject over at imagecollections profile, could you be more precise?

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
Valorous Hero ,
Nov 25, 2014 Nov 25, 2014

I am going to try and put a snippet together of the example proposed above, but it's all new to me

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 ,
Nov 25, 2014 Nov 25, 2014

I'll chime in.

first to get a handle on what your doing.

by shape do you mean pathItem.

can you show or explain what your action does step by step?

it sound like you just want a script to loop through all items converting each one to a compound Path.

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
Valorous Hero ,
Nov 25, 2014 Nov 25, 2014

The Compound Shape is different from Compound Path, especially to us because it is a "PluginItem" according to the DOM.  A plugin item is like a mystery box!  Also, any fancy CS6+ commands to run actions aren't an option because CS5. 

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 ,
Nov 25, 2014 Nov 25, 2014

create a shortcut for the action.

go to the last step in the action(Select next object above)

hit record, then press shortcut for the action.

stop recording.

So now the action calls itself.

select the bottom item on the page.

run action.

it will loop through all items then finish by getting stuck in a loop.

so you do need to press stop.

Quicker then running it over and over manually.

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 ,
Nov 25, 2014 Nov 25, 2014

Actually i tried that, but it's not possible for an action to record a playback of itself.

I did managage to get it working though combining two actions.
It is working, but i don't like the fact that i have to manually stop it.

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 ,
Nov 26, 2014 Nov 26, 2014
LATEST

I Got it to work by assigning shift+F11 to the action then while recording pressed that short cut.

its not ideal at all bit much quicker then pressing shift+F12 over and over.

if you had a later version that allowed actions run from javascript it would be cleaner.

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