Copy link to clipboard
Copied
with photoshop cc2018
This error is coming out of me
do not get any errors with photoshop cc2014?
how to suppress this error?
Copy link to clipboard
Copied
Make your skript so.
Show an error message.
try {
// you script code here
}
catch(e) { __alert(e); }
function __alert(e)
{
if (e.number != 8007)
{
var fname = File.decode(File(e.fileName).name).toLowerCase();
var func = "";
try {
if ($.stack)
{
var stack = $.stack.split("\n");
func = "Call:\t" + stack[stack.length-3]+"\n\n";
}
}
catch (e) { }
var source = "";
try {
if (e.source)
{
source = e.source.split("\n")[e.line-1];
source = source.replace(/^\s+/g, "");
source = source.replace(/\s+$/g, "");
source += "\n\n";
}
}
catch (e) { }
var msg = e.message + "\n\n";
var dsc = e.description + "\n\n";
if (dsc == msg) dsc = "";
alert("File:\t" + fname + "\n\n" + func + "Line:\t" + e.line + "\n\n" + source + "Error: " + e.number + "\n\n" + msg + dsc, "Bug!", true);
}
}
Copy link to clipboard
Copied
r-bin
the script consists in adapting the form to the immegine
the problem is that if the form does not exist, there is an error
// script
try {
// you script code here
var doc = activeDocument;
doc.activeLayer = doc.layers[0];
var LB = doc.activeLayer.bounds;
var docHeight = doc.height;
var docWidth = doc.width;
if(doc.height>doc.width){
var LHeight = Math.round(LB[3].value) - Math.round(LB[1].value);
var LWidth = Math.round(LB[2].value) - Math.round(LB[0].value);
if(LWidth> LHeight) activeDocument.activeLayer.rotate(90);
LB = doc.activeLayer.bounds;
}
if(doc.height<doc.width){
var LHeight = Math.round(LB[3].value) - Math.round(LB[1].value);
var LWidth = Math.round(LB[2].value) - Math.round(LB[0].value);
if(LWidth<LHeight) activeDocument.activeLayer.rotate(90);
LB = doc.activeLayer.bounds;
}
LHeight = Math.round(LB[3].value) - Math.round(LB[1].value);
LWidth = Math.round(LB[2].value) - Math.round(LB[0].value);
var perWidth = ((docWidth/LWidth)*100);
var perHeight = ((docHeight/LHeight)*100);
doc.activeLayer.resize(perWidth,perHeight,AnchorPosition.MIDDLECENTER);
LB = doc.activeLayer.bounds;
doc.activeLayer.translate((0-LB[0].value),(0-LB[1].value));
}
catch(e) { __alert(e); }
function __alert(e)
{
if (e.number != 8007)
{
var fname = File.decode(File(e.fileName).name).toLowerCase();
var func = "";
try {
if ($.stack)
{
var stack = $.stack.split("\n");
func = "Call:\t" + stack[stack.length-3]+"\n\n";
}
}
catch (e) { }
var source = "";
try {
if (e.source)
{
source = e.source.split("\n")[e.line-1];
source = source.replace(/^\s+/g, "");
source = source.replace(/\s+$/g, "");
source += "\n\n";
}
}
catch (e) { }
var msg = e.message + "\n\n";
var dsc = e.description + "\n\n";
if (dsc == msg) dsc = "";
alert("File:\t" + fname + "\n\n" + func + "Line:\t" + e.line + "\n\n" + source + "Error: " + e.number + "\n\n" + msg + dsc, "Bug!", true);
}
}
Copy link to clipboard
Copied
In the beginning, put
app.displayDialogs = DialogModes.NO;
Copy link to clipboard
Copied
I tried your solution
but photoshop crashes and I have to close it
Copy link to clipboard
Copied
It's strange.
Run this script.
app.displayDialogs = DialogModes.NO;
try
{
var doc = activeDocument;
doc.activeLayer = doc.layers[0];
var LB = doc.activeLayer.bounds;
var docHeight = doc.height;
var docWidth = doc.width;
if(doc.height>doc.width){
var LHeight = Math.round(LB[3].value) - Math.round(LB[1].value);
var LWidth = Math.round(LB[2].value) - Math.round(LB[0].value);
if(LWidth> LHeight) activeDocument.activeLayer.rotate(90);
LB = doc.activeLayer.bounds;
}
if(doc.height<doc.width){
var LHeight = Math.round(LB[3].value) - Math.round(LB[1].value);
var LWidth = Math.round(LB[2].value) - Math.round(LB[0].value);
if(LWidth<LHeight) activeDocument.activeLayer.rotate(90);
LB = doc.activeLayer.bounds;
}
LHeight = Math.round(LB[3].value) - Math.round(LB[1].value);
LWidth = Math.round(LB[2].value) - Math.round(LB[0].value);
var perWidth = ((docWidth/LWidth)*100);
var perHeight = ((docHeight/LHeight)*100);
doc.activeLayer.resize(perWidth,perHeight,AnchorPosition.MIDDLECENTER);
LB = doc.activeLayer.bounds;
doc.activeLayer.translate((0-LB[0].value),(0-LB[1].value));
}
catch(e) { alert(e); }
Show the message.
Show the structure of the layers in the document.
Copy link to clipboard
Copied
I get this error
Copy link to clipboard
Copied
Well, it's all right.
Most likely the crash was caused by the __alert() function on your MAC. I can not check.
Now replace
catch (e) {alert (e); }
to
catch (e) { }
Copy link to clipboard
Copied
I get this error
In this case, was there a crash?
Copy link to clipboard
Copied
r-bin ha scritto
I get this error
In this case, was there a crash?
no I did not have any other mistakes.
anyway
I solved the problem with a stratagem
to work there must be at least two active levels.
Copy link to clipboard
Copied
I get the error as you do and I get the _alert(e) dialog when adding in the .NO option.
No crash.
Can you add in logging of the original layer numbers and what you are sending to resize and transform? Does this crash or hang? Does this happen on all layer dimensions? Which version of Photoshop are you running? 19.1.5? Only Mac has the problem or did you try a windows machine? I'm on windows10 and I also tried my mac with no errors. I just did a new document with a single layer. Unless I run on a background layer I'm not able to reproduce the dialog or get the crash/hang.
I like that _alert message you have made...can I use it in my scripts?
Copy link to clipboard
Copied
Use photoshop cc2018 19.1.5
on machine mac
I have specified that on photoshop cc2014 does not come out any error
r-bin
unfortunately, photoshop crashes
thank you for your time
Copy link to clipboard
Copied
The fact that you do not get errors on CC2014 (CC2018), possibly a bug
Here such code gives two errors in CS6. In CC - silence
app.displayDialogs = DialogModes.NO;
alert(app.activeDocument) // must be error when there are no open documents
x = y // must be error when 'y' not defined
Copy link to clipboard
Copied
Are you sending in the crash dump via the Crash Report Dialog? Are you giving us an email or other way for me to find the crashes? You can send me the email in a private message. Can you attach the file you are using or dimensions of the layer in question?
Copy link to clipboard
Copied
Can you comment on my post #10 please?
Copy link to clipboard
Copied
If you want to crash on CS6-CC2018
Run this script when there are no open documents.
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("document"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("resetDocumentChanged"), d, DialogModes.NO);
Copy link to clipboard
Copied
I've fixed that for a future version of Photoshop. I recommend checking for at least one document before calling that code for Photoshop to avoid the crash. You have any other crashers for me?
Copy link to clipboard
Copied
I'm sorry for little off topic but here's other r-bin find that's not crash but odd behaviour that I can't understand why some Adobe folks consider as normal. For me and him​ it's surely a bug, isn't it in your opinion and shouldn't it be sorted out for next Ps release finaly? Photoshop: Selection modifications after transform | Photoshop Family Customer Community
Copy link to clipboard
Copied
https://forums.adobe.com/people/Tom+Ruark
You have any other crashers for me?
Another crash ))
Close or collapse the Bsuhes panel.
Restart photoshop.
Without opening the Brushes panel, run this script or action which calling the same menu.
runMenuItem(stringIDToTypeID("toggleShowMRUInBrushesPanel"));
PS 19.1.4 Windows x64
Copy link to clipboard
Copied
Fixed, in a future release of Photoshop, for crashing when toggling brush menu in panel. The workaround would be to get the status of the brushes panel and toggle it open first. Then toggle the menu in the panel.
Any more?
Copy link to clipboard
Copied
Are you a crash hunter?
I'm more interested in the usual bugs, because of which I do not use version 19.
Therefore, the crash is caught purely accidentally during the tests.
About checking the status of the Brushes panel Yes, it is possible.
But here too there are very strange results. Most likely also a bug.
Confused "shown" and "visible".
Check.
var r = new ActionReference();
r.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var d = new ActionDescriptor();
d.putReference( charIDToTypeID( "null" ), r );
d.putString (stringIDToTypeID("command"), "getViewInfo");
d.putString (stringIDToTypeID("viewID"), "$bpst" );
d.putString (stringIDToTypeID("panel"), "brushpresets" );
var view = executeAction(stringIDToTypeID("uiInfo"), d, DialogModes.NO).getObjectValue(stringIDToTypeID("view"));
var r = new ActionReference();
r.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("panelList"));
r.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var panel = executeActionGet(r).getList(stringIDToTypeID("panelList")).getObjectValue(28);
alert("view shown: " + view.getBoolean(stringIDToTypeID("shown")) +"\n\n"+
"view visible: " + view.getBoolean(stringIDToTypeID("visible")) +"\n\n\n"+
"panel visible: " + panel.getBoolean(stringIDToTypeID("visible")) +"\n\n"+
"panel obscured: " + panel.getBoolean(stringIDToTypeID("obscured")),
"Brushes")
;
Copy link to clipboard
Copied
Bugs are the same reasons I work in CS6 EXTENDED though I have CC2018.
Copy link to clipboard
Copied
Bugs are why I have CS6, CC 2014 and CC 2018 19.1.5 installed. IMO CS6 and CC 2014 are better then CC 2018 for they have fewer bugs.....
Copy link to clipboard
Copied
https://forums.adobe.com/people/Tom+Ruark
Any more?
I discovered by chance one very unpleasant bug. It is present in CS6 and in CC2018, and most likely in any version.
Suppose someone intends to either accidentally or by mistake create and execute such a script.
var d = ActionDescriptor;
d.putInteger(1, 0);
alert("Haha, I broke the photoshop!");
After that, any scripts, including native Photoshop, including all extensions including the generator, which in the code use new ActionDescriptor() construction, stop working.It helps only to restart Photoshop.
I hope you will tell me what you think about this bug.
Copy link to clipboard
Copied
There are nasty bugs in Photoshop scripting that Adobe does not seem to care to fix whatch out for suspend history and moving when you have an active selection. Photoshop: Script bug resize layer back document up one history state | Photoshop Family Customer Co...