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

Run external API in "silent mode"

lionel
MEGA
MEGA

Hello everybody,

 

I have a vb6 program that I must run in batch mode. What should I do to prevent MEGA windows to appear (for example when trying to connect to MEGA and when a MEGA session is already launched) and have error message instead (i.e. run it in batch mode).

 

Thank you for your help !

 

Lionel

6 Replies

Jérôme,

 

as it is my code that runs MEGA, I do not have CurrentEnvironment (and therfore no access to the "IsSessionOpen".)

I tried with "IsAccessible" but it does not work.

As Claudio said, I think there is no solution (I could analyse Window's processes, but since MEGA is ran on a CITRIX server, it's a little bit complicated 😞 )

 

Thanks to both of you for your help !

 

Lionel

 

 

Hello Lionel

 

There is an attribute IsSessionOpen for an object MegaCurrentEnv

It can help you detect if the the MEGA application is active for a given environment

Jerome

Hello Lionel,

 

the error you're having is because you're trying to run an external script on the same machine with the same user on the same repository, while MEGA is already running.

 

This is simply not possible, and cannot be avoided the msgbox because is not generated by the running MEGA but by the connction phase of you external code.

 

Claudio Pucci

Hello Claudio,

 

It does not work for me because my problem is to manage connection problems (and you seem to say that it works only once connected).

Here is my code :

    Dim oMegaApp As New MegaApplication
    
    'The line I've added
    oMegaApp.Toolkit.SetInteractiveMode ("Batch")

    Set oEnvironnement = oMegaApp.Environments.item(myenv)
    oEnvironnement.CurrentAdministrator = user
    oEnvironnement.CurrentPassword = password
    Set oDatabases = oEnvironnement.Databases
    Set oDatabase = oDatabases.item(base)
    Set Connect2MEGA = oDatabase.Open

 

and despite the modification I made according to your advice, here is what happen (and what I want to avoid) when running my code while a MEGA Session is already running :

 

image1.jpg

 

Is there a way to avoid this window and manage this error as I want in VB ?

 

Thanks !

 

 

Thanks !!!Man Happy

cpucci
MEGA
MEGA

Hello,

 

if your code is external to MEGA you have two options:

  1. your code run MEGA
  2. your code attach itself to an existing MEGA

In the first case you have to specify an user and a password to avoid the Login window (you cannot use CurrentEnvironment for instance), once connected plese use

MegaToolKit.SetInteractiveMode("Batch")

to avoid ANY further popup or window

 

In second case you have to set a token (a value) inside the running instance MEGA by calling the

currentEnvironment.setOpenToken("EnableExternalOpen")

then in your external script you can get the currentEnvironement without the warning connection message.

You can then set MegaToolKit.SetInteractiveMode("Batch") to avoid other windows, also the MsgBox.

 

The MegaToolkit has to be got, how to get it depends on how you get the MegaRoot.

 

Claudio Pucci