Replace to layer in Photoshop file

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Replace to layer in Photoshop file

Post by ernpchan » Sun Sep 06, 2015 5:21 pm

Via scripting I can replace an image to a separate file. Is it possible to replace to a layer in a Photoshop file? We can import layered Photoshop files. I'm not seeing a way to manually swap out Photoshop layers.
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Replace to layer in Photoshop file

Post by synthsin75 » Sun Sep 06, 2015 8:44 pm

Check out my old Syn_UpdatePSD script to update a psd import (I haven't used it in ages, so no idea if it works with AS11). http://www.kelleytown.com/forum/animato ... PIC_ID=760

You have to parse the psd to determine the layer IDs and hierarchy, then parse the AS document to match these and change the source image using the ID in the psd (line 147):

moho:LayerAsImage(moho.layer):SetSourceImage(path.."*"..id.."*")
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Re: Replace to layer in Photoshop file

Post by ernpchan » Mon Sep 07, 2015 2:37 am

Thanks! I'll check it out.
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Re: Replace to layer in Photoshop file

Post by ernpchan » Tue Sep 22, 2015 10:15 pm

synthsin75 wrote:Check out my old Syn_UpdatePSD script to update a psd import (I haven't used it in ages, so no idea if it works with AS11). http://www.kelleytown.com/forum/animato ... PIC_ID=760

You have to parse the psd to determine the layer IDs and hierarchy, then parse the AS document to match these and change the source image using the ID in the psd (line 147):

moho:LayerAsImage(moho.layer):SetSourceImage(path.."*"..id.."*")
Is there a way to get access to this script without having to register with another forum?
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
User avatar
synthsin75
Posts: 7114
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Replace to layer in Photoshop file

Post by synthsin75 » Tue Sep 22, 2015 11:53 pm

Nope, but registration's free and many more scripts are only found there.
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Re: Replace to layer in Photoshop file

Post by ernpchan » Wed Sep 23, 2015 2:08 am

synthsin75 wrote:Nope, but registration's free and many more scripts are only found there.
Ok, I'll join that forum too.

Just curious but what's the difference between that one and this one?
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
Post Reply