[Gambas-user] .Run() method of DesktopFile Class... How to ?
Benoît Minisini
gambas at ...1...
Thu Jan 9 19:11:37 CET 2014
Le 09/01/2014 14:23, Ru Vuott a écrit :
> Hello,
>
> I wrote this simple code to try DesktopFile.Run() method:
>
> **************************************
> Private pr As Process
>
>
> Public Sub Form_Open()
>
> Dim df As DesktopFile
>
>
> With df = New DesktopFile("/path/of/my/file.wav")
> pr = .Run("totem")
> End With
>
> End
> ************************************
>
> So, I thought that, starting the application, it played also wav file.
> Instead, the application did not played the wav file.
>
> Perhaps the code should be written differently?
>
> Regards
> vuott
>
A desktop file is a file with the *.desktop extension following the
format described on freedesktop.org. A *.wav file is not a desktop file.
Here is what to do:
1) Get the mime type of the file with DesktopMime.FromFile() -> String
2) Get the list of programs that are associated with that file with
DesktopFile.FromMime() -> DesktopFile[].
3) Choose a program among the array of DesktopFile returned by
DesktopFile.FromMime().
4) Run the program with hDesktopFile.Run(sPath).
Otherwise, a faster but less clever way of opening a file is using
Desktop.Open().
Regards,
--
Benoît Minisini
More information about the User
mailing list