Link in Zwischenablage kopieren
Kopiert
Hi Guys
I'm sure there is a really simple way to do this but I can't find the answer anywhere!
When I create multiple groups on separate layers, there must be a quicker way then right clicking and individually merging each layer so they stay on their respective layers?
A shortcut would save so much time!!
Thanks
I can't help right now but move your topic to Photoshop Scripting and ask of help r-bin that should be easy for him
function sTT(v) {return stringIDToTypeID(v)} $.level = 0
function R() {return ref = new ActionReference()} arr = []
function DoL(v) {R().putEnumerated(sTT(v), sTT('ordinal'), sTT('targetEnum'))}
function bGrnd(v) {R().putIndex(sTT('layer'), v)}
function SC(v) {
return typeIDToStringID((dsc = executeActionGet(ref))
.getEnumerationValue(sTT(lS = 'layerSection')))
...Link in Zwischenablage kopieren
Kopiert
First select all groups and
Just use CTRL+E or Cmd+E on mac shortcut - and thats all
pawel
Link in Zwischenablage kopieren
Kopiert
Almost there, but these commands only do one layer at a time, or if select all and then Cmd+E it merges all layers into one layer.
Doesn't take long to Cmd+E individual layers, but would be quicker if I could do all layers at the same - prob not!
Thanks anyway
Link in Zwischenablage kopieren
Kopiert
I can't help right now but move your topic to Photoshop Scripting and ask of help r-bin that should be easy for him
function sTT(v) {return stringIDToTypeID(v)} $.level = 0
function R() {return ref = new ActionReference()} arr = []
function DoL(v) {R().putEnumerated(sTT(v), sTT('ordinal'), sTT('targetEnum'))}
function bGrnd(v) {R().putIndex(sTT('layer'), v)}
function SC(v) {
return typeIDToStringID((dsc = executeActionGet(ref))
.getEnumerationValue(sTT(lS = 'layerSection'))) == lS + v
}
function sNL() {
DoL('layer'); (dsc = new ActionDescriptor()).putReference(sTT('null'), ref)
executeAction(sTT('selectNoLayers'), dsc, DialogModes.NO)
}
function mLN(v) {
R().putIdentifier(sTT('layer'), v);
(dsc = new ActionDescriptor()).putReference(sTT('null'), ref)
dsc.putBoolean(sTT('makeVisible'), true)
executeAction(sTT('select'), dsc, DialogModes.NO)
executeAction(sTT('mergeLayersNew'), undefined, DialogModes.NO)
}
function prcs(v1, v2) {
bGrnd(idx = v1), lID = executeActionGet(ref).getInteger(sTT('layerID'))
if (SC('Start')) {
bGrnd(idx - 1); if (SC('Content')) v2 ? arr.push(lID) : (sNL(), mLN(lID))
}
}
try{
R().putIdentifier(sTT('layer'), 1)
bG = !(executeActionGet(ref))
.getBoolean(sTT('background'))
}
catch (err) {bG = 1}
DoL('document'), tL = sTT('targetLayers')
if ((dsc = executeActionGet(ref)).hasKey(tL)) {
for(lst = dsc.getList(tL), i = 0; i < lst.count;) {
prcs(lst.getReference(i++).getIndex() + bG, true)
}
sNL(); for(i = 0; i < arr.length; i++) mLN(arr[i])
}
else {
DoL('layer'), prcs(executeActionGet(ref)
.getInteger(sTT('itemIndex')) - !bG, false)
}
Link in Zwischenablage kopieren
Kopiert
Kukurykus your script is very helpful I managed to solve my problem with your script. Thanks a lot
Link in Zwischenablage kopieren
Kopiert
What was your problem?
Link in Zwischenablage kopieren
Kopiert
Hi - Thanks for this, I tried this code, but when I select more than one layer, I get the following error message:
Error 1243: Illegal argument - argument 2
- Numeric value expected
Line: 14
-> R().putIdentifier(sTT('layer'), v);
Any ideas? The code would be REALLY useful for me as I often need to flatten multiple layers into individual groups.
Link in Zwischenablage kopieren
Kopiert
Leave a link to uploaded .psd so I try script on and see what is wrong.
btw moderator, other user confimred script works for him so I marked my solution as correct. Please add 'Actions and scripting' label to post of original poster, thx!
Link in Zwischenablage kopieren
Kopiert
Hi Kukurykus
Sorry for my bad english
For simple groups, your script is working fantastic,
but when i try to merge some complex nested groups, it cant merge all of them
i have attached a video which can explain the issue more clearly
i need groups to be merged completely into a single layer.
can you please help me?
agian sorry for my bad english.
Thanks a lot
Link in Zwischenablage kopieren
Kopiert
Can you check in those groups by removing single layers which one causes they can't be merged?
Link in Zwischenablage kopieren
Kopiert
I removed the layers one by one and checked whether is working... But layers were not the issue.
and I also tried removing the layer mask, and the mask was also not the issue.
but when I ungrouped the inner group, it was working
I think its the issue.
I have attached the video and PSD.
Thanks a lot for helping.
Agian sorry for my bad english.
Link in Zwischenablage kopieren
Kopiert
Change:
SC('Content')
to:
executeActionGet(ref).getInteger(sTT('parentLayerID'))
Link in Zwischenablage kopieren
Kopiert
Hi Kukurykus,
I have changed the code as you said
and I am getting this error
I am using Photoshop CC 2019
please help me with this issue or let me know if I did anything wrong...
and Thanks for helping me, I really appreciate it.
Link in Zwischenablage kopieren
Kopiert
Update to release 22.
Link in Zwischenablage kopieren
Kopiert
Hi Kukurykus,
I have updated to 22, and your script works very well
but it still has a small error.
it reveals and merges the inner groups, it's not merging the group as it is.
can you please help me with this?
I have attached the error video and error PSD
sorry to asking again and again,
but I really need this, it can save my time a lot
Thanks a lot...
Link in Zwischenablage kopieren
Kopiert
Change:
bGrnd(idx - 1); if (executeActionGet(ref).getInteger(sTT('parentLayerID')))
to:
if (!(executeActionGet(ref).getInteger(sTT('parentLayerID')) + 1))
Link in Zwischenablage kopieren
Kopiert
Hi Kukurykus,
Thanks a lot for helping me,
I got one more error.
the script is working good when the groups are simple
if I try to merge the groups that are inside another group, the script is not working
can you please help me with this?
I have attached the error video and error PSD
Link in Zwischenablage kopieren
Kopiert
I'm just curious, what if you select the layer group and convert to smart object, then select the smart object and select rasterize smart object?
Link in Zwischenablage kopieren
Kopiert
Hi,
Thanks for the reply
I have a large number of groups,
if I select the layer group and convert it to a smart object, then select the smart object and select rasterize smart object, it would be a big process and it would take too much time than usual
Link in Zwischenablage kopieren
Kopiert
Change:
SC('Content')
in known line of original code to:
executeActionGet(ref).getInteger(sTT('parentLayerID')) == lID
To avoid merging inner groups, select layerSets without holding Shift, but only using Ctrl.
Link in Zwischenablage kopieren
Kopiert
Thank You So Much...
Link in Zwischenablage kopieren
Kopiert
Will this decision suit you?
Script to Merge each main group (not subgroup) in to a layer
The script merges all zero-level groups, even empty ones.
You do not need to preselect them.
Link in Zwischenablage kopieren
Kopiert
Hi r-bin
Thanks for the reply
your script works great when its come to merging all group in the entire document
but I need to select and merge the groups.
Thanks for the help, really
Link in Zwischenablage kopieren
Kopiert
This is HUGE help, it worked flawlessly
Link in Zwischenablage kopieren
Kopiert
This works perfectly, thank you so much!
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen