View Full Version : Manipulating objects inside a "SMARTOBJECT" ?


eliran84
11-08-2007, 05:43 PM
for(var i=0;i<docRef.artLayers.length;i++) { if(docRef.artLayers[i].kind==LayerKind.SMARTOBJECT) { // how do I access this smart object's layers? } }

Hello!
I have a PSD doc I have fully created with Photoshop CS3 Extended (Middle Eastern).
With a script (or you can suggest another way) - I want to be able to hide all the text layers ("LayerKind.TEXT") in that doc, but most of them are inside smart objects that I have created in order to keep everything clean.
Anyway, the code above detects all the smart objects, but how do I access the objects inside those (e.g 'sub-objects') ?

And If I'm asking already, maybe anyone knows how do I change the align of a text layer in a doc?

The scripting manuals *didn't* offer any keyword/solution :(
This is pretty disappointing to see such a GREAT program lacking such "simple" scripting-keywords/commands.

Will be extremly happy if someone here knows the answer(s) ! (:

Swampy
11-08-2007, 07:36 PM
Eliran, you can edit smart objects by double clicking on the little icon that gets added to them in the bottom right corner of the thumbnail. Do your edit then save and changes will be applied.

I don't know why you are doing your Text layers as smart objects. You say to keep them "clean" but text is treated as a vector and always keeps their sharp smoot edges until or unless you rasterize them.

I can't help you much with your scripting action.

eliran84
11-10-2007, 04:35 AM
My friend, first of all thanks for caring about my posts.
Let me make it clear:
Instead of using layer groups, I used SmartObjects (what a mistake when I think about it).
It's a website design project. Anyway I groupped, in those smart objects, for example, the menu block of the page which includes the menu's graphics and also some "sample" menu text -> as regular text layers.
I know how to edit a smartobject with Photoshop's user interface, but don't know how to do this inside a script (I use JavaScript by the way..).
When I "export" the PSD file to Fireworks in order to slice & export to HTML, I need to get rid of a few text layer. Why? Because let's say I want some picture, who has text on it, to be shown on the web but I want the text as an HTML text. So I need to hide the text layer in the PSD.
.. Try to "flow-read" what I wrote, I hope it's clear :)

Markzebra
11-10-2007, 06:57 PM
Hi eliran84 - I think Scripting may be a little way beyond this forum, try here instead (http://www.adobeforums.com/webx?13@@.ef7f2c5)

I think you may have created a problem for yourself by choosing to use Smart Objects for this. Its very easy to organise your files very well using layer sets, and you can even embed layer sets, scripting is also not quite as powerful in Photoshop as some people would like. But maybe you will still find a solution in the forum I've linked to above. Good luck

eliran84
11-11-2007, 07:28 AM
Yep, the scripting capabilities in Photoshop is weak. It's ok though, because I learned a good lesson now:
Be smart - Don't use SmartObjects :)
(should become a slogan)

Thanks for trying to help me anyway, I appriciate this!