Has anyone already tried to set a web site post-generation script with a Java macro? Is it possible at all?
In my environment (Mega 2009 SP5) the VB macro as post generation script works fine, but not the java one.
Solved! Go to Solution.
Only VB script macros have been qualified for post generation of a web site
Java macro have not been qualified.
If this is an issue for you we can consider this support (use java macro for post processing web sites) for the next CP of MEGA 2009 SP5. It is planned mid october 2012.
Tell us if you are interested.
Thanks for your reply. It's still an issue for us and will be nice to have this feature with the next CP.
This ID: CR 31538 will enable to follow this issue
We will keep you informed.
Can you add attachments regarding you case your case (screen error, MEGA error log, java code of the macro) to this topic. This will enable us to check if your macro can run after CP change.
Due to the API, it's possible to call a VB Script macro from your Java code. Indeed, if your VB macro for website post-generation is working, you can use the following code to use it from your Java code :
/* root is a MegaRoot object * MyMacro_identifier is the identifier ~AbsId[Short Name] */ MegaRoot myMacro = root.currentEnvironment().getMacro("MyVBMacro_identifier"); myMacro.callMethod("Name_of_my_sub","args");
If you the method you want to call in your VB macro is a sub, use callMethod. If it's a function, use callFunction.
Please, refer to the Javadoc of mj_api.jar, under MegaCurrentEnvironment for more information about getMacro function.
I hope it helps.
Thanks for your reply. Unfortunately, it isn’t the solution for my problem. My script is implemented in Java, configured as a Java macro. I simply miss the feature to use this macro as a post-generation script for my website.
I attach my simple Java macro and a screen shot of my settings.
I'm sorry that it doesn't help you.
I think there is no other option for your problem than following the case openend by Jérôme.
How is this correct?
MegaRoot myMacro = root.currentEnvironment().getMacro("MyVBMacro_identifier");
You are calling get macro without a cast to the MegaRoot object. In Java this does not work.