Announcement

Collapse
No announcement yet.

I Need Help With File Association

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I Need Help With File Association

    Hello my friends,
    First of all, I'm sorry for my bad English.

    I need help with file association.
    For example;
    There is a text file named "mytest.mtn" on the desktop.
    When I double-click this file, my program should open and the text inside the file "mytest.mtn" should be written to the Input object.

    For example, when I double-click the file "mytest.txt", the program named "notepad.exe" opens. Then, we display the texts inside the file named "mytest.txt" in the program named "Notepad".
    I want to make a program like this.

    How can I do this practice?

    Can you give me an example of this?
    I would be grateful if you could help me with this.

    Sincerely yours..

  • #2
    If I recall, my Project plugin will do this. Try Project.Associate(). That should do what you want. Let me know if that doesn't work and I'll try to figure out way.
    https://github.com/CentauriSoldier

    Comment


    • #3
      Also, this post may help. It was written for Setup Factory, but will work with AutoPlay Media Studio. Just know that, for changing the default handler for a file extension, admin rights are required, so your AutoPlay Media Studio application needs to run "as administrator". Normally, an application should not use this setting, and the file association should be set up during the installation...

      Ulrich

      Comment


      • #4
        Originally posted by Ulrich View Post
        Also, this post may help. It was written for Setup Factory, but will work with AutoPlay Media Studio. Just know that, for changing the default handler for a file extension, admin rights are required, so your AutoPlay Media Studio application needs to run "as administrator". Normally, an application should not use this setting, and the file association should be set up during the installation...

        Ulrich
        Dear friend, thank you for helping. But unfortunately I have already associated the file extension I want (eg .rkl) with my program via the Windows Registry.
        Okay. No problem so far.

        Now, I want to double-click the file "test.rkl" on the desktop and open it on the Grid object in my application "Rast.exe".

        I showed what I wanted to do in a file called "HelpMe.png". Please review those pictures.

        Please help me with this!

        Comment


        • #5
          Originally posted by mburaksaglik View Post

          Dear friend, thank you for helping. But unfortunately I have already associated the file extension I want (eg .rkl) with my program via the Windows Registry.
          Okay. No problem so far.

          Now, I want to double-click the file "test.rkl" on the desktop and open it on the Grid object in my application "Rast.exe".

          I showed what I wanted to do in a file called "HelpMe.png". Please review those pictures.

          Please help me with this!
          Is there anyone who can help me with this?

          Comment


          • #6
            mburaksaglik
            I believe what you are asking is not being understood.

            Comment


            • #7
              mburaksaglik instead of shouting why not post some code so that you may receive help, if you have the assoc done then why not just simply use


              Code:
              -- Load values from a txt file into the grid.
              -- Also note that this uses a semicolon rather than a comma as the separator
              Desktop_Folder = Shell.GetFolder(SHF_DESKTOP_COMMON);
              
              Grid.LoadFromFile("Grid1", Desktop_Folder.."\\test.rkl", ";", true);
              you may have to change your text file to include semicolon or comma etc
              Just treat your unique named file as a simple text file, you could also use loop to insert

              Comment


              • #8
                Originally posted by charliechaps View Post
                mburaksaglik instead of shouting why not post some code so that you may receive help, if you have the assoc done then why not just simply use


                Code:
                -- Load values from a txt file into the grid.
                -- Also note that this uses a semicolon rather than a comma as the separator
                Desktop_Folder = Shell.GetFolder(SHF_DESKTOP_COMMON);
                
                Grid.LoadFromFile("Grid1", Desktop_Folder.."\\test.rkl", ";", true);
                you may have to change your text file to include semicolon or comma etc
                Just treat your unique named file as a simple text file, you could also use loop to insert
                I couldn't imagine writing the text big would mean shouting. So I'm sorry. But I guess I haven't explained my problem properly yet.

                Well, let me ask you this way:
                There is a standard text file. (Ex: abc.txt)
                When you open this file, normally "notepad.exe" is opened as standard and the texts in it are displayed through this program.

                I want to do such a procedure, but I haven't found how to do it yet.

                All I want to do is;
                I want to view it with my own program when I click on it to open the file with the extension "*.rkl" in any folder. And I want to do this when I haven't opened my program yet.

                Actually, what I want to do seems to be a very simple process, but unfortunately I have a hard time explaining my problem.

                My English is very bad. That's why I use Google translation.

                I hope you understand me this time.

                I would be grateful if you help me with this.

                Sincerely yours.

                Comment


                • #9
                  Originally posted by mburaksaglik View Post

                  All I want to do is;
                  I want to view it with my own program...[]...And I want to do this when I haven't opened my program yet.
                  Sincerely yours.
                  this is confusing or contradictory.

                  David

                  Comment


                  • #10
                    Originally posted by daviz View Post

                    this is confusing or contradictory.

                    David
                    No, it is not;

                    He wants his program to be launched when you double click the custom file type.
                    He wants the simple filetype association stuff to happen, however (I assume) he is stuck at the part where he doesn't know how to display the opened file after double clicking the file.

                    He needs the Program Parameters for that.
                    Bas Groothedde
                    Imagine Programming :: Blog

                    AMS8 Plugins
                    IMXLH Compiler

                    Comment


                    • #11
                      Originally posted by Imagine Programming View Post

                      No, it is not;

                      He wants his program to be launched when you double click the custom file type.
                      He wants the simple filetype association stuff to happen, however (I assume) he is stuck at the part where he doesn't know how to display the opened file after double clicking the file.

                      He needs the Program Parameters for that.
                      Finally.. I think you understand me!

                      I think you'd understand better if I hadn't mentioned the file extension when I told you about my problem.

                      Let's put the file extension aside for now (forget it)!

                      I will try to explain it to you via a standard text file called "abc.txt", so that you can understand it very easily.

                      Imagine if I built a text file viewer program through AMS. (E.g.: Notepad)

                      Imagine my program is closed yet.

                      Let it be a standard text file. (E.g.: abc.txt)

                      ​​​​​​​When I click to open this file, I can view the texts in it through my own program.

                      -----in brief-----

                      I want it to be displayed through my own program when I click on any text file.

                      I would be happy if you send me a sample study on this project.


                      Sincerely yours.

                      Comment


                      • #12
                        Originally posted by mburaksaglik View Post

                        When I click to open this file, I can view the texts in it through my own program.
                        --Correction--

                        When I click to open this file, I want to display the texts in it with my own program.

                        Comment


                        • #13
                          Originally posted by charliechaps View Post
                          ... if you have the assoc done then why not just simply use


                          Code:
                          -- Load values from a txt file into the grid.
                          -- Also note that this uses a semicolon rather than a comma as the separator
                          Desktop_Folder = Shell.GetFolder(SHF_DESKTOP_COMMON);
                          
                          Grid.LoadFromFile("Grid1", Desktop_Folder.."\\test.rkl", ";", true);
                          you may have to change your text file to include semicolon or comma etc
                          Just treat your unique named file as a simple text file, you could also use loop to insert
                          the example of charliechaps does not help?

                          David

                          Comment


                          • #14
                            Originally posted by daviz View Post

                            the example of charliechaps does not help?

                            David
                            Unfortunately, that's not exactly what I wanted.

                            Comment


                            • #15
                              Did you try the project plugin by Centauri , it gives you the file path of the calling file

                              Project.GetFileCode

                              (table) Project.GetFileCode ( (string) Extension = ".txt" )
                              Description

                              Dermines whether or not the program was opened by a calling file with the specified extension.
                              Parameters

                              Extension

                              (string) The allowed file type. Returns

                              (table) Returns a table indexed by Code and File.

                              If the program was called by the specified file type then the Code value is 1 and the File value is the path to the calling file.

                              If the program was called by a file but not of the specified type then the Code value is -1 and the File value is the path to the calling file.

                              If the program was not called by a file then the Code value is 0 and the File value is a blank string.
                              Example

                              local tReturn = Project.GetFileCode(".skde");

                              if tReturn.Code == 1 then
                              Dialog.Message("Success", "Program opened with file...\r\n"..tReturn.File);
                              elseif tReturn.Code == -1 then
                              Dialog.Message("Error", "That file type is not supported.");
                              end
                              So then you can use that to load your file into Grid / Input / Para etc - That is assuming that you have got your file assocation to open your program

                              Comment

                              Working...
                              X