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

CS6 Errors Running old Scripts.

Community Expert ,
May 16, 2012 May 16, 2012

On the 10th I installed CS6 and found Adobe did not fix the Bugs I reported in CS5.  Today I started testing CS6.  I started with my Photoshop Photo Collage Toolkit which contains 10 scripts.   These scripts work in CS2, CS3, CS4 and CS5.  I have not found one that will run is CS6.  Is anyone else having problems running old scripts that process several docouments switching between them.  The simplest script in my package is PasteImageRoll.jsx could someone see if it works on their machine. Its something like a Qimage for Photoshop However CS6 seems to loose the corrent document object???

CurrDoc.jpg

/* ==========================================================

// 2012  John J. McAssey (JJMack)

// ======================================================= */

// This script is supplied as is. It is provided as freeware.

// The author accepts no liability for any problems arising from its use.

/* Help

<javascriptresource>

<about>$$$/JavaScripts/PasteImageRoll/About=JJMack's PasteImageRoll^r^rCopyright 2012 Mouseprints.^r^rCreate a document for printing on roll paper^rcan also be used as a wall hanging when^rall selected images have the same orientation.^rImages will be rotated to match cell orientation</about>

<category>JJMack's Collage Script</category>

</javascriptresource>

*/

//Set Defaults here

var dfltRes = 300;          // default print DPI

var dfltCpys = 1;          // default image copies

var dfltPw  = 16;          // default roll paper width in inches

var dfltPl  = '';          // default roll paper length in feet. if set to null script will use 100 ft.

var dfltCw  = 4;          // default cell width in inches best if it divides paper with evenly.

var dfltCh  = 6;          // default cell height in inches

//End Defaults

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS; // tell ps to work with pixels

try {

          // begin dialog layout

          var RollPaperDialog = new Window('dialog');

          RollPaperDialog.text = 'Paste Image Roll';

          RollPaperDialog.frameLocation = [70, 70];

          RollPaperDialog.alignChildren = 'center';

          RollPaperDialog.PrintResPnl = RollPaperDialog.add('panel', [2, 2, 200, 56], 'Print Resolution');

                    RollPaperDialog.PrintResPnl.add('statictext', [10, 16, 50, 48], 'DPI ');

                    RollPaperDialog.PrintResPnl.docResEdt = RollPaperDialog.PrintResPnl.add('edittext', [50, 13, 90, 34], dfltRes, {name:'prtRes'});

                    RollPaperDialog.PrintResPnl.docResEdt.helpTip = 'Image Resolution';

                    RollPaperDialog.PrintResPnl.add('statictext', [96, 16, 140, 48], 'Copies ');

                    RollPaperDialog.PrintResPnl.imgCpysEdt = RollPaperDialog.PrintResPnl.add('edittext', [140, 13, 175, 34], dfltCpys, {name:'imgCpys'});

                    RollPaperDialog.PrintResPnl.imgCpysEdt.helpTip = 'Number of copies of selected Images';

          RollPaperDialog.PaperSizePnl = RollPaperDialog.add('panel', [2, 2, 200, 56], 'Roll Paper Size');

                    RollPaperDialog.PaperSizePnl.add('statictext', [10, 16, 50, 48], 'Width ');

                    RollPaperDialog.PaperSizePnl.aspectWidthEdt = RollPaperDialog.PaperSizePnl.add('edittext', [50, 13, 90, 34], dfltPw, {name:'pprWth'});

                    RollPaperDialog.PaperSizePnl.aspectWidthEdt.helpTip = 'Roll width in inches';

                    RollPaperDialog.PaperSizePnl.add('statictext', [96, 16, 140, 48], 'Length ');

                    RollPaperDialog.PaperSizePnl.aspectHeightEdt = RollPaperDialog.PaperSizePnl.add('edittext', [140, 13, 175, 34], dfltPl, {name:'pprLnth'});

                    RollPaperDialog.PaperSizePnl.aspectHeightEdt.helpTip = 'Remaing roll length in feet';

          RollPaperDialog.CellSizePnl = RollPaperDialog.add('panel', [2, 2, 200, 56], 'Tile Cell Size');

                    RollPaperDialog.CellSizePnl.add('statictext', [10, 16, 50, 48], 'Width ');

                    RollPaperDialog.CellSizePnl.aspectWidthEdt = RollPaperDialog.CellSizePnl.add('edittext', [50, 13, 90, 34], dfltCw, {name:'cllWth'});

                    RollPaperDialog.CellSizePnl.aspectWidthEdt.helpTip = 'Width in inches';

                    RollPaperDialog.CellSizePnl.add('statictext', [96, 16, 140, 48], 'Height ');

                    RollPaperDialog.CellSizePnl.aspectHeightEdt = RollPaperDialog.CellSizePnl.add('edittext', [140, 13, 175, 34], dfltCh, {name:'cllHgt'});

                    RollPaperDialog.CellSizePnl.aspectHeightEdt.helpTip = 'Height in inches';

          var buttons = RollPaperDialog.add('group');

          buttons.orientation = 'row';

                              var okBtn = buttons.add('button');

                    okBtn.text = 'OK';

                    okBtn.properties = {name: 'ok'};

                              var cancelBtn = buttons.add('button');

                    cancelBtn.text = 'Cancel';

                    cancelBtn.properties = {name: 'cancel'};

          // display dialog and only continues on OK button press (OK = 1, Cancel = 2)

          if (RollPaperDialog.show() == 1) {

                    //variables passed from user interface

                    var res                    = String(RollPaperDialog.PrintResPnl.prtRes.text);

                    var copies          = String(RollPaperDialog.PrintResPnl.imgCpys.text);

                    var pprwidth    = String(RollPaperDialog.PaperSizePnl.pprWth.text);

                    var pprlength   = String(RollPaperDialog.PaperSizePnl.pprLnth.text); if (pprlength=='') { pprlength= 100; }

                    var cellwidth   = String(RollPaperDialog.CellSizePnl.cllWth.text);

                    var cellheight  = String(RollPaperDialog.CellSizePnl.cllHgt.text);

                    var maxpaperwidth=pprwidth*res;                    // Printer Paper width in pixels inches*res 

                    var maxpaperlnth=pprlength*12*res;          // Printer Paper Roll length in pixels

                    var width=cellwidth*res;                    // Document Cell width in pixels inches*res

                    var height=cellheight*res;                    // Document Cell height in pixels inches*res

                    var cols=0;                                        // Document number of columns will be determined by script using paper width and cell width 

                    var rows=0;                                        // Document rows will be determined by script using columns and # of images selected

                    if (width>maxpaperwidth) { throw "error1"; }

                    cols=Math.round((maxpaperwidth/width)-.499); //round down

                    if (height>maxpaperlnth) { throw "error2"; }

                    var file = new Array();

                    file = app.openDialog();//opens dialog,choose images

                    if (file.length<1) { throw "error3"; }

                    rows=Math.round((file.length*copies/cols)+.499); //round up

                    if (height*rows>maxpaperlnth) { throw "error4"; }

                    var doc = app.documents.add(width*cols, height*rows, res);

                    var currrow=0; var pasted=0;

                    for (var i=0;i<file.length;i++) {

                              app.load(file); //load it into documents

                              var backFile= app.activeDocument; //prepare your image layer as active document

                              flatten(); //handle layered images

                              if (backFile.width.value<backFile.height.value&&width>height ) { backFile.rotateCanvas(-90.0);  } // Rotate portraits

                              if (backFile.height.value<backFile.width.value&&height>width ) { backFile.rotateCanvas(-90.0);  } // Rotate landscapes

                              if (backFile.width.value/backFile.height.value > width/height) { backFile.resizeImage(null, height, null, ResampleMethod.BICUBIC); } // wider

                              else {backFile.resizeImage(width, null, null, ResampleMethod.BICUBIC);} // same aspect ratio or taller

                              backFile.selection.selectAll();

                              backFile.selection.copy(); //copy resized image into clipboard

                              backFile.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes

                              for (var n=0;n<copies;n++) {

                                        var x =pasted*width;

                                        var y =currrow*height;

                                        var selectedRegion = Array(Array(x,y), Array(x+width,y), Array(x+width,y+height), Array(x,y+height));

                                        doc.selection.select(selectedRegion);

                                        doc.paste(true); //paste image into masked layer your document

                                        doc.selection.select(selectedRegion);

                                        align('AdCH'); align('AdCV');

                                        doc.selection.deselect();

                                        pasted++

                                        if ( pasted==cols ) { pasted=0; currrow++; }

                                        }

                              }

                    }

          else {

                    //alert('Operation Canceled.');

                    }

          // Return the app preferences

          app.preferences.rulerUnits = startRulerUnits;

          }

catch(err){

          // Return the app preferences

          app.preferences.rulerUnits = startRulerUnits;

          if (err=="error1") {alert("Paper width exceeded reduce the cell width");}

          else if (err=="error2") {alert("Paper roll length exceeded reduce cell height");}

          else if (err=="error3") {alert("No Images Selected");}

          else if (err=="error4") {alert("Paper roll length exceeded try selecting fewer images or reducing cell height");}

          // Lot's of things can go wrong, Give a generic alert and see if they want the details

          else if ( confirm("Sorry, something major happened and I can't continue! Would you like to see more info?" ) ) { alert(err + ': on line ' + err.line ); }

          }

// -----------------------------------------

// flatten Image

// -----------------------------------------

function flatten() {

          try{

                    executeAction( charIDToTypeID( "FltI" ), undefined, DialogModes.NO );

          }catch(e){}

}

// -----------------------------------------

// Align Layers to selection

// -----------------------------------------

function align(method) {

          var desc = new ActionDescriptor();

          var ref = new ActionReference();

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

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

          desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );

          try{

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

          }catch(e){}

}

You can download the other scripts in the paclkage here http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.zip

The other script fail aslo with what looks like the activedocument object get lost in the process. For example:

getlayers.jpg

1333error.jpg

1333code.jpg

Message was edited by: JJMack

JJMack
TOPICS
Actions and scripting
1.5K
Translate
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
Adobe
Community Expert ,
May 16, 2012 May 16, 2012

More information the lost document object error seems to be in the 32Bit version of Photoshop the 64Bit version has no problem running PasteImageRoll.jsx however I stll can not run some of the other scripts in my Photo Collage Toolkit in Photoshop retrieving the users interpolation preference no longer works produces an internal error.  Adobe developement need to do a better job regression testing.

CS6_64BitError.jpg

JJMack
Translate
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 ,
May 18, 2012 May 18, 2012

var userResampleMethod = app.preferences.interpolation;

Only Produces the internal error 1200 when the preference is bicubic automatic which is Photoshop CS6 default setting

JJMack
Translate
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 ,
May 18, 2012 May 18, 2012

try {var userResampleMethod = app.preferences.interpolation;}

catch(e) {var userResampleMethod = null; }

app.preferences.interpolation = ResampleMethod.BILINEAR;          // resample interpolation biliner

if (userResampleMethod != null) { app.preferences.interpolation = userResampleMethod; }

else {app.preferences.interpolation = ResampleMethod.BICUBICAUTOMATIC;}

tried to code around the bug did not work BICUBICAUTOMATIC is missing....

JJMack
Translate
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 ,
May 19, 2012 May 19, 2012
LATEST

After reading about other having problems with old actions where it looks like CS6 looses the current document and that an adobe employee could reproduce the error on a Window but not a Mac and what caused the problem was that the action working too fast.  And that othere found that it only happed when images were edit in Photoshop's a floating window and did not happen in a tabed window.  I changed my preferences to use the tabed widow which I hate for I like draging images to where I can see them and use more the one display. When I run my script in CS6 32Bit Photoshop no longel lost the currend document object only had the interpolation preference problem which can be bypassed by changing your preferences to use some setting other then Adobe's default Bicubic Automatic.  Adobe please fix the bug I hate tabs.....

JJMack
Translate
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