[wxpython-users] Re: MIME Types, MS Word and DDE...
Sebastian Żurek
sebzur at gmail.com
Wed Apr 23 17:36:08 PDT 2008
Robin Dunn pisze:
> Quoting Sebastian ?urek <sebzur at gmail.com>:
>
>> Hi,
>>
>>
>> I've met a serious problem... I've got a very simple file manager
>> in my
>> application. I need to open the files with command returned by the
>> GetOpenCommand method, namely:
>>
>> def OpenFile(self,name,ext):
>> ft= wx.TheMimeTypesManager.GetFileTypeFromExtension(ext)
>> filename = name + "." + ext
>> mime = ft.GetMimeType() or ""
>> fullpath=os.path.join(self.path,filename)
>> cmd = ft.GetOpenCommand(fullpath, mime)
>> subprocess.Popen(cmd,shell=True)
>>
>> But... There's a problem with WinWord - the command returned by
>> GetOpenCommand starts with WX_DDE and the WinWord uses a DDE to load a
>> file. This is a source of my problem. Will I have to use something like
>> win32com to handle this, or maybe there's some solution within wx.DDE*
>> classes? I'm quite a newbie to the 'dde' (in fact, that's my very first
>> time with it) and I'm not sure how to handle this... And does the
>> WX_DDE# prefix inform me, that I shoud use some 'dde techniques' to open
>> the file?
>
> IIRC, wx.Execute should recognize the WX_DDE prefix and do the right thing.
>
>
Robin, YOU ARE GREAT! Thanks - that works perfectly. I've also tried
os.startfile with cmd striped out of WX_DDE# prefix, which works fine
but that's very particular and a dirty solution (and works only under
Windows).
wx.Execute do the right thing.
Thanks
More information about the wxpython-users
mailing list