cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
D_G
D_G
Level II

How to refresh/update (main/jmp) menu on jmp startup?

Hello everyone,

 

currently I'm working on an update function for my addins. I used the following guide as guidance:

How to write self-updating JMP add-ins 

 

Everything works perfectly - but currently I'm struggeling with the next step.
I was wondering if it's possible to dynamicly "toggle" the update button depending if a update is available or not.

 

I tried using the script start-up function found here: 

https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/run-a-script-at-start-up.shtml

 

... to manipulate the addin.jmpcust file. However the menu seems to load before the script is executed - so you need to restart jmp again for seeing the changes.

So my question: Is there a way to refresh/update the main menu, or maybe a better possibility to achieve my goal?

 

Thanks in advance,
DG

 

3 REPLIES 3
jthi
Super User

Re: How to refresh/update (main/jmp) menu on jmp startup?

Not a direct answer to your question, but have you checked out great Add-In-Manager by @Justin_Chilton : Add-In Manager 

 

(You could also take a peek to Add-In-Managers code to see how it handles updating the addins when run)

-Jarmo
txnelson
Super User

Re: How to refresh/update (main/jmp) menu on jmp startup?

I developed a large system of Addins(when I was a worker bee, and not a senior golfer) that automatically kept the Addins updated.  What I found was that copying the JSL etc. into the Addins directory was very fast, and that what I ended up doing, was setting up the Addins to always copy the JSL from the global repository into Addins directory, and then run the JSL.  I did not have to ask the users to reinstall, and the users always had the latest code.  It really simplified the administration.

Jim
D_G
D_G
Level II

Re: How to refresh/update (main/jmp) menu on jmp startup?

Hello everyone,

 

thanks for the feedback. I could not find anything in the Add-In-Manager.
I guess an forced update might be an option - but I'm still trying to create an "variable" Add-In menu item.

 

And I think I found a workaround - if you execute the "addin.def" file within the addin directory, the menu items are updated.

So I created a .jsl file in the addin directory with the following lines:

 

//!
Delete Symbols();
NamesDefaultToHere(1);

PTH_ADDIN = Get Path Variable("ADDIN_HOME(com. ...)");
FN_ADDIN = Convert File Path(PTH_ADDIN  || "addin.def", Windows);

If(File Exists(FN_ADDIN ),
	Open(FN_ADDIN , JMP);
);

With the leading "//!" the script runs on opening.


I now check within my addinLoad.jsl file if/how the menu item should be changed and edit my ".jmpcust" file.
Afterwards I send a CMD to start/execute my .jsl file showed above -> the menu items are getting updated on startup.

 

Maybe there is a better way - however it works (and actually it's pretty fast).

 

BR, DG