Skip to main content
Known Participant
February 13, 2022
Answered

script load file into stack

  • February 13, 2022
  • 4 replies
  • 4098 views

Using listener I have used the "load files into stack"  in a script that also does a bunch of other things. It works but, I still have to manually tell it to use the two files that are open. Is there a way to modify and incorporate the "load files into stack" script to just do it to the only two files that are open? Or even better only have one file open and have load files from a source folder?

This topic has been closed for replies.
Correct answer Kukurykus

In only froze photoshop once, now it just closed both images and does nothing else and throws the error This is the script I'm using which a direct copy from what you posted. It worked at first.


For me it worked. Reset preferences and relaunch Photoshop, then try again.

If that not helps then: How and when to use the Creative Cloud Cleaner tool

4 replies

Stephen Marsh
Community Expert
February 15, 2022

Just as an alternative take on the whole process, this could be easily run as an action one at a time or via batch or Image Processor or Image Processor Pro. You could also just make the 8x12 file 8x2. This action assumes that the image is open or that it is opened by batch etc.

 

 

Known Participant
February 15, 2022

Thanks, I'll look into that. I'll probably either use a script that calls actions or an action that calls  some scripts. 

Known Participant
February 15, 2022

Thanks toboth of you you've helped a lot. I think this thread has run it's course. If I run into more problems I'll start a new one.

Stephen Marsh
Community Expert
February 13, 2022

Are you using specific features of the Load Files Into Stack script, such as auto align? Or was this just the most obvious way for you to combine multiple files into a single layered file?

 

Are you only wishing to have a two layer result, or is it possible that more than one layer will be added to the open target document?

 

Known Participant
February 14, 2022
quote

Are you using specific features of the Load Files Into Stack script, such as auto align? Or was this just the most obvious way for you to combine multiple files into a single layered file?

By @Stephen Marsh


It was just the only way I could figure out how to load two files into a single file.

quote

 

Are you only wishing to have a two layer result, or is it possible that more than one layer will be added to the open target document?

 

By @Stephen Marsh
file A is the current open image.

File B is a larger image I want to place under file A. File B is ALWAYS the same named the same in the same location.

File B is 8x12 inches file A is 8x10 inches.

File A needs to be aligned to the top right or top left.

In this example File A is the actual photo, File B is the file with the information.

I have a script that does this but it involves opening a new 8x12 then pasting the 8x10 and 8x2 on it. I thought I could simplify by using layers. Thanks to Kukurvkus for helping me get that sorted out. I'm also trying to sort out doing the date automatically. 

Stephen Marsh
Community Expert
February 14, 2022

Hopefully I can explain better. I do event photography. My two biggest money makers of the year I have about 10 minutes to take a picture, edit it and produce a print. Before the event I produce file B named "event info" it is always named this and is in the same place. It is a flattened jpg. It is always 8x12.

File A is the image I have just taken and done a quick edit to. It is always 8x10. Both images have same resolution.

My scripting proficiency level is pretty low. I can usually get changes made to an existing script, I usually use listener to get a start. I can get actions to dowhat I want. 

I have a script that does this, I was hoping to stream line it a bit.

My work flow is

Open picture and edit it, start script with a hot key
when script starts it

  • opens dialog box for me to thpe something
  • renames the image adding what I typed infront of the image number
  • rotates image to portrait
  • saves as a new file with the name/number to two different drives 
  • open a new 8x12 image
  • open "event info" image 
  • Paste new image and event info onto the new 8x12
  • flatten and save image with the new name
  • save image to two different drives, one of those folders my printer watches and when something arrives there it prints it.
  • closes the image and returns to bridge

I am hoping to streamline it by using the open in layers that the above code from Kukurykus to maybe speed things up a bit.

I was also hoping to add  a layer just before the final flatten and save that would print SYSTEM date to the image. I have a script that will do that, still working on how to get the text to appear where I want it. I've also included it.  I think the original author placed the text by some percentage of document size.Changing x and y doesn't seem to move it the way I expect it to. I cant change the font to arial,  I can change it new times roman. 


The following function can align the text layer to a selection. In this case, select all, but it could be modified to be a selection from a layer.

 

https://gist.github.com/MarshySwamp/df372e342ac87854ffe08e79cbdbcbb5

 

Once the text has been aligned to the required position, it could be fine tuned:

 

// Move the current layer in 5px from the right and down 5px from the top
app.activeDocument.activeLayer.translate( -5, 5 );

 

Kukurykus
Brainiac
February 13, 2022

 

dcmnts = []; while(documents.length)
	dcmnts.push((dcmnt = activeDocument).fullName),
	dcmnt.close(SaveOptions.DONOTSAVECHANGES)

txt = '$$$/ScriptingSupport/InstalledScripts=Presets/Scripts'
pth = path + '/' + localize(txt) + '/Load Files into Stack.jsx'
loadLayersFromScript ^= 1, $.evalFile(File(pth))
loadLayers.intoStack(dcmnts)

 

Known Participant
February 13, 2022

Also since images arent the same size place one in a specific location on the larger one?

Stephen Marsh
Community Expert
February 13, 2022

What would the specific location be?

 

Say upper left relative to the canvas of the target document?

 

Please go into more detail.