1. How to associate a file to an bound exe Euphoria program.

I wrote an application in Euphoria for MS Windows using Win32lib and the IDE. It
can load and save files of a particular extension. I would like the ability to
click on one of these saved files and have my program load this file. I already
know how to open and read a file in Euphoria.

What I need is:
1. Access to the code that executes on starting up a Euphoria application.
2. The format of the passed arguments when a user clicks on a file in Windows
and how that is seen in Euphoria.

I guess Derek would know this. And Judith can tell me where in the IDE such code
can be placed.

Andy Katz
B.S. Computer Science, 1978
Rensselaer Polytechnic Institute (RPI)

new topic     » topic index » view message » categorize

2. Re: How to associate a file to an bound exe Euphoria program.

Andrew Katz wrote:
> 
> I wrote an application in Euphoria for MS Windows using Win32lib and the IDE.
> It can load and save files of a particular extension. I would like the ability
> to click on one of these saved files and have my program load this file. I
> already
> know how to open and read a file in Euphoria. 
> 
> What I need is:
> 1. Access to the code that executes on starting up a Euphoria application.
> 2. The format of the passed arguments when a user clicks on a file in Windows
> and how that is seen in Euphoria.
> 
> I guess Derek would know this. And Judith can tell me where in the IDE such
> code can be placed.
> 
> Andy Katz
> B.S. Computer Science, 1978
> Rensselaer Polytechnic Institute (RPI)

Andrew,

Here is what IDE does when the user clicks a file name with .prj extention. Look
in the Eu docs for information about command_line. You also need to have made a
filetype to execution program association in Windows[tm] so clicking the file
knows to start your program. For example C:\Euphoria\BIN\EXW.EXE
C:\EuphoriaMine\IDE\ide.exw %1 will start IDE when filename.prj is clicked.

params = command_line()
        if length(params) > 2 then

            --params might contain valid filename
            params = params[3]

            --get the long name if there is one
            d=dir(params)

            if not atom(d) then
                --find the filename minus path
                for i=length(params) to 1 by -1 do
                    if params[i] = '\\' then
                        params=params[1..i] & d[1][D_NAME]
                        exit
                    end if
                end for
            end if

            if length(params) then
                --read the project
                --open and read file here
            end if
         end if


This code is in the main window w32HActivate event.

Does this answer you question?

judith evans

new topic     » goto parent     » topic index » view message » categorize

3. Re: How to associate a file to an bound exe Euphoria program.

Judith Evans wrote:
> 
> Andrew Katz wrote:
> > 
> > I wrote an application in Euphoria for MS Windows using Win32lib and the
> > IDE.
> > It can load and save files of a particular extension. I would like the
> > ability
> > to click on one of these saved files and have my program load this file. I
> > already
> > know how to open and read a file in Euphoria. 
> > 
> > What I need is:
> > 1. Access to the code that executes on starting up a Euphoria application.
> > 2. The format of the passed arguments when a user clicks on a file in
> > Windows
> > and how that is seen in Euphoria.
> > 
> > I guess Derek would know this. And Judith can tell me where in the IDE such
> > code can be placed.
> > 
> 
> Andrew,
> 
> Here is what IDE does when the user clicks a file name with .prj extention.
> Look in the Eu docs for information about command_line. You also need to have
> made a filetype to execution program association in Windows[tm] so clicking
> the file knows to start your program. For example C:\Euphoria\BIN\EXW.EXE
> C:\EuphoriaMine\IDE\ide.exw
> %1 will start IDE when filename.prj is clicked. 
> 
> params = command_line()
>         if length(params) > 2 then
> 
>             --params might contain valid filename
>             params = params[3]
> 
>             --get the long name if there is one
>             d=dir(params)
> 
>             if not atom(d) then
>                 --find the filename minus path
>                 for i=length(params) to 1 by -1 do
>                     if params[i] = '\\' then
>                         params=params[1..i] & d[1][D_NAME]
>                         exit
>                     end if
>                 end for
>             end if
> 
>             if length(params) then
>                 --read the project
>                 --open and read file here
>             end if
>          end if
> 
> 
> This code is in the main window w32HActivate event.
> 
> Does this answer you question?
> 
> judith evans

Thank you.

Andy Katz
B.S. Computer Science, 1978
Rensselaer Polytechnic Institute (RPI)

new topic     » goto parent     » topic index » view message » categorize

4. Re: How to associate a file to an bound exe Euphoria program.

You can set a filetype association manualy by doing thus;

l-click (open) my computer

select 'folder options' from the 'view' menu  ( alt+v followed by o )
toggle 'file types' tab and select 'new type' ( alt+n )

now edit your filetype.

your installer program should do this automaticly for the user via windows
registry when installing your program on thier computer.

I'm sure someone here knows how to do that.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu