What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Scripting Transfer paths or masks from one document to another


Status
Not open for further replies.

ppersson

Member
Messages
13
Likes
0
Hi guys,
Im kind of getting gray hair waay in advance trying to find out if this is possible at all. I have two different cases and Im gonna try to explain them as good as possible below.
I am working with a high volume of images so this would save us a lot of time if we could automate it instead of doing this job manually.

Case 1, Paths)
We are sending jpeg's to parters in Asia to get clipping paths of skin, hair, background & foreground. Meanwhile they are doing paths we are working on our PSD working files. So we can't send our working files to them, also, they do not accept PSD files.
Later we get the files back from our Asian partner and want to transfer the paths they've done from the jpeg to our working files. And here is where my issue is. In a dream scenario there would be a hotfolder or a script or similar where I can drop the files including the paths and that they pair and applies on our working files. It is of course not only important that they match to the correct file, but also that they gets placed correctly. The files we send to Asia always have the same dimensions as our working files.
The steps I am thinking is kind of, but it is probably more complexed:
1) Open jpeg with paths
2) Find PSD file with matching file name
3) Copy all paths from jpeg
4) Paste all copied paths at the right position in PSD
5) Save and close
6) Continue with the next file


Case 2, Masks)
Kind of the same as above but instead of paths we are using masks applied on folders in the layer tab.
We are sending jpeg's to parters in Asia to get masks of skin, hair, background & foreground. Meanwhile they are doing masks we are working on our PSD working files. So we can't send our working files to them, also, they do not accept PSD files.
Later we get the files back from our Asian partner and want to transfer the masks they've done to our working files. In this case, since they are doing masks, we receive tiff files. And again, here is where my issue is. In a dream scenario there would be a hotfolder or a script or similar where I can drop the files including the paths and that they pair and applies on our working files. It is of course not only important that they match to the correct file, but also that they gets placed correctly. The files we send to Asia always have the same dimensions as our working files.
The steps I am thinking is kind of, but it is probably more complexed:
1) Open tiff with masks
2) Find PSD file with matching file name
3) Copy all masks from tiff
4) Paste all copied masks at the right position in PSD
5) Save and close
6) Continue with the next file


If you think you will be able to find a solution on one or on both cases above but you need files to try it on - please let me know and I can send you some files to try it on.

Thanks!
//Pierre
 

MrToM

Guru
Messages
3,595
Likes
3,321
I'm almost there with the first half but a quick question...

When the paths are pasted into the PSD file do they need to be separate or can they all be part of one workpath?

I have it working but all the paths are merged into one workpath.....would that be a problem?

I'll work on it while awaiting your reply so its possible this question could now be obsolete.

Regards.
MrToM.
 

ppersson

Member
Messages
13
Likes
0
Hi MrTom,
Wow, that's amazing!

The paths would need to be separate and not merged since we use these to create masks for different purposes.

Thanks a lot for your effort!!

Very best,
//Pierre
 

MrToM

Guru
Messages
3,595
Likes
3,321
OK...no worries....try this:

INSTRUCTIONS.....a bit tricky but bear with it...

BACKUP YOUR PSD FILES FIRST!!!

1. Unzip and run the script.
2. Select the JPG folder.
3. Select the PSD folder.
4. Told you it was tricky. :rofl:

What it does:
1) Open jpeg with paths...........................................CHECK.
2) Find PSD file with matching file name.....................CHECK.
3) Copy all paths from jpeg.......................................CHECK.
4) Paste all copied paths at the right position in PSD....CHECK.
5) Save and close....................................................CHECK.
6) Continue with the next file....................................CHECK.

If a matching PSD cannot be found the script will stop and the faulting JPG left open so you know which one has failed.

If this happens then REPLACE the PSD files with your backups...you can run it again without but I have had problems....best to use new copies.

You can select the same folder for both the JPG files AND the PSD files if you wish.

I don't guarantee it will work perfectly, and if it doesn't then just let me know.

It took a fair while to code this so I'll let someone else do the second half.

The script:

View attachment copy_and_paste_paths_MT_00.zip

Regards.
MrToM.
 

ppersson

Member
Messages
13
Likes
0
This is brilliant, thanks a lot! I will try this right away!
One more question.. Would it be possible to create a hot folder or similar that trigger the script? Or is it possible to do it in a even more simple way than that I need to go to File --> Script --> Browse --> Select the script each time when I want to run the script?

If not that is totally fine, Im super happy with what you've done!!

Very best,
//Pierre
 

ppersson

Member
Messages
13
Likes
0
Hi again MrTom,
I tried to run the script now on some test files, but unfortunately I get a error msg. See attached. I am running the latest version of photoshop 2017.0.1

Screen Shot 2017-03-31 at 23.48.58.png
 

MrToM

Guru
Messages
3,595
Likes
3,321
I can think of 3 things you could do...

1.
If you have the Extendscript Toolkit you can open and run the file from there...PS needs to be open and the Toolkit connected to it.


2.
Alternatively you can copy the script to your Adobe install Scripts folder...

C:\Program Files\Adobe\Adobe Photoshop CC 2015.5\Presets\Scripts

Then use FILE > SCRIPTS and select the script to run it.


3.
Use the Script Events Manager, FILE > SCRIPTS > SCRIPTS EVENT MANAGER, to run the script when firing a particular event...Opening PS for example, or creating a new file.


As far as I know, for security reasons there is no way to link folders outside of PS, if that's what you mean by 'hotfolder'. Could be wrong though.

Regards.
MrToM.
 

MrToM

Guru
Messages
3,595
Likes
3,321
Hi again MrTom,
I tried to run the script now on some test files, but unfortunately I get a error msg. See attached. I am running the latest version of photoshop 2017.0.1
Can you confirm that are no paths in the PSD files already.

This is similar to the error I spoke of...the files need to be clean of paths.

If they are then I'll see if I can replicate it on 2017 but as 2017 isn't very stable there is no guarantee it'll work whatever I do.

Regards.
MrToM.
 

MrToM

Guru
Messages
3,595
Likes
3,321
OK.

Let me try it here...it may be tomorrow now as its late here but leave it with me.

Regards.
MrToM.
 

MrToM

Guru
Messages
3,595
Likes
3,321
Hmmm.

I've just tried it in 2017.0.0 and it works fine.

Maybe you should zip some example files for me to try.....its all I can think of to test this out.

Regards.
MrToM.
 

MrToM

Guru
Messages
3,595
Likes
3,321
OK, thank-you.

I get the error too so leave it with me.

Should be easier to track down with those example files. :thumbsup:

Regards.
MrToM.
 

ppersson

Member
Messages
13
Likes
0
Just tried on the same files as I sent you and yes, they work fine :)
I will try them on other files on Monday too!

Is it super tricky to do 2 versions of each script?

To have them apply the paths & masks on tiffs instead of psd's. Im just thinking it would great to have both options :)
 
Status
Not open for further replies.

Top