If I subscribe for CSXSInterface, I am able to access the activeDocument property of the com.adobe.photoshop.Application object, but the event comes in before the active document has changed, not after, so I cannot find out which document was selected.
If I try to use extendScript to access Photoshop DOM inside an event handler, I get the following error: “Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.”.
Your timing is impeccable. We have managed to come up with a viable workaround for the PS Mac event issue. We literally have it ready as of today.
I have attached both an SWC that contains the workaround and a sample project to show you how to use it.
There are a couple of caveats -
The sample project should be enough to show you how to use it.
Feel free to post questions as they come up.
Thanks a lot for this workaround.
It seems to work, so thank you very much!
The only problem I've found so far - the second approach (with PsEventScrubber.getInstance().forceClean(...)) only works once.
If I try to handle the same event twice using forceClean, I get the same "General Photoshop error occurred. This functionality may not be available in this version of Photoshop." error as before.
To reproduce the problem, you can just invoke the timer in the secondDemo function twice:
public function secondDemo( evt: TimerEvent ): void
//instead of invoking the timer below just once, try to invoke it twice
var timer: Timer = new Timer( 1000, 2);
timer.addEventListener( TimerEvent.TIMER, secondHandler );
trace( "timer started for second demo" );
Do I need to call some cleanup code after I use forceClean?
However the first approach seems to work fine.
Also, will it be possible for you to briefly explain what PsEventScrubber library does?
Thank you once again,
Your post confused me as I was seeing nothing like that here. I had a "versioning problem". The code on my Mac (where I did most of the testing) had one more (very important) line of code. Sorry. The attached library should fix the problem you're having with forceClean.
As for what the workaround does:
Ps DOM calls worked just fine when called from the context of a UI event. The only issue was when the event was a system-type event. What we were looking for was a way to end the event chain of the system event and yet continue executing the handler.
Early on we found that you could execute a script using CSXSInterface.getInstance().evalScript - and that script could call PS DOM functions.
The happy thought was to call into evalScript, to a script that used a HostObject to call back to ActionScript.
Europe, Middle East and Africa