-
1. Re: app.refresh bug in CS5???
xbytor2 May 22, 2010 4:27 PM (in response to Max Penson)Try this instead of app.refresh(). If it's using a different underlying mechanism, it may avoid the problem you're seeing.
function waitForRedraw() { function cTID(s) { return app.charIDToTypeID(s); }; var desc = new ActionDescriptor(); desc.putEnumerated(cTID("Stte"), cTID("Stte"), cTID("RdCm")); executeAction(cTID("Wait"), desc, DialogModes.NO); }; -
2. Re: app.refresh bug in CS5???
Max Penson Jun 6, 2010 10:05 PM (in response to xbytor2)Thank you, but it does not help. I've found that if I use executeAction() instead of docRef.activeLayer.mixChannels it works! I seems that I have to use everything with executeAction() for now... not my first choice...
-
3. Re: app.refresh bug in CS5???
Tom Ruark May 25, 2010 8:36 AM (in response to Max Penson)Is this Mac? Win? Both? Can you give me your system info?
-
4. Re: app.refresh bug in CS5???
Max Penson May 25, 2010 10:57 AM (in response to Tom Ruark)Yes. MacBook Pro, Intel Core 2 Duo, 3 GB, Mac OS X 10.6.3 (10D573). Thanks. Haven't tried on PC.
-
5. Re: app.refresh bug in CS5???
Max Penson Jun 6, 2010 9:41 PM (in response to Max Penson)Can someone help me with this?
-
6. Re: app.refresh bug in CS5???
Max Penson Jun 6, 2010 10:05 PM (in response to Max Penson)I've just tested it on Photoshop CS5 PC and it is working fine. This is a Mac issue only... Bug?
-
7. Re: app.refresh bug in CS5???
Michael L Hale Jun 7, 2010 6:04 AM (in response to Max Penson)It sounds to me that the bug is not with app.refresh but istead with the DOM method mixChannels. And that you have already found a workaround of using the Action Manager API.
-
8. Re: app.refresh bug in CS5???
Max Penson Jun 7, 2010 7:41 AM (in response to Michael L Hale)Thank you Michael, I have omitted the fact that I have encountered this issue on a more general function. Under Mac, pressing the test button of this code quickly a few times in a row will crash the script. If you comment out the "var n = docRef.activeLayer.name;" it will work as intended.
#target photoshop app.bringToFront(); var dlg = new Window('dialog', 'Test'); var docRef = app.activeDocument; dlg.b= dlg.add('button', undefined, 'test',{name:'ok'}); dlg.b.onClick = test; dlg.show(); function test() { // comment this to make the script work. var n = docRef.activeLayer.name; waitForRedraw(); } function waitForRedraw() { function cTID(s) { return app.charIDToTypeID(s); }; var desc = new ActionDescriptor(); desc.putEnumerated(cTID("Stte"), cTID("Stte"), cTID("RdCm")); executeAction(cTID("Wait"), desc, DialogModes.NO); }; -
9. Re: app.refresh bug in CS5???
Michael L Hale Jun 7, 2010 8:05 AM (in response to Max Penson)In that case all I can suggest it that you file a bug report if you have not already done so. https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
-
10. Re: app.refresh bug in CS5???
Tom Ruark Jun 7, 2010 11:46 AM (in response to Michael L Hale)I will take a look at the mac crasher but it is a problem on windws and a problem in CS4 as far as I can tell. I would recommend you disable your button so the user can only press it once. Here is a modified script to show more of what is going on. On windows I am getting the script to stop for no apparent reason (the actual reason is a stack overflow). On mac my suspssion is that the stack overflow is crashing us instead of erroring out semi correctly! You can try all combinations of the two flags at the top to see the behavior differences. And you can really see how long waitForRefresh is taking so use it wisely!
// http://forums.adobe.com/message/2873601#2873601 {
#target photoshop
app.bringToFront();try
var buttonDisable = true;
var blockingOn = false;var redraws = 0;
var blocked = 0;
if (documents.length == 0) {
documents.add();
}var dlg = new Window('dialog', 'Test');
var docRef = app.activeDocument;
dlg.b= dlg.add('button', undefined, 'test',{name:'ok'});
dlg.b.onClick = test;
dlg.show();
function test()
{
if (buttonDisable) {
dlg.b.enabled = false;
}
// comment this to make the script work.
var n = docRef.activeLayer.name;
if (blockingOn) {
if ($.stack.search('waitForRedraw()') == -1) {
waitForRedraw();
redraws++;
} else {
blocked++;
}
} else {
waitForRedraw();
redraws++;
}if (buttonDisable) {
dlg.b.enabled = true;
}
}
function waitForRedraw() {
function cTID(s) { return app.charIDToTypeID(s); };
var desc = new ActionDescriptor();
desc.putEnumerated(cTID("Stte"), cTID("Stte"), cTID("RdCm"));
executeAction(cTID("Wait"), desc, DialogModes.NO);
}}
catch(e) {
alert(e + ":" + e.line);
}alert(blocked + ":" + redraws);
-
11. Re: app.refresh bug in CS5???
Chris Cox Jun 7, 2010 1:15 PM (in response to Tom Ruark)A real stack overflow should crash. On Windows, I suspect that some of our last-ditch error handling is just able to recover better.
If it's a stack overflow in JavaScript - that should just return an error.
-
12. Re: app.refresh bug in CS5???
Max Penson Jun 8, 2010 9:05 PM (in response to Tom Ruark)Thank you Tom for the most helpful response. Disabling the button does improve the situation, but is seems that waitForRedraw takes quite a bit longer than I expected, where the button only enabled a few seconds after the "Action" was executed. It does not provide a very good user experience .
Any way to make it work quicker maybe?
-
13. Re: app.refresh bug in CS5???
Tom Ruark Jun 16, 2010 9:52 AM (in response to Max Penson)I don't know of anything that would make it work quicker. Forcing everyone to repaint is going to be slow. Photoshop was designed to run actions as fast as possible. The theory was you are going to run something that you are going to be sipping coffee and reading email while Photoshop is churning in the background and you don't really care about the intermediate steps. Just the end result. Wait for redraw is an attempt to change the design and you are now telling Photoshop, please run slow enough so I can see the intermediate steps. You basically can't have it both ways.





