Skip to main content
Inspiring
July 26, 2023
Answered

Auto-Refreshing InDesign Extension?

  • July 26, 2023
  • 2 replies
  • 1723 views

I have an extension installed InDesign that has to be refreshed. The extension is fucntioning normally but part of "normal" requires the user to refresh the extension often.

 

It's annoying. Is there away an extension can be auomated or scripted to refresh automatically??

 

Another isssue is that when ID is in the background (not front most) the extension window disappears. Our normal workflow involved monitioring an email queue that would update on its own (checking for new email every x minutes etc).  Now, if I want to monitor the incoming information, I have to be in ID (front most) and hitting a refresh button every 5 minutes.

 

Can anyone think of some way to automate this perpetual extesnion refresh??

 

Thank you in advance.

 

 

This topic has been closed for replies.
Correct answer Loic.Aigon

sorry for the delayed repsonse, i was out of the office. no plugin (my bad). extension resides in "/Library/Application Support/Adobe/CEP/extensions"


Ok, so you might have a chance. Once an extension is loaded, it becomes…a panel. And panel has a read/write property "visible".

So basically=

 

 

var p = app.panels.itemByName("the name of my panel");

if(p.isValid){

p.visible=!p.visible;

}

 

 

 Now you need an async routine to make the panel open/close. That can be done with a startup script and an idleEvent Handler:

 

#targetengine "session"

main();

function main(){
    var tasks = app.idleTasks;
    var name = "RelaunchPanel";
    var rate = 5000;

    var callback = function(e){
        var p = app.panels.itemByName("test 1");
        if(p.isValid){
            if(p.visible) p.visible = false;
            p.visible = true;
        }
    }

    var t = tasks.itemByName(name);
    if(t.isValid){
        t.eventListeners.everyItem().remove();
        t.remove();
    }
    t = tasks.add({name:name, sleep:rate});
    t.addEventListener(IdleEvent.ON_IDLE, callback, false);
}

 

 

Simply change the panel name, save this snippet as a js(x) file, put it into the startup scripts folder, restart InDesign and you should be fine.

 

Hope that helps,

 

Loic

2 replies

brian_p_dts
Community Expert
Community Expert
July 26, 2023

Without getting into the code, you could probably write an Autohotkey or Applescript to simulate mouseclicks/window activations to handle it. 

Inspiring
July 26, 2023

set a start up script in ID to keep clicking the refresh button on the interface?? not sure how i would go about writting that. i would somehow have to point to the extensions window and indicte refresh and repeat. with a time limit and duration. eh i am not sure what to even call the extensions window lol

brian_p_dts
Community Expert
Community Expert
July 26, 2023

Autohotkey and Applescript are system script writing tools, independent of ID. If the extension window was always in the same location, you can simulate mouseclicks and button presses with those tools, and also make ID active in the window. Learning how to do it in Autohotkey (Windows) or Applescript (Mac) is not all that time-consuming; there's a ton of resources out there. Just trying to provide helpful solutions aside from fiddling with the underlying code. 

Robert at ID-Tasker
Legend
July 26, 2023

What kind of a extension? 

 

Is it plugin, script - or script pretending to be plugin? 

 

Inspiring
July 26, 2023

its a plugin. extension.

 

its an ugly interface window - that displays "job tickets". to see the tickets, the end user has to refresh interface window (button toggle). if the end user isnt in ID and clicking refresh then new tickets arent displayed.

 

once a user assigns a ticket to themselves, the ticket is automatically deleted from the interface window. since there are multiple users viewing the same job tickets, its important to monitor all incoming data and see it  or assign it before it disappears.

 

last time i tried to dig into it looked like it was written in java

Robert at ID-Tasker
Legend
July 26, 2023

Can you show a screenshot ? Are you on a PC or Mac ?

 

Sometimes people use "plugin" to describe something that in fact is still a "script" - just to make it sound better...

 

If it's JavaScript - then it is just a script pretending to be a plugin. Plugins are written in C/C++ - not Java - another kind of programming language - shouldn't be confused with JavaScript...