[Gambas-user] File extensions
Willy Raets
willy at ...2734...
Fri May 17 19:58:23 CEST 2013
On Fri, 2013-05-17 at 08:38 +0930, Bruce wrote:
> On Thu, 2013-05-16 at 17:39 +0200, Willy Raets wrote:
> > Hi all,
> >
> > I'm trying to achieve something but have no idea even where to start
> > looking.
> >
> > Let's say I have a gambas3 application named MyFileMaker
> >
> > The application MyFileMaker saves files with extension .myfile
> >
> > What I want to achieve is when double clicking a .myfile for application
> > MyFileMaker to open with the double clicked .myfile
> >
> > 1. How does my application know it is opened because a .myfile was
> > double clicked instead of opened from menu as usual as it has to act
> > differently?
> > 2. How does the system know that a .myfile needs to be opened with
> > MyFileMaker?
> > 3. How do I give the .myfile their own icon, meaning how does the system
> > know that when there is a .myfile it has to use an icon I provided?
> >
> > This all needs to work when a end user installs MyFileMaker, so:
> >
> > 4. What do I need to do when making a package. Are there any options
> > that need to be set in the packaging wizard and how do they need to be
> > set?
> >
> > Any hint or link to more information would be welcome.
> >
>
> 2. This is entirely dependent on the end users desktop manager (or the
> file manager application if the clicking was done in there.) Clicking
> on a desktop icon uses the DM "launcher" service to activate the default
> "Open with" use case.
> 3. Again, depends on the DM in use. For example, LXDE uses mimetypes to
> determine the icon for the file when it is on the desktop (and in the
> file manager).
> 1. No idea.
Public OpenProjectPath As String
Public OpenByArgs As String
Public Sub Main()
Dim sArgsString As String
Args.Begin(Application.Name & " <options>")
Args.End()
For Each sArgsString In Args.End()
If Not IsNull(sArgsString) Then
OpenProjectPath = sArgsString
OpenByArgs = True
Endif
Next
FMain.Show
End
That is how I did it thanks to the hint of Fabien.
> 4. I can think of several ways that this could be done, none of them
> easy. I don't know for sure but maybe some sort of post install script
> that creates the correct mimetype infrastrucure, depending on the
> deployment DM might be an idea.
Check Benoîts suggestion and my answer to see it actually isn't that
hard:-)
>
> cheers
> Bruce
>
Thanks.
--
Kind regards,
Willy (aka gbWilly)
http://gambasshowcase.org/
http://howtogambas.org
http://gambos.org
More information about the User
mailing list