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

How to call Hopex Function using VB Script from Windows?

ryand
Senior Member

Hello, I have created VBscript that called Hopex function (such as: GetCollection, GetSelection, etc.), currently it run from Hopex Script Editor. How to make the VBS to be executable from Windows or run it from Windows Job Scheduler? 


Thank you in advance.

Andry

 

1 Reply

ikn
Retired

Hello, 

you can use the following sample script to create VBS file to be used with windows scheduler. You can also use following documentation links as reference 

  1. https://doc.mega.com/hopex-v3-en/#page/MTS2/API/All_about_starting_with_APIs.Communication_between_H...
  2. https://doc.mega.com/hopex-v3-en/#page/MTS2/API/All_about_starting_with_APIs.Administration_of_HOPEX...
‘Start of the application

Dim myApp, myEnv, myBase, myMegaRoot, oWS

    Set myApp = CreateObject("Mega.Application")

    Set myEnv = myApp.Environments.Item(ENVPATH)

    myEnv.CurrentAdministrator = USERNAME

    If PASSWORD <> "" Then

      myEnv.CurrentPASSWORD = PASSWORD

    End If

    Set myBase = myEnv.Databases.Item(REPOSITORY)

     Set myMegaRoot = myBase.Open



‘Code to generate files



myMegaRoot.callMethod ……



‘End of the Application

set myMegaRoot = nothing

set myEnv = nothing

set myApp = nothing