4 Replies Latest reply on Feb 5, 2014 6:34 AM by Nando Darder Mallorca

    associate a file extension with my executable, how to receive filename?

    Nando Darder Mallorca Level 1
      Hi
      I'm using flaslh profresional to create this application:   Edit_epl.exe

       

      I install the application.

       

      I make a file association extension because I want to do this:  when double-click on a file with the extension ".elp" then runs Edit_epl.exe.

       

         example doubleclick on:  "my_sample.epl"  ---> then runs Edit_eplp.exe.   so far,so good.  

       

       

      My question is how to know its filename (my_sample.epl) as "parameter" inside "Edit_eplp.exe"

       

       

      Can anyone help me?

       

      Thanks

        • 2. Re: associate a file extension with my executable, how to receive filename?
          Nando Darder Mallorca Level 1

          Hello, Thank you!

           

          but I don want to do what this example do: 

           

          The following code lets the user navigate to an MP3 file and open it in the default application for playing MP3 files.

           

           

           

          What I want is:

           

          (I change the example:)

           

          I want to click on a textFile  for example  hello.txt, with the content:   "My name is Fernando"

           

           

          1 - create an application   My_edit_txt.exe   (with only one text_field, MY TEXT)

          2 - install the application.

          3-  associate the extension txt  to my  editor: My_edit_txt.exe

          4-  when I click on hello.txt,

          5-  the system launches -> My_edit_txt.exe (so far works ok)

           

           

          6- then I dont know:  Inside My_edit_txt.exe:

           

           

          Which file clicked the user?

           

           

          if I knew the file I could read hello.txt and put the text "My name is Fernando" in the textfield MYTEXT.

           

           

          perhaps this example is better to undestand my question :-)

           

           

          thanks so much

          • 3. Re: associate a file extension with my executable, how to receive filename?
            moccamaximum Level 5

            As far as I kow what you are trying to do is not exactly possible.

             

            A workaround is to use a LocalConnection

             

            I used this FrameWork:

            http://flash.area-network.de/projekte/aslocalconnect/as3/eng/

             

            to pass systemvars to a multilanguage projector so that he would start up with the users system language active.

             

            You should be able to create an air application which you can drag&drop your my_sample.epl on and then the file name is used as a param to launch

            your Edit_eplp.exe with this file opened.

            • 4. Re: associate a file extension with my executable, how to receive filename?
              Nando Darder Mallorca Level 1

              I solve it!

               

              Question:

              I want to click on a textFile  for example  hello.txt, with the content:   "My name is Fernando"

               

               

              1 - create an application   My_edit_txt.exe   (with only one text_field, MY TEXT)

              2 - install the application.

              3-  associate the extension txt  to my  editor: My_edit_txt.exe

              4-  when I click on hello.txt,

              5-  the system launches -> My_edit_txt.exe (so far works ok)

               

               

              6- then I dont know:  Inside My_edit_txt.exe:

               

               

              Which file clicked the user?

               

               

               

               

              Resolution:

               

                 NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);

               

               

               

              package silbo.esment.general.base_juegos

              {

                        import flash.desktop.NativeApplication;

                        import flash.display.MovieClip;

                        import flash.events.InvokeEvent;

                        import flash.text.TextField;

               

                        public class Clip_editor_epl extends MovieClip

                        {

                                  public var t_texto:TextField;

                                  public function Clip_editor_epl()

                                  {

                                                 super();

                                                 NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);

                                  }

               

                                  function onInvoke(event:InvokeEvent):void {

                                            mitrace("on invoke");

                                            mitrace("arg="+event.arguments);

               

               

                                            mitrace("file to open:"+event.arguments[0]);

                                  }

                                  function mitrace(trozo){

                                            if(trozo==null){

                                                      trozo="";

                                            }

                                            t_texto.appendText(trozo+"\n");

                                  }

                        }//clase

              }