04-07-2012 03:37 PM
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
Solved! Go to Solution.
05-07-2012 04:14 PM - edited 05-07-2012 04:36 PM
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
05-07-2012 04:12 PM
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
05-07-2012 04:03 PM
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.
05-07-2012 03:56 PM
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 :
Is there a way to avoid this window and manage this error as I want in VB ?
Thanks !
05-07-2012 10:38 AM
Thanks !!!
04-07-2012 04:21 PM
Hello,
if your code is external to MEGA you have two options:
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.