• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

script load file into stack

Community Beginner ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting , Windows

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 4 Correct answers

LEGEND , Feb 13, 2022 Feb 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)

 

Votes

Translate

Translate
Community Expert , Feb 14, 2022 Feb 14, 2022

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 );

 

Votes

Translate

Translate
Community Expert , Feb 15, 2022 Feb 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.

 

atn.jpg

 

Votes

Translate

Translate
LEGEND , Feb 15, 2022 Feb 15, 2022

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

Votes

Translate

Translate
Adobe
Community Beginner ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

What would the specific location be?

 

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

 

Please go into more detail.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

 

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)

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

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?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

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_A_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_A_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.

webKrea-8617.jpg

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

Date? Anyway if my reply is an correct solution confirm it by marking it so 😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

Sorry, I don't know enough about where to put it to know wether it works. Sometimes I can get thing to work, others not.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

You mean how to mark answer or to run a code? And how did you do it so far? Save it as stack.jsx to 'Presets/Scripts' of your Photoshop, then launch app and run from 'File/Scripts'.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2022 Feb 13, 2022

Copy link to clipboard

Copied

File B appears to be a multi-layered file with text variables that pickup the file date and potentially file names, project names etc. Possibly the copyright date changes as well. Are these to be manually updated or are you hoping to have these auto-populate?

 

So file B never changes, there is no need to select a different file, the file and path could just be coded into the script as a fixed entry?

 

Do you need to process landscape and portrait orientation images separately? Are the images always 8x10in and 8x2 for a final size of 8x12in? Will file A and B always have the same resoluiton PPI value?

 

What is your proficiency level with actions and or scripting?

 

If requiring assistance from others, it would probably be helpful to provide download links to the files. There are a lot of unknowns here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

OK, I really feel stupid now and must appologize. Kukurykus I looked at the code you posted and instead of trying it as you posted, tried to find a place to put it in the code I already had. It does work, standalone,  as it should. I've marked it as the correct answer. Thank you.  After trying some of the examples others had posted in my searches I didn't realize it could be accomplished is so few lines. 

Now I have to figure out how to incorporate it into the file saving code you helped me with.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

This is the original time date script

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

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 );

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

Thank you Stephen, finally was able to get it into the right position. It did take a lot of trial and error, the numbers don't correspond to anything that I could figure out. I am able to change the color to what I want but, not font. Much trial and error to get font size right, it also doesn't seem to correspond to anything.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

Kukurykus that script worked just fine, I tried it a number of times. Ran it and Photoshop locked up. After restart of Photoshop and computer I get this error. After it closes the two images that are open.2022-02-14_183438.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied

Upload images you use it gets stuck on.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2022 Feb 14, 2022

Copy link to clipboard

Copied


@Richard23129568di6f wrote:

Thank you Stephen, finally was able to get it into the right position. It did take a lot of trial and error, the numbers don't correspond to anything that I could figure out. I am able to change the color to what I want but, not font. Much trial and error to get font size right, it also doesn't seem to correspond to anything.


 

I was assuming that your script was working in the unit of px and not % or In, CM etc.

 

https://gist.github.com/MarshySwamp/898ae3237305787d0683125166aeb480

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

For me it worked. Reset preferences and relaunch Photoshop, then try again.
In that not helps then: How and when to use the Creative Cloud Cleaner tool

I figured that was going to be the case. Since I don't use cloud, way too expensive, It looks like i may have to reinstall CS6. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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.

 

atn.jpg

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

LATEST
For me it worked.

Final note, reinstalling windows fixed the problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines