cancel
Showing results for 
Search instead for 
Did you mean: 

Website post-generation script with Java macro

Solved
Highlighted
New Contributor

Website post-generation script with Java macro

Hi,

 

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.

 

Regards

8 Replies
MEGA

Re: Website post-generation script with Java macro

Hello wbashirazad

 

Only VB script macros have been qualified for post generation of a web site

Java macro have not been qualified.

 

Jerome
MEGA

Re: Website post-generation script with Java macro

Hello again

 

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.

Jerome
New Contributor

Re: Website post-generation script with Java macro

 

Hi Jerome,

 

Thanks for your reply. It's still an issue for us and will be nice to have this feature with the next CP.

 

Best regards

Wahid

MEGA

Re: Website post-generation script with Java macro

Hello Wahid

 

OK.

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.

Jerome
Contributor

Re: Website post-generation script with Java macro

Hi, 

 

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.

 

Regards,

 

 



Patrick Bobo
New Contributor

Re: Website post-generation script with Java macro

Hi Patrick,

 

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.

 

Regards  

Wahid Bashirazad

Contributor

Re: Website post-generation script with Java macro

Hi Wahid, 

 

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. 

 

Regards



Patrick Bobo
Contributor

Re: Website post-generation script with Java macro

How is this correct?

MegaRoot myMacro = root.currentEnvironment().getMacro("MyVBMacro_iden​tifier");
myMacro.callMethod("Name_of_my_sub","args");

 

You are calling get macro without a cast to the MegaRoot object.  In Java this does not work.