Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Posts
    42

    ComboBox and WMP Plugin

    It's Alive!!! I've built my Frankenstein by piecing together bits and pieces of code from the samples others have so generously supplied here and my project works...sorta.

    The ComboBox is populated with a table -- good there.
    When selected in the ComboBox, the MP3 files play in the default player -- well okay.

    But, I really want the MP3 files to play in the WMP plugin!!

    Here's what I have so far. I'd be really grateful if someone could just get me past this one last hurdle.

    On preload:

    --populate a table with all the text files
    MP3s = File.Find(_SourceFolder.."\\AutoPlay\\Audio", "*.mp3", false, false, nil);
    zero = File.Find(_SourceFolder.."\\AutoPlay\\Audio", "*.mp3", false, false, nil);

    On Show:

    -- An if statement that compares two numbers
    if zero = nil then
    -- Do something here
    else
    --do the following for each file:
    for j,file_path in MP3s do
    --add the item to the combobox, with the name visible and path as data
    ComboBox.AddItem("ComboBox1", String.SplitPath(file_path).Filename, file_path);

    end
    end

    On Select:

    -- Get the selected items
    tSelected = ComboBox.GetSelected("ComboBox1");

    if tSelected then
    -- There is an item selected, get the data! (I know this part needs to change but I'm not quite sure how to change it)
    sFiletoOpen = ComboBox.GetItemData("ComboBox1", tSelected);
    File.Open(sFiletoOpen, "", SW_SHOWNORMAL);


    else
    -- Display an error message
    Dialog.Message("Error", "There is no item selected.");
    end

    And, that's as far as I've gotten. Hope it's not too confusing.

    Thanks in advance to whoever can give me a hand.

    Gerri

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Instead of doing a File.Open on the data returned from the combobox you can use the MediaPlayer.Load and MediaPlayer.Play

    MediaPlayer.Load("MediaPlayer1", sFiletoOpen);
    MediaPlayer.Play("MediaPlayer1");

    HTH
    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Jun 2004
    Posts
    42
    Many thanks for the help, Tigg.

    That sure seems like the logical solution except that I have numerous MP3 files to select from and I'm not sure how to code my project so that when a title is selected it will play in WMP. BTW, that 'FilestoOpen' was from a previous project and it can go away as I am not using it in mine.

    Populating the combobox with a table was my attempt at saving myself some work (I'm not sure if I got my wish) and now I'm stuck on how to GetItemData for a selected title since I'm not dealing with Line numbers?

    Previously, when I used a combobox for a similar project, I manually entered the information into the Item Text and Item Data fields. I have the coding for that process but I don't know how to (if I even can) manipulate that code to work in this situation.

    This scripting stuff befuddles me so well that I'm never sure if my explanations make sense. I hope this is understandable.

    Thanks again,

    Gerri

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Gerri,

    There are a lot of examples on the forums on ways to do what you are asking. My suggestion would be to run a Search for comboboxes and how to dynamically populate them. I would also suggest looking at azmanars site as there are a lot of examples on dynamically populating listboxes there.

    The code you have looks good and seems to be a great start.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  5. #5
    Join Date
    Jun 2004
    Posts
    42
    Thanks so much for your help and encouragement, Tigg.

    I did get my project to work and I am currently doing the Happy Dance around my office.

    I appreciate this forum soooo much. I couldn't do it without you guys!

    Thanks again!!

    Gerri

Similar Threads

  1. Using the WMP plugin and ComboBox
    By Ham in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 04-14-2006, 05:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts