Skip to main content
Participant
October 29, 2019
Question

Photoshop hangs on return to working state after execution completion of an external exporter plugin

  • October 29, 2019
  • 1 reply
  • 655 views

We have created an external plugin for photoshop to export the details of a design done in photoshop to a format that we require in-order to process them after that. This exporting process time depends on the size of the scene and layers and its details.

While exporting, the UI is updated accordingly to the exporting process. However, we observed a lag of a few seconds in photoshop returning to the usable and user controllable state after the completion of the plugin execution. We have identified that the lag occures after the completion of the process of the plugin and have reasonable facts to make the statement that the said lag is occured not due to the plugin we have exported.

 

Would there be any cause for such a behaviour on photoshop side which might cause this to happen? Any process or procedure that photoshop might follow in-order to return to a controllable state after being utilized through a script? Or, any callback like function that we might need to provide an update to in photoshop to inform the completion of the execution? 

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
October 29, 2019

"You have identified that the lag occures after the completion of the process of the plugin and have reasonable facts to make the statement."  Can you provide the details what is going on what are the facts? You provided no details about your plug-in its design,  its or its operation etc. We do not know if your statement is correct may be it is we have no facts to go on. Have you tried toggling Photoshop UI pallets off while the plug-in runs so Photoshop UI palette elements will not need to be updated the often speeds up processing of Plug-ins and scripts.

 

 

// I use Photoshop UI with Photoshop toolbar and option bar visible and toggle Panel via Shift+Tab
// This Toggle_panels function works like Photoshop's Shift+Tabe shortcut
if (ScriptUI.environment.keyboardState.ctrlKey||ScriptUI.environment.keyboardState.altKey|| ScriptUI.environment.keyboardState.shiftKey) Toggle_panels("Off");
else Toggle_panels("On");

function Toggle_panels(how) {
	if (how=="Off" & panels_visible() ) { 
		togglePalettes(); 
		TglWindowOptions();    
		TglWindowTools();      
		//alert("Palettes were Visible");
		}
	if (how=="On" & !panels_visible() ) { 
		togglePalettes(); 
		}
}

//alert(panels_visible()?"Panels are visible":"Panels are hidden"); 
function panels_visible() { // Thanks r-bin
    try {
		var r = new ActionReference();
        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("panelList"));
        r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
        var list = executeActionGet(r).getList(stringIDToTypeID("panelList"));  
        var viz = false;  
        for (var i = 0; i < list.count; i++) {        
            var obj = list.getObjectValue(i);
            var id = obj.getString(stringIDToTypeID("ID"));
            // skip some panels if shift+tab was pressed
            if (id == "panelid.static.toolbar") continue; // skip tool panel
            if (id == "panelid.static.options") continue; // skip options panel
            if (obj.getBoolean(stringIDToTypeID("visible"))) 
                {
                viz = true;
                break;
                }
            }
        return viz; 
        }
    catch (e) { throw(e); }
}

function TglWindowOptions() {
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(app.charIDToTypeID('Mn  '), app.charIDToTypeID('MnIt'), app.charIDToTypeID('TglO'));
    desc1.putReference(app.charIDToTypeID('null'), ref1);
    executeAction(app.charIDToTypeID('slct'), desc1, DialogModes.NO);
}

function TglWindowTools() {
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(app.charIDToTypeID('Mn  '), app.charIDToTypeID('MnIt'), app.charIDToTypeID('TglT'));
    desc1.putReference(app.charIDToTypeID('null'), ref1);
    executeAction(app.charIDToTypeID('slct'), desc1, DialogModes.NO);
}

 

JJMack
Participating Frequently
October 29, 2019

Shot in the dark: Could it be that the machine is timing out, the software switches to sharing info with Adobe mode (after a pause of whatever time), or otherwise mimicking a sleep mode while the script runs? 

 

 

Participant
November 1, 2019

Thank you chrisl41501719 for your suggestion. However two points you pointed out, machine timing out or mimicking a sleep mode while the script runs are not the reason in this scenario. Could you please be kind enough to give me a tip on what you meant by "software switches to sharing info with Adobe mode" .. Thanks in avance.