Copy link to clipboard
Copied
Hello there
Need help with this script:
var sourceFolder = Folder("C:\\ps\\src");
if (sourceFolder != null)
{
var fileList = sourceFolder.getFiles();
//comment the above line and uncomment the following line to filter specific file types. the script will not work if you have any non-image file in the src folder so try filtering files types if the script fails.
// var fileList = sourceFolder..getFiles(/\.(jpg|tif|psd|crw|cr2|nef|dcr|dc2|raw|heic)$/i);
}
for(var a = 0 ;a < fileList.length; a++){
app.open(fileList[a]);
// Select subject
var idautoCutout = stringIDToTypeID( "autoCutout" );
var desc01 = new ActionDescriptor();
var idsampleAllLayers = stringIDToTypeID( "sampleAllLayers" );
desc01.putBoolean( idsampleAllLayers, false );
try{
executeAction( idautoCutout, desc01, DialogModes.NO );
}
catch(err){}
// Invert the selection
app.activeDocument.selection.invert();
// Create a color to be used with the fill command
var colorRef = new SolidColor
colorRef.rgb.red = 0
colorRef.rgb.green = 0
colorRef.rgb.blue = 0
// Now apply fill to the current selection
app.activeDocument.selection.fill(colorRef)
//enter path for where you want the file saved
var saveFolder = new Folder("C:\\ps\\out");
var fileName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
sfwPNG24 (new File(saveFolder +'/' + fileName + '.png'),12);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
//fileList[a].remove();
}
function sfwPNG24(saveFile){
var pngOpts = new PNGSaveOptions;
pngOpts.transparency = true
pngOpts.compression = 9;
pngOpts.interlaced = false;
activeDocument.saveAs(saveFile, pngOpts, true, Extension.LOWERCASE);
}
Right now script works and it saves files from folder to .png
But i need a transparent background for my images..
Need something that can delete selected pixels after this:
app.activeDocument.selection.invert();
In Photoshop there is button "Delete" (Edit -> Clear), when you press this it deletes pixels in selected area. I need this in script. How to do this?
Maybe i need somehow to simulate
I am now running the action perfectly.
I deleted the make text in the actions, put a stop action at the start to make new text, wrote the text, started the action again, put a stop before make selection, made selection of new text (ctrl+click) and restarted the action, all the effects are applied.
Thanks all.
Copy link to clipboard
Copied
Can you provide screenshot of the layers panel or perhaps a link to the layered PSD file?
As a general comment without seeing the file, when it comes to text, InDesign is often the go to app. If the text requires a lot of embellishing and you have access to Adobe Illustrator, the Appearance panel and various live effects are very useful. Photoshop would generally be my second choice after Illustrator for such things, however it all depends on what is going on.
Copy link to clipboard
Copied
A Smart Object approach might considerably improve the process, but as @Stephen_A_Marsh already mentioned the description does not seem sufficient to provide meaningful advice.
Copy link to clipboard
Copied
https://www.youtube.com/watch?v=hwRwUeVoFTo
Do this once, change the text, and auto add all of this on top, is it possible?
Copy link to clipboard
Copied
When you playback the action, does it successfully create all the effects?
Copy link to clipboard
Copied
Yes it does, perfectly. So it's just a matter of changing the text i can't figure out.
Copy link to clipboard
Copied
Offhand I think that there are two choices.
1) Edit the action before playback: In the list view of the action (not button mode), double click on the make text layer action step and change the wording and press the commit tick button to apply the text. This will update the action step. Delete the text layer, it was a means to an end. Then run the action from the start and it will apply all of the steps, including the updated text.
2) Insert a stop step (without continue) after the make text layer step. One the action has created the text layer and the action has stopped, you can then edit the text added by the action. Once happy with the new text, you can then resume playback of the action from the point where it stopped and it will then play through to completion.
Copy link to clipboard
Copied
Thanks for trying to help out, the first one i have tried beforehand with no success.
The second one with stop action i tried now also with no result, the text disappears, the action only work with the text written as i made the action (the orignal text).
I guess i have lots of research to do.
Copy link to clipboard
Copied
You can post a cropped screenshot of the action panel, with all steps full expanded, perhaps something will be obvious that way... Or you can use a file sharing service to share of copy of the saved action set .atn file.
Are you using point text where you just click with the text tool, or are you using area type where you create a rectangular area with the text tool?
Similar to my Point #2, you could just not include any text in the action, add a stop message, manually add the text and then continue playback of the action in full, avoiding any use of text in the action.
P.S. Please do ensure that you save/backup the action set that you created:
https://prepression.blogspot.com/2017/01/photoshop-custom-action-file-backup.html
Good luck!
Copy link to clipboard
Copied
I will redesign my action once again, and post screenshots if it's not working until i can figure this out. It has something to du with selections of text, i have to delete make text layer in action as you said, but also the make selection of text and apply to layer mask, and record new text and new selection of text, i will try this in new action and let you know.
Thank for the save/backup link, already destroyed a couple 😛
Copy link to clipboard
Copied
From what I can see in tutorial (I am not watching tutorial just quick look at effect) it seems that more then only layer effects are used, there are multiple layers included in final effect. This will be difficult to replicate/record for novice action developer.
From what I understand, you want to write more text and to replicate entire effect? It is doable, record action to create effect then type text on top of other layers and run action. Not sure why you must duplicate existing text then change it on duplicated layer? Type it then run action or record text typing into action.
If you are trying to keep effect by duplicating type layer that won't work I think because it seems many separate raster layers are involved (just guessing by looking at Layers panel on screenshot above, I havent watched tutorial). It is not that simple and easy to copy effects when things are done in this way, you must record steps to replicate effect.
Copy link to clipboard
Copied
Thank you, this is helpful.
I will try to redesign the action, it seems like since the text layers are selections of the text converted to black and white layer mask, the action doesn't make new selections of the updated text recorded, i guess i have to make new selections of the new text also then.
When working with live text layers for some reason the filter gallery effects doesn't work so that's why selections are used instead of text layer (smart object).
When i convert text layer to smart object i can add effects/filters and just playback a action with whatever text, so the problem are the selection layers i guess.
Copy link to clipboard
Copied
"i guess i have to make new selections of the new text also then."
For layer mask? Yes, it is not difficult if you have raster layer just Ctrl + click on layer thumb to load selection then create layer mask.
Be careful when recording action to not click on layer when selecting it to not record layer name in action step or name layers but that will not work if you plan to add more text and apply same effect. Best option is to use keyboard to select/target and move layers.
Do not hesitate to ask more questions and post action or take screenshots of steps and explain what are you trying to do and where is the problem. Do not expect easy things at least in the beginning until you learn how actions work and how to think when recording them.
Copy link to clipboard
Copied
I am now running the action perfectly.
I deleted the make text in the actions, put a stop action at the start to make new text, wrote the text, started the action again, put a stop before make selection, made selection of new text (ctrl+click) and restarted the action, all the effects are applied.
Thanks all.
Copy link to clipboard
Copied
can you share the script text
thank you