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

Batch Action Stopped unintended when transform selection has no change

Explorer ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

Hi,

i tried to make an action :

1...

2...

3. Transform selection with "Dialog", Where i can make selection myself.

4...

5...

Everything seem working fine when i make some change on transform selection. But when there is NO change, the script stopped unintended.

How can i solve this ?

TOPICS
Actions and scripting

Views

1.0K

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

Community Expert , Jan 11, 2019 Jan 11, 2019

It actually may not be a  bug if the transform selection is not changed enter cancels the transforn Selection.

The way I have always coded around this is to always  have the transform make a change. What? I simply record the interactive transform selection rotated 180 degrees.  The rotated selection is identical the the non rotated selection.  If the user hits enter to commit the transform the identical 180 degree selection is committed and the action continues the transform is not canceled.  The

...

Votes

Translate

Translate
Adobe
LEGEND ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

$.level = 0; try{/*code for transformation*/}catch(err){}

You may also do it without try...catch statement by adding to your transformation code the part that I guess is missing:

dsc = new ActionDescriptor()

dsc.putUnitDouble(stringIDToTypeID('width'), stringIDToTypeID('percentUnit'), 100.000001)

dsc.putUnitDouble(stringIDToTypeID('height'), stringIDToTypeID('percentUnit'), 100.000001)

Note that dsc is the same you use in last line of your code before DialogModes.ALL, so you must change it to proper one.

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
Explorer ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

Hi Kukurykus,

I am new on this so my question is how i can edit those codes?

Actually, i record action and then use File => automate => batch => with action recorded.

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
LEGEND ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

Save it as "Transform Selection.jsx" (with Notepad incl. double quotion marks) to 'Presets/Scripts' folder of your Photoshop.

sTT = stringIDToTypeID

ref = new ActionReference(), dsc1 = new ActionDescriptor(), dsc2 = new ActionDescriptor()

ref.putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum')), dsc1.putReference(sTT('null'), ref)

dsc1.putEnumerated(sTT('freeTransformCenterState'), sTT('quadCenterState'), sTT('QCSAverage'))

dsc2.putUnitDouble(sTT('horizontal'), sTT('pixelsUnit'), 0), dsc2.putUnitDouble(sTT('vertical'), sTT('pixelsUnit'), 0)

dsc1.putUnitDouble(sTT('width'), sTT('percentUnit'), t = 100.000001), dsc1.putUnitDouble(sTT('height'), sTT('percentUnit'), t)

dsc1.putEnumerated(sTT('interfaceIconFrameDimmed'), sTT('interpolationType'), sTT('bicubic'))

dsc1.putObject(sTT('offset'), sTT('offset'), dsc2), executeAction(sTT('transform'), dsc1, DialogModes.ALL)

Then relaunch Ps and instead of 'Transform Selection' step choose from dropdown Action panel menu 'Select Item' and then from 'File / Scripts' choose 'Transform Selection' item. Now this way 'Transform Selection' doesn't have to be made.

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
People's Champ ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

This is similar to the bug in many versions of CC (in 2018 there is exactly).

Instead of calling the menu, use the transform command with small parameters, for example, 100.01%

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
LEGEND ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

Actually that can be done by sole actions which I don't use from long, but now I remember I had the same problem I solved by recording minimal transformation that did not affect anything when I applied trasnsformation without transofrmation. So yes, it needs only to choose during transformation in upper bar 1/10 higher percent for width and height.

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
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

It actually may not be a  bug if the transform selection is not changed enter cancels the transforn Selection.

The way I have always coded around this is to always  have the transform make a change. What? I simply record the interactive transform selection rotated 180 degrees.  The rotated selection is identical the the non rotated selection.  If the user hits enter to commit the transform the identical 180 degree selection is committed and the action continues the transform is not canceled.  The user must hit ESC to cancel the transform to stop the action. The user can then hit Play to retry doing the 180rotated transform selection again.

JJMack

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
LEGEND ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

Nice workaround!

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
People's Champ ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

How to be in this case?

Untitled-2.png

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
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

Rotate: 0° + H Skew: 180° … or ... Rotate: 0° + V Skew: 180° ... or ... Rotate: 0° + H Skew: 180° V Skew: 180° ?

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
People's Champ ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

In this case, the selection also changes due to the inaccuracy of Photoshop.

He writes something like this into Action.

var d = new ActionDescriptor();

var r = new ActionReference();

r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));

d.putReference(stringIDToTypeID("null"), r);

d.putEnumerated(stringIDToTypeID("freeTransformCenterState"), stringIDToTypeID("quadCenterState"), stringIDToTypeID("QCSAverage"));

var d1 = new ActionDescriptor();

d1.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("percentUnit"), -2.96059473233375e-15);

d1.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("percentUnit"), 0);

d.putObject(stringIDToTypeID("offset"), stringIDToTypeID("offset"), d1);

d.putEnumerated(charIDToTypeID("Intr"), stringIDToTypeID("interpolationType"), stringIDToTypeID("bicubic"));

executeAction(stringIDToTypeID("transform"), d, DialogModes.NO);

This is equivalent to the minimal transformation. But also does not always work on CC.

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
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

If the selection is not semertric I would create the pototype selection off a bit and rotate it a small amount in the interactive transform selection step. However I have only use this in aspect ratio cropping and  framing  actions.  My selections were always rectangular.

JJMack

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
Community Expert ,
Jan 11, 2019 Jan 11, 2019

Copy link to clipboard

Copied

It was never a problem for me in a script I only needed a work around in Actions.

try{

    //doAction("Interactive Transform", "Actions for Scripts"); // Let the user have the final word

    InteractiveTransform()

   }

catch(e){alert("Image Transform Canceled");}

try{

  //doAction("Interactive Transform", "Actions for Scripts"); // Let user have last say

  InteractiveTransform()

}

catch(e){}

//==================== Interactive Transform ==============

function InteractiveTransform() {

  // Menu Edit>Free transform

    var desc1 = new ActionDescriptor();

    var ref1 = new ActionReference();

    ref1.putEnumerated(cTID('Mn  '), cTID('MnIt'), cTID('FrTr'));

    desc1.putReference(cTID('null'), ref1);

    executeAction(cTID('slct'), desc1, DialogModes.NO);

};

JJMack

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
Explorer ,
Jan 14, 2019 Jan 14, 2019

Copy link to clipboard

Copied

LATEST

Thanks JJMack, your solution 180degree rotation solve my problem. I usually use rectange selection.

Thanks Kukury and r-bin.

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