Gerri
10-10-2006, 01:36 PM
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
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