Go Back   RetouchPRO > Tools > Software > Photoshop Scripting
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read

Photoshop Scripting Learning and sharing for all platforms

Manipulating objects inside a "SMARTOBJECT" ?

Thread Tools
Old 11-08-2007, 05:43 PM
eliran84 eliran84 is offline
Junior Member
Join Date: Nov 2007
Posts: 3
Manipulating objects inside a "SMARTOBJECT" ?

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? } }

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) ! (:
Reply With Quote top
Old 11-08-2007, 07:36 PM
Swampy's Avatar
Swampy Swampy is offline
Senior Member
Join Date: Feb 2005
Location: The Swamps of Florida
Posts: 4,418
Re: Manipulating objects inside a "SMARTOBJECT" ?

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.
Reply With Quote top
Old 11-10-2007, 04:35 AM
eliran84 eliran84 is offline
Junior Member
Join Date: Nov 2007
Posts: 3
Cool Re: Manipulating objects inside a "SMARTOBJECT" ?

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
Reply With Quote top
Old 11-10-2007, 06:57 PM
Markzebra's Avatar
Markzebra Markzebra is offline
Senior Member
Join Date: Aug 2001
Location: London, UK
Posts: 718
Re: Manipulating objects inside a "SMARTOBJECT" ?

Hi eliran84 - I think Scripting may be a little way beyond this forum, try here instead

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
Reply With Quote top
Old 11-11-2007, 07:28 AM
eliran84 eliran84 is offline
Junior Member
Join Date: Nov 2007
Posts: 3
Re: Manipulating objects inside a "SMARTOBJECT" ?

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!
Reply With Quote top
Old 09-07-2008, 10:20 AM
Phibbus Phibbus is offline
Junior Member
Join Date: Sep 2008
Posts: 1
Re: Manipulating objects inside a "SMARTOBJECT" ?

I realize this reply is very late, but I stumbled on your post while searching on how to accomplish the same thing and thought I'd reply with the solution I found.

The method to open the contents of a SmartObject for editing is an undocumented action, however you can discover it by using the ScriptListener plugin. You have set a couple of parameter values and then use the executeAction command. After your "if" statement, you'll want to make the SmartObject layer the active layer...
docRef.activeLayer = docRef.artLayers[i];
then insert the following lines to open the layer's contents...
var idAction = stringIDToTypeID( "placedLayerEditContents" );
var idDesc = new ActionDescriptor();
executeAction(idAction, idDesc, DialogModes.NO);
Your script will open the SmartObject just as if you double-clicked its icon in the layer stack. The object's contents are opened as a temporary .psb file, and it then becomes the activeDocument for your script. You may take further actions upon it and then close it (saving changes) to return to your original document.

I'm finding SmartObjects to be very powerful, but they're still new enough to be a bit quirky in their implementation.

Last edited by Phibbus; 09-08-2008 at 09:47 AM. Reason: code error
Reply With Quote top

  RetouchPRO > Tools > Software > Photoshop Scripting

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: ImageSkill Translucator: new tool for translucent objects extraction Dm_Cher Software 1 10-24-2006 07:10 AM
Help Turning Clouds into Objects... mhkitty8880 Photo-Based Art 9 09-01-2006 08:49 PM
Help needed in replacing an object's surface! Alice Photo Restoration 3 09-06-2003 07:00 PM
Net Objects Fusion 7.0 beaner Your Website 1 09-01-2003 01:33 PM
Scanning Objects G. Couch Input/Output/Workflow 57 05-22-2002 02:43 AM

All times are GMT -6. The time now is 08:06 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved