New Group From Layers

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Paul MR

New Group From Layers

Post by Paul MR »

Well I'am stumped. I have tested with and without a background layer on Windows and on a Mac (CS4) and the script is working fine so I have no idea why it doesn't work for you.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

New Group From Layers

Post by Mike Hale »

Paul, I am not sure why but it also doesn't work for me on WinXP with CS5. It seems that without a background layer in the doc the index is off for the move step.

I can fix it here by making this change;
Code: Select all   try{
      activeDocument.backgroundLayer;
      moveLayerToLayerSet( Number(sLayers[a]),To);
   }catch(e){
      moveLayerToLayerSet( Number(sLayers[a]),To+1);
   }

But if it is working for you now that change should break it on your system. I think I would rather understand why the index needs changing on some systems and not others so I will spend some time looking into this.
Paul MR

New Group From Layers

Post by Paul MR »

Thank you for testing Mike.
Yes there is an error in the first script when there is no Background, I will have look to see what the problem is.

I was testing the second script with/without a background on Windows and on a Mac and this one is working fine for me, does this work for you with XP?
Mike Hale

New Group From Layers

Post by Mike Hale »

Sorry, I didn't test the second script before I made my post. Yes it works here as expected.
Paul MR

New Group From Layers

Post by Paul MR »

Thank you Mike, it seems strange that it doesn't work for mycort?
mycort

New Group From Layers

Post by mycort »

really odd, I tried the second code version again and now it works regardless of background. I did made updates to both my macos and photoshop....

thx for all your time and effort, this will save me tons of time....