Skip to main content
Inspiring
June 17, 2014
Answered

Call a method on InDesign Startup Complete, how?

  • June 17, 2014
  • 2 replies
  • 712 views

Hi!

I haven't found anything in the documentation regarding this problem that I want to solve. Basically I need to call a method after InDesign has finished starting up and all the UI elements are ready.

I've looked into IStartupShutdownService, but this calls my method way too early when not all UI elements have been set up and thus results in a null pointer access. I'm pretty sure I can't use CmdUtils::CreateCommand either since I only need InDesign to call a method and not change anything regarding the document or model.

A second option would be for me to find out if my plugin's panel is visible after InDesign startup has completed and if it is visible then perform this method call.

This topic has been closed for replies.
Correct answer Norio Kawamura

I am using myIdleTask:CIdleTask AddIn kSessionBoss.

I can get the first call of RunTask() as Complete Startup.

Refer to sdksamples/paneltreeview/PnlTrvIdleTask.cpp.

2 replies

Inspiring
June 18, 2014

This thread had  a similar issue. I suggested using  kLazyStartupShutdownProviderImpl for IID_IK2SERVICEPROVIDER. May be you won't need to implement IdleTask at all.

Inspiring
June 23, 2014

Thanks for your answer maddy1907. I had already implemented an IdleTask and I needed continuous updates to my UI anyways, otherwise I would have probably chosen your method.

Bartek_Kropaczewski
Inspiring
June 17, 2014

Hi Bernd

1. Have you tried IApplication::kRunning in IStartupShutdownService?

        InterfacePtr<IApplication> iApp(iSession->QueryApplication());

        if (!iApp) break;    

        if (iApp->GetApplicationState() == IApplication::kRunning)

         {

          // your code here

          }

2. What about adding observer to your panel or add your own implementation of IControlView from your panel?

Regards

Bartek

Inspiring
June 17, 2014

Hi Bartek!

Thanks for your answer!

1. I tried it just now. My own code does not execute because the ApplicationState is not kRunning at the time this code segment is called.

I think that I will need to add an observer to the panel. Do you know if the Update on the observer is called upon Startup Complete?

Norio KawamuraCorrect answer
Inspiring
June 18, 2014

I am using myIdleTask:CIdleTask AddIn kSessionBoss.

I can get the first call of RunTask() as Complete Startup.

Refer to sdksamples/paneltreeview/PnlTrvIdleTask.cpp.