Skip to main content
Adobe Photoshop Family

186 Messages

 • 

3.6K Points

Thu, Feb 9, 2017 9:52 AM

Answered

Bridge: Document loaded event + handled:true = can't close bridge

Using Bridge 2017 version 7.0.0.93 on windows7, I have some code in a Document loaded event.It works as expected both ways:
    1. when handled:false
    2. when handled:true
   
What is the problem then?
When handled:false, there is no problem.
When handled:true, the listener event works and triggers my code, but when I try to close Bridge, it simply doesn't close. I must force closing it on windows.
Can any one help me?
 
Here is the code:
 
thumbsLoaded_RECURSIVE = function( event ) {  
    // IMPORTANTE: $.hiresTimer > 180000 this triggers only once when the cache folder has been already built  previously  
    if ( event.object instanceof Document && event.type == 'loaded' && $.hiresTimer > 180000) {  
        alert("trigered " + new Date().getTime() + " miliseconds");  
        // ([my code...])  
        // handled:false  > it only triggers when the active folder changes  
        // handled:true  > it  triggers when:  the active folder changes + add files/folders , when mannually reorders the 1st time mannually (invisivel .bridgesort) + when refreshes F5  
    } return {  
        handled:true;  
    }  
}  
app.eventHandlers.push( {handler: thumbsLoaded_RECURSIVE} ); 

Responses

361 Messages

 • 

6.9K Points

4 years ago

Your code give an error in ExtendScript, this works for me Pedro.
thumbsLoaded_RECURSIVE = function( event ) { 
    // IMPORTANTE: $.hiresTimer > 180000 this triggers only once when the cache folder has been already built  previously 
    if ( event.object instanceof Document && event.type == 'loaded' && $.hiresTimer > 180000) { 
        alert(" trigered " + new Date().getTime() + " miliseconds"); 
        // ([my code...]) 
        // handled:false  > it only triggers when the active folder changes 
        // handled:true  > it  triggers when:  the active folder changes + add files/folders , when mannually reorders the 1st time mannually (invisivel .bridgesort) + when refreshes F5 
     return } 
        handled:true; 

app.eventHandlers.push( {handler: thumbsLoaded_RECURSIVE} ); 

186 Messages

 • 

3.6K Points

Thank you Paul!

186 Messages

 • 

3.6K Points

Hi Paul

In fact, the return must be inside the filter if(event.object....
Mine was outside.
Here is the correct code:

var thumbsLoaded_RECURSIVE = function( event ) {
    if (event.object instanceof Document && event.type == 'loaded' && $.hiresTimer > 180000) {
        //
        $.writeln("Triggered !");
        //
        return {handled:true};  
    }
    // the return was here before
}  
app.eventHandlers.push( {handler: thumbsLoaded_RECURSIVE} ); 

3 Messages

 • 

110 Points

3 years ago

Thanks for answering this, Paul.  I was having the same problem.