[gme-users] How to convert .xme to .mga programmatically?
Larry Howard
howardlp at isis.vanderbilt.edu
Tue May 25 08:03:16 CDT 2004
Below is a Python function that demonstrates both dumping to and loading from xme. As you can see, the MgaDumper and MgaParser are very straightforward.
def PerformUpgrade(path):
import os, os.path, tempfile
tmpdpath = tempfile.mkdtemp()
projectdir = os.path.split(path)[0]
projectfile = os.path.split(path)[1]
newproject = os.path.join(tmpdpath, projectfile)
xmefile = os.path.splitext(projectfile)[0] + '.xme'
xmepath = os.path.join(tmpdpath, xmefile)
import win32com.client
import pythoncom
win32ui.DoWaitCursor(1)
try:
project = win32com.client.DispatchEx("Mga.MgaProject")
project.Open("MGA=" + path)
dumper = win32com.client.DispatchEx("Mga.MgaDumper")
dumper.DumpProject(project, xmepath)
project.Close()
...
project.Create("MGA=" + newproject, "VaNTH")
parser = win32com.client.DispatchEx("Mga.MgaParser")
parser.ParseProject(project, xmepath)
project.Close()
os.rename(path, path+'.orig')
os.rename(newproject, path)
# DisplayMsg("Upgrade successful...")
except:
project.Close()
# DisplayMsg("Upgrading failed...")
----- Original Message -----
From: "Gabriele Trombetti" <gabtromb at isis.vanderbilt.edu>
To: "'A list for GME users to share thoughts and discuss bugs and fixes.'" <gme-users at list.isis.vanderbilt.edu>
Sent: Monday, May 24, 2004 6:26 PM
Subject: [gme-users] How to convert .xme to .mga programmatically?
> I need to convert an .xme file to the .mga format from a standalone
> program, in a no-user-prompt way. (I know which is the paradigm)
> Is it possible in any way?
>
> Thanks in advance
> Gabriele
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20040525/6cdfa772/attachment.htm
More information about the gme-users
mailing list