Scripting problem replacing layer contents.
- September 11, 2009
- 3 replies
- 1456 views
This is a follow up to the discussion in this thread http://forums.adobe.com/thread/480444?tstart=0.
I've virtually completed the script, I attached it as a .txt file rather than .jsx , In a brief nutshell it does the following:
Gets a text file name.
opens the psd identified in that document
walks the layers in that file
if the layer is a text file and there is replacement text for that name in the input file, replace the text
if the layer is an image (NORMAL) and there is an input file with a name (.jpg or .psd) matching the layer name then
the layer is turned into a smart object and it's contents replaced with the contents of the relevant file.
Saves the modified psd file as the name indicated in the input file and close the original file.
If the input file indicates the file should be left open, reopen the modified file name.
Almost everything works well except ...
1. Sometimes the modified file loses it's layering and winds up with only a "background" layer whereas other times it retains it's layering. I'm sure this is due to some characteristic of the input template .psd, but with limited understanding of photoshop itself I've no idea what characteristic to look for.
Any suggestions as to what might be the source of this problem?
2. It appears that sometimes when creating the 1 layer file that will replace an image layer as a .jpg it losses the background transparency. This doesn't seem to happen if saved as a .psd, but the user wants to work with jpgs.
Any ideas why?
3. When replacing an image layer from another replacement file, the resulting new image in the modified file doesn't seem to be properly aligned. Incidentally, the same behaviour occurs if I do the steps of creating a smart layer and replacing manually in photoshop. I tried to attached the .psd files but the forum would not allow it.
Again any ideas why it might be misaligned or a code change that will fix it?
Any suggestions would be most thankfully accepted.
Steve Ellis.