Copy link to clipboard
Copied
I'm trying to translate a selection (which is NOT a quadrangle, rather the outline of some text) and I'm getting the following error....
Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- The command "Transform" is not currently available:
Line: 574
-> selRef.translate(1,0);
(It should also be noted that the error message is referring to the "Transform" command rather than "Translate", but I imagine this is because translation is a transformation function.)
Is this actually true that we can't translate selections? Or is my syntax wrong? Is there an alternative way to translate? I've tried changing the bounds, but:
a) It doesn't see to actually move the selection
b) I'm not sure how moving the bounds would effect the selection anyway since it is not a quadrangle, but the outline of the text.
If translate doesn't work, maybe there is a way to nudge it? Although I imagine behind the scenes that is the same operation.
Any wisdom out there?
Copy link to clipboard
Copied
moveSelection(100, -20);
function moveSelection(_x, _y) {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(charIDToTypeID('Chnl'), stringIDToTypeID("selection"));
desc1.putReference(charIDToTypeID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(charIDToTypeID('Hrzn'), charIDToTypeID('#Pxl'), _x);
desc2.putUnitDouble(charIDToTypeID('Vrtc'), charIDToTypeID('#Pxl'), _y);
desc1.putObject(charIDToTypeID('T '), charIDToTypeID('Ofst'), desc2);
executeAction(charIDToTypeID('move'), desc1, DialogModes.NO);
}
Copy link to clipboard
Copied
This works, but is there not a native call? I was really hoping for something that didn't update the history state such as when simply move a selection around using the arrow keys, you get one "Nudge Outline" entry and that's it, rather than a ton of "Move Selection" entries.
Copy link to clipboard
Copied
You can suspend history before using Photoshop features that create history states. Even a native DOM method like Resize would create a history state. Also nudge does create history states. You can easily see how susspend history work in this script.
http://www.mouseprints.net/old/dpr/ToggleCenterGuides.jsx