Open files with double click

It's in sys.argv. Here's the basic scheme.

    C:\Dev\usbio>assoc .py
    .py=Python.File

    C:\Dev\usbio>ftype python.file
    python.file=C:\Apps\Python23\python.exe "%1" %*

That first line says that files with a ".py" extension are associated with the file type "python.file". The second line says that the "open" action when a file of type "python.file" is double-clicked is to run the command line shown. The "%1" in that string will be replaced by the name of the file that was double-clicked.

Note that, if you do not have a %1 in the string, there is no way for you to learn the file name.

···

On Tue, 8 Feb 2005 19:33:29 -0600, brian christensen <brianzz@earthlink.net> wrote:

I have been able to tell Windows and the Mac to open the application when its data file is double clicked, but what do you have to do in the application to recognized that it is being started by double clicking a data file? Where do you find the name(s) of the file(s) that were double clicked? Is there a wxWidgets function for that? Or do you use Python?

--
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.

>I have been able to tell Windows and the Mac to open the application
>when its data file is double clicked, but what do you have to do in the
>application to recognized that it is being started by double clicking a
>data file? Where do you find the name(s) of the file(s) that were
>double clicked? Is there a wxWidgets function for that? Or do you use
>Python?

It's in sys.argv. Here's the basic scheme.

   C:\Dev\usbio>assoc .py
   .py=Python.File

Does that command create an association or merely show you an
existing one?

   C:\Dev\usbio>ftype python.file
   python.file=C:\Apps\Python23\python.exe "%1" %*

Same question.

That first line says that files with a ".py" extension are associated
with the file type "python.file". The second line says that the "open"
action when a file of type "python.file" is double-clicked is to run the
command line shown. The "%1" in that string will be replaced by the
name of the file that was double-clicked.

But that doesn't really do what he OP asked. Let's say he
wants to run "myWxProgram.py" for all files with a suffix of
".foo". He'd have to do something like

  C:\Dev\usbio>assoc .foo
  .foo=Foo.File

  C:\Dev\usbio>ftype foo.file
  python.file=C:\Apps\Python23\python.exe C:\path\to\myWxProgram.py "%1" %*

[I don't really do windows, so I'm extrapolating based on the
assumption your basic methodology is correct.]

···

On Thu, Feb 10, 2005 at 09:33:30AM -0800, Tim Roberts wrote:
  
--
Grant Edwards
grante@visi.com