Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

Custom File Types/Open In App

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

  • Custom File Types/Open In App

    Hey Guys,

    after i posted my last app i received a few requests for the code to make the file open in the app, so here it is

    in this example i used a .mxt (so it dosent mess up your file association)

    build the app and run it once to set the association, then rename a compatible audio file and .mxt and double click it and it will open in the example app

    I take no credit for this code, it is code i got from a few posts in the forum, all i did was combine the code into a working example

    Have Fun
    Last edited by RizlaUK; 02-01-2009, 12:35 PM.
    Embrace change in your life, you never know, it could all work out for the best

  • #2
    Thanks

    Very good work, is of a lot of utility, thank you to share it with us.:yes :yes

    Comment


    • #3
      thats a very useful example to have..thanks RizlaUk

      Comment


      • #4
        Thanks RizlaUk

        Good Work RizlaUK.
        It works, ...How you do that?
        lol
        Thank You
        AudioSam

        Comment


        • #5
          Really nice RizlaUK:yes :yes

          Comment


          • #6
            hey, wow, 4 weeks later and my post appears, i had given up on this one, guess the powers that be was just to busy (working on AMS 7 with any luck )
            Embrace change in your life, you never know, it could all work out for the best

            Comment


            • #7
              Help

              I am trying to load the file with extension (.mp3) to a ListBox and from this to the Media Player, but I get an error (MediaPlayer doesn't support the following extension: (.) ).
              But when I load the file (.mp3) directly to MediaPlayer everything it works marvelously - I have changed "CHANNEL_NARRATION" for MediaPlayer plugin-
              Where is the error?

              Code:
              check to see if any commandline arg was passed to the app
              if _CommandLineArgs[1] then
              	if String.Left(_CommandLineArgs[1], 3) ~= "SFX" then
              		YourCustomFile = _CommandLineArgs[1]
              		sPath = String.SplitPath(YourCustomFile);
              		Input.SetText("Input1", sPath.Filename);
              
              			-- Add the item to the ListBox
              			ListBox.AddItem("Playlist", String.SplitPath(YourCustomFile).Filename, sPath.Filename);
                                      -- Select item from ListBox
                                      ListBox.SelectItem("Playlist", 1);
              			
              	end
              end

              Comment


              • #8
                My app loads the name of the song from the ListBox but doesn't run it.
                Attached Files

                Comment


                • #9
                  i assume you are loading the file into the mp plugin via the listbox "Data" field

                  if that is the case you are loading just the filename, which is useless, you need to send the full path to it

                  and you are splitting the path twice (waist of code)

                  try this:

                  Code:
                  --check to see if any commandline arg was passed to the app
                  if _CommandLineArgs[1] then 
                  	if String.Left(_CommandLineArgs[1], 3) ~= "SFX" then 
                  		YourCustomFile = _CommandLineArgs[1] 
                  		sPath = String.SplitPath(YourCustomFile); 
                  		Input.SetText( "Input1", sPath.Filename); 
                  
                  		 	-- Add the item to the ListBox
                  			ListBox.AddItem( "Playlist", sPath.Filename, YourCustomFile); 
                              -- Select item from ListBox
                              ListBox.SelectItem( "Playlist", 1); 
                  			
                  	end 
                  end
                  output enhanced with AMS Code Pretty
                  Embrace change in your life, you never know, it could all work out for the best

                  Comment


                  • #10
                    Try this code:
                    Code:
                    --check to see if any commandline arg was passed to the app
                    if _CommandLineArgs[1] then
                    	if String.Left(_CommandLineArgs[1], 3) ~= "SFX" then
                    		YourCustomFile = _CommandLineArgs[1]
                    		sPath = String.SplitPath(YourCustomFile);
                    		Input.SetText("Input1", sPath.Filename);
                    
                    		-- Add the item to the ListBox
                    		ListBox.AddItem("Playlist", sPath.Filename, YourCustomFile);
                    		-- Select item from ListBox
                    		ListBox.SelectItem("Playlist", 1);
                    	end
                    end
                    LOL, looks like RizlaUK beat me to it!

                    Comment


                    • #11
                      lol....beat ya by 30 seconds
                      Embrace change in your life, you never know, it could all work out for the best

                      Comment


                      • #12
                        Thank you RizlaUK and mz241508 now everything works perfectly.:yes :yes
                        Attached Files

                        Comment


                        • #13
                          This way I can initialize the file automatically from the ListBox

                          Code:
                          --check to see if any commandline arg was passed to the app
                          if _CommandLineArgs[1] then 
                          	if String.Left(_CommandLineArgs[1], 3) ~= "SFX" then 
                          		YourCustomFile = _CommandLineArgs[1] 
                          		sPath = String.SplitPath(YourCustomFile); 
                          		Input.SetText( "Input1", sPath.Filename); 
                          
                          		 	-- Add the item to the ListBox
                          			ListBox.AddItem( "Playlist", sPath.Filename, YourCustomFile); 
                                      -- Select item from ListBox
                                      ListBox.SelectItem( "Playlist", 1);
                                       -- Get the selected item(s) from the ListBox
                          Selected = ListBox.GetSelected("Playlist");
                          -- Ensure that there was an item selected
                          if Selected then
                          	-- Get the path to the selected file (stored in the item's 'data')
                          	FilePath = ListBox.GetItemData("Playlist", Selected[1]);
                          	-- load the file
                          	MediaPlayer.Load("Media", FilePath);
                          	-- play the file
                          	MediaPlayer.Play("Media");
                          	-- start the timer
                          	Page.StartTimer(500);
                          	-- set as playing
                          	Playing = true
                          	-- set as not paused
                          	Paused = false
                          	-- set as loaded
                          	Loaded = true
                          	-- set the total time
                          	Label.SetText("Total", Clock(MediaPlayer.GetLength("Media")));
                          end
                          end            
                          end

                          Comment


                          • #14
                            Thank for the codes guys

                            Hey guys I tried the some of the codes & it works perfectly until you try to open multiple mp3 files - then it starts to open several instances of the player (the application) to load each file:lol
                            I hope some one can try to update this part of the codes...It'll be really useful...

                            BTW is there also a way to read the data in a saved .m3u playlist and load this into the listbox when I double click it considering the my app is set as the default Application for the file?

                            Comment


                            • #15
                              Yes. Detect the extension and load the playlist.

                              Comment

                              Working...
                              X