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

CS4 "make layers same size" Syntax Error 8

Guest
Mar 23, 2013 Mar 23, 2013

Copy link to clipboard

Copied

Using Photoshop CS4 on a Mac with 10.6.8. I am working with a file that has several individual portraits as separate layers. All the portraits are approximately the same size, but I want to make them the exact same size (325 pixels by 325 pixels, not that it matters).

I tried highlighting several of the layers, then going to FILE > Scripts > "Make all selected layers the same size"

Screen shot 2013-03-23 at 7.11.20 PM.png

I have limited photoshop knowledge, and have never used a script before. I've tried closing and re-opening photoshop (my only technical knowledge: restart?!). I also tried googling the error, to no avail.

I have never used scripts...and have definitely never tried to change any scripts within Photoshop. Any specific ideas on how I can fix this would greatly be appreciated (and please remember that I'm still a beginner at this)


Thanks in advance!

TOPICS
Actions and scripting

Views

1.6K

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 1 Correct answer

Valorous Hero , Mar 25, 2013 Mar 25, 2013

You can download the full script from here..

http://www.scriptsrus.talktalk.net/ResizeLayers.htm

Votes

Translate

Translate
Adobe
Guru ,
Mar 23, 2013 Mar 23, 2013

Copy link to clipboard

Copied

I don't think that is a script that ships with Photoshop. Can you post the full script or a link to where you downloaded it from?

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
Guest
Mar 23, 2013 Mar 23, 2013

Copy link to clipboard

Copied

I am an IDIOT. Apparently my friend did try to put this in my computer to help me. He copied and pasted it from a suggestion he found on the internet:

[ code was mangled by the editor - removed by admin since it was incomplete and difficult to view. Try using the pre /pre HTML tags around it. ]

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
Guest
Mar 23, 2013 Mar 23, 2013

Copy link to clipboard

Copied

Thanks for your reply Michael!! I tried copying and pasting above...but it put in those column lines. Is that readable to you? Or is there a better way to paste it in?

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
Guru ,
Mar 24, 2013 Mar 24, 2013

Copy link to clipboard

Copied

One way to post code is to click on the 'Use advanced editor' link that is at the top left of the post window. That adds some new icons one of which is '>>' When you click on that you get a menu for inserting text. I use 'Syntax Highlighting->Plain'.

But from looking at what you posted before it was removed, I would say that the reason you are getting the error is the code is already scrambled. I would think that

#target photoshop

function main(){ if(!documents.length)

Should be the start of the script. But it is repeated later in the middle of an if statement. I think that 'double paste' in the code on your machine is the reason for your error.

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
Guest
Mar 25, 2013 Mar 25, 2013

Copy link to clipboard

Copied

#target photoshop

function main(){

if(!documents.length) return;

var win = new Window( 'dialog', 'RL' );

g = win.graphics;

var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);

g.backgroundColor = myBrush;

win.orientation='stack';

win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});

win.g1 = win.p1.add('group');

win.g1.orientation = "row";

win.title = win.g1.add('statictext',undefined,'Resize Selected Layers');

win.title.alignment="fill";

var g = win.title.graphics;

g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);

win.g5 =win.p1.add('group');

win.g5.orientation = "row";

win.g5.alignment='center';

win.g5.spacing=10;

win.g5.st1 = win.g5.add('statictext',undefined,'Resize to...');

win.g5.et1 = win.g5.add('edittext');

win.g5.et1.preferredSize=[60,20];

resizeUnits = ["pixels", "inches","cm", "mm"];

win.g5.dd1 = win.g5.add('dropdownlist',undefined,resizeUnits);

win.g5.dd1.selection=0;

win.g5.et1.onChanging = function() {

  if (this.text.match(/[^\-

#target photoshop

function main(){

if(!documents.length) return;

var win = new Window( 'dialog', 'RL' );

g = win.graphics;

var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);

g.backgroundColor = myBrush;

win.orientation='stack';

win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});

win.g1 = win.p1.add('group');

win.g1.orientation = "row";

win.title = win.g1.add('statictext',undefined,'Resize Selected Layers');

win.title.alignment="fill";

var g = win.title.graphics;

g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);

win.g5 =win.p1.add('group');

win.g5.orientation = "row";

win.g5.alignment='center';

win.g5.spacing=10;

win.g5.st1 = win.g5.add('statictext',undefined,'Resize to...');

win.g5.et1 = win.g5.add('edittext');

win.g5.et1.preferredSize=[60,20];

resizeUnits = ["pixels", "inches","cm", "mm"];

win.g5.dd1 = win.g5.add('dropdownlist',undefined,resizeUnits);

win.g5.dd1.selection=0;

win.g5.et1.onChanging = function() {

  if (this.text.match(/[^\-\.\d]/)) {

    this.text = this.text.replace(/[^\-\.\d]/g, '');

  }

};

win.g10 =win.p1.add('group');

win.g10.orientation = "row";

win.g10.alignment='fill';

win.g10.spacing=10;

win.g10.bu1 = win.g10.add('button',undefined,'Process');

win.g10.bu1.preferredSize=[150,25];

win.g10.bu2 = win.g10.add('button',undefined,'Cancel');

win.g10.bu2.preferredSize=[150,25];

win.g10.bu1.onClick=function(){

if(win.g5.et1.text == ''){

    alert("You have not entered a required size!");

    return;

    }

win.close(0);

Res = activeDocument.resolution;

Pixel = Number(win.g5.et1.text);

CM = Res/2.54;

MM = Res/25.4;

switch(win.g5.dd1.selection.index){

    case 0 : break;

    case 1 : Pixel = Pixel * Res; break;

    case 2 : Pixel = Pixel * CM; break;

    case 3 : Pixel = Pixel * MM; break;

    default : break;

    }

var selectedLayers = getSelectedLayersIdx();

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

for (var z in selectedLayers){

selectLayerByIndex(Number(selectedLayers));

resizeLayer(Pixel);

    }

app.preferences.rulerUnits = startRulerUnits;

}

win.center();

win.show();

}

main();

function resizeLayer(Pixel){

var doc = activeDocument;

var res= doc.resolution;

var LB = activeDocument.activeLayer.bounds;

var Height = LB[3].value - LB[1].value;

var onePix = 100/Height;

var newSize = onePix * Pixel;

doc.activeLayer.resize( newSize , newSize, AnchorPosition.MIDDLECENTER);

}

function selectLayerByIndex(index,add){

          add = (add == undefined)  ? add = false : add;

var ref = new ActionReference();

    ref.putIndex(charIDToTypeID("Lyr "), index);

    var desc = new ActionDescriptor();

    desc.putReference(charIDToTypeID("null"), ref );

                if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) );

      desc.putBoolean( charIDToTypeID( "MkVs" ), false );

            try{

    executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );

}catch(e){}

};

function getSelectedLayersIdx(){

      var selectedLayers = new Array;

      var ref = new ActionReference();

      ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

      var desc = executeActionGet(ref);

      if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){

         desc = desc.getList( stringIDToTypeID( 'targetLayers' ));

          var c = desc.count

          var selectedLayers = new Array();

          for(var i=0;i

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
Valorous Hero ,
Mar 25, 2013 Mar 25, 2013

Copy link to clipboard

Copied

You can download the full script from here..

http://www.scriptsrus.talktalk.net/ResizeLayers.htm

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
Guest
Mar 25, 2013 Mar 25, 2013

Copy link to clipboard

Copied

LATEST

Thank you Michael and Paul! Paul, I've downloaded your solution and it worked like a charm. THANK YOU!!

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