cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic generation of websites

abayl
Contributor

Hello,

 

Is it possible to start a web site generation with a script? We want a current status of repository every day. That's why that a script should start the generation over night.

 

It would be nice if somebody could help me.

 

Thank you

7 Replies

ki6i
Trusted Contributor

If you run ti as a bash script there is a background process mgwapp.exe opening and if you haven't close all other instances on the machine it won't run

 

Here is example of how you can open connection to the repository

 

Set oMegaApp = CreateObject ("Mega.Application")
Set oEnvironment = oMegaApp.Environments.Item(myEnvironment)
oEnvironment.CurrentAdministrator = myAdministrator
myEnv.CurrentPassword = myPassword
Set myDatabase = oEnvironment.Databases.Item(myDatabase)
Set oMegaRoot = myDatabase.Open

 

There is not any MegaApplication in background.

Here is the code which I use:

 

Resolution:

Code examples 
This is the core of the code triggering the web site generation.

Trigger web site generation (VB script):
'Get a web site oWebsite
Set lWebSites = GetCollection("Web Site") 
Set oWebSite = lWebSites.Item(1)

'Generate the web site oWebsite
oWebSite.GenerateWebSite()

Display the list of root objects (VB script tested for MEGA 2005):
'Get a web site oWebsite
Set lWebSites=GetCollection("Web Site")
Set oWebSite = lWebSite.Item(1)    

'Get the collection root objects of the web site oWebsite
Set oWebSiteDescription = oWebSite.WebSiteDescription
Set lWebSiteScope = oWebSiteDescription.GetRootObjects

but there have to be one or more steps before, that start the MegaApplication. Windows don't know this commands.

 

 

regards

ki6i
Trusted Contributor

By my experience so far:

 

1. The api is starting MegaApplication process in the background so if you have opened Mega it won't be able to start the process at all.

2. If you have another 'gost' or working Mega processes locking the database the script won't be able to open it

abayl
Contributor

Hello,

 

thx for solutions.

Code of the solution: http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqRmAAI

starts to trigger the generation of Websites.

I think i need to start Mega in script before. How can I do that?

 

regards

SVanSchoonlandt
Honored Contributor

 

The API manual mentions that the possibiltiies of vb are also available in java. I would say yes it is possible therefore

 

regards

ki6i
Trusted Contributor

Is there a possibilit to do it in Java?

selhatimi
MEGA
MEGA

Hello

 

You can built a script that can do this task and then add this script on the scheduler of Windows
 
For more information please see the solutions below:

 

- http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqRmAAI

 

- http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqz2AAA

 

 

Sami