Calling MMEX from script.

MMEX4Desktop, incl. Windows, macOS (10.10 or newer), and Most Unix variants using the GTK+ toolkit

Moderator: Renato

Post Reply
Sherlok1948
New MMEX User
Posts: 10
Joined: Thu Dec 29, 2011 9:38 pm
Are you a spam bot?: No

Calling MMEX from script.

Post by Sherlok1948 »

Is there a Command Line Interface so that I can start MMEX from  vbscipt with a specified database?
Sherlok1948
New MMEX User
Posts: 10
Joined: Thu Dec 29, 2011 9:38 pm
Are you a spam bot?: No

Re: Calling MMEX from script - SOLVED

Post by Sherlok1948 »

After some hours playing with vbscript, I found this to work:

Set sh=CreateObject("Wscript.Shell")
sh.Run  """C:\Program Files\MoneyManagerEX\bin\mmex.exe"" ""N:\financial\Fred\Financial\Money Manager DB\Fred Money Manager DB.mmb"""

or if the DB is in the same folder as the script and the DB name contains no blank spaces:

Set sh=CreateObject("Wscript.Shell")
sh.Run  """C:\Program Files\MoneyManagerEX\bin\mmex.exe"" DB.mmb"

I hope that this is useful to those looking for answers to the same problem.
Sherlok1948
New MMEX User
Posts: 10
Joined: Thu Dec 29, 2011 9:38 pm
Are you a spam bot?: No

Re: Calling MMEX from script-SOLVED-well, not quite!

Post by Sherlok1948 »

I have the following vbscript (using test folders):

Dim filesys,file1, date1, date2
Set filesys = CreateObject("Scripting.FileSystemObject")
Set file1= filesys.GetFile("Money Manager DB.mmb")
date1 = file1.DateLastModified
Set file1= filesys.GetFile("New folder\Money Manager DB.mmb")
date2 = file1.DateLastModified

If DateDiff("s", date1, date2) > 0 Then
    UserInput = Msgbox("Do you want to update the local MMEX database from the Dropbox?", vbYesNo, "Update from Dropbox?")
    If UserInput = vbYes Then
        filesys.CopyFile "New folder\Money Manager DB.mmb", "Money Manager DB.mmb"
    End If
End If

Set sh=CreateObject("Wscript.Shell")
' sh.Run  """C:\Program Files\MoneyManagerEX\bin\mmex.exe"" ""N:\financial\Fred\Financial\Money Manager DB\Money Manager DB.mmb"""
sh.Run  """C:\Program Files\MoneyManagerEX\bin\mmex.exe"" ""Money Manager DB.mmb"""


When run and MMEX transactions updated, I get the following popup error (from MMEX) on closing the application:

"Failed to copy the file 'Money Manager DB.mmb' to 'Money Manager DB.mmb_update_2015-11-12.mmb (error 2: the system cannot find the file specified)"

There is no such problem when updating this mmb from MMEX when started normally from the desktop icon.

Has anyone else had a similar problem, am I doing anything incorrectly, have I unearthed a bug?
User avatar
GabrieleV
MMEX Developer
Posts: 158
Joined: Wed Apr 09, 2014 7:45 pm
Are you a spam bot?: No
Location: Italy

Re: Calling MMEX from script.

Post by GabrieleV »

Why you don't directly open Dropbox MMB?

Inviato dal mio Nexus 5
Sherlok1948
New MMEX User
Posts: 10
Joined: Thu Dec 29, 2011 9:38 pm
Are you a spam bot?: No

Re: Calling MMEX from script.

Post by Sherlok1948 »

Thanks for the reply GabrieleV.

Not what I want to do. I want to give the user:

1) The option of updating or not updating the local mmb file from the dropbox before invoking MMEX then to

2) Either update or not update the dropbox after udating and closing MMEX,
Post Reply