Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[VB6] Read Playlist from ini

Featured Replies

Answer has been found.. nevermind...

ok.. kinda simple.. but i can't figure this out...

on form_load i have my program read from an ini file then if "list" = "[NOT FOUND]" I need it to not add it to my listbox... heres the code that i have so far... i want to make it simpler and not put If then statements all the way down...

list = INITool1.GetFromINI("Track1", "Location", App.Path & "\settings.ini")
playlist.AddItem list
list = INITool1.GetFromINI("Track2", "Location", App.Path & "\settings.ini")
playlist.AddItem list
list = INITool1.GetFromINI("Track3", "Location", App.Path & "\settings.ini")
playlist.AddItem list

so lets say... if for Track2 the user didn't put anything in it.. so it returns the string "[NOT FOUND]" but Track3 has something. If i use something like a Do Until event, it will stop on Track2.. insted of reading track 3 and so on..

any ideas?

Thanks

My Solution...

For i = 1 To 20
list = INITool1.GetFromINI("Track" & i, "Location", App.Path & "\settings.ini")
If list = "[NOT FOUND]" Then
'do nothing and don't add to the list
Else
playlist.AddItem list
End If
Next i
End Sub

Edited by Bi0haZarD


Wouldn't just parsing the dir and read in all files be simpler than an ini? That way no configuration just run it.

  • Author

If i just parse the folder for all .mp3's then it will come back into my listbox as "c:\my music\rock\metallica\Metallica - Master of puppets.mp3" and with an ini i can let the user pick the name of the song.. so insted of seeing the complete path they can set it to say "Metallica - Master of Puppets" it just makes it look a bit cleaner..

this is for my Unattended Audio Player btw.. so thats why i only have it support 20 MP3's since that should be plenty, and whoever makes the CD can set the names of the tracks and it'll look better ;)

Ok I wasn't telling you how to do it just suggesting ideas. But thats possible also to strip file path returning only name. Or even load the dir to a File1 filter out .exe

Still waiting to try your next version

EDIT: One other idea maybe, After file is played delete it from dir?

Then If I used it at different place it would start next

Edited by maxXPsoft

The reason I was suggesting remove the ini is 'INITool1.GetFromINI'

I think thats a separate exe isn't it?

  • Author

I know ;) Suggestions are always welcome. and yea, i could always strip out the path to get more of a play all files in the folder.

I don't see what the point of having it delete the file upon finishing the song would be. this unattended player is to go into the $OEM$ folder so it gets copied to the hard drive and played.. then at the end of the installation if you have your install.cmd (or whatever file) to delete the c:\install folder it deletes the songs and player off the hard drive. if the files were to stay on the CD, it would proably slow down the installation of your applications since it would constantly have to read from the CD. and it wouldn't be able to delete the songs from the CD.

  • Author
The reason I was suggesting remove the ini is 'INITool1.GetFromINI'

I think thats a separate exe isn't it?

no its a OCX Control file, i haven't tested to see if i have to bundle it.. i hope i don't since it would mean putting it in the system32 folder by putting it in "$OEM$\$$\System32"

ahhh,

Yep very possible to use it will need to be included. I have seen a tool called initool.exe and was wondering, I have all my ini modding done by a .bas file included within my app. I searched for years for the right ini thing and came across this after trying nearly all.

Do you have a link to that ocx I can check it out?

Yeah this probably wouldn't play at User.cmd is reason I was thinking of delete file after play, then at runoncex start again new, I been experimenting play mp3's at different points with my app, still a work in progress...

  • Author

its very simple, although the people that made it aren't around anymore this guy has a very easy to follow instructions.

http://www.martin2k.co.uk/vb6/tips/x6.php

you got a link to that bas file.. i really don't want to have to include an OCX. i want to make this as stand alone as possible.

Sorry was uploading my new version UnattendXP then had to search.

I've done some modifying to this myself adding a couple features if you want it then MSG me and leave email and I'll send.

WriteToIni

Dim MyX As String, MyY As String
   MyX = Me.Top
   WriteToIni AddBackslash(App.Path) & "UnattendXP.ini", "ABOUT", "MainX", MyX

GetFromIni

   MyX = GetFromIni(AddBackslash(App.Path) & "UnattendXP.ini", "ABOUT", "MainX")

Get and save as IniMod.bas

Get the last post by Inverso, this has proved to be the easiest least confusing ini routine I have ever had. :thumbup and I have tried them all

The AddBackslash routine which is great :thumbup

Just add it in the Public Functions seection of the inimod.bas

Public Function AddBackslash(strPath As String) As String
'Receives the App.Path and returns a path containing backslash
'USAGE:  SomePath = AddBackslash(App.Path) & "YourFile.xxx"
 If Right$(strPath, 1) <> "\" Then
   AddBackslash = strPath & "\"
 Else
   AddBackslash = strPath
 End If
End Function

For i = 1 To 20
list = INITool1.GetFromINI("Track" & i, "Location", App.Path & "\settings.ini")
If list = "[NOT FOUND]" Then
'do nothing and don't add to the list
Else
playlist.AddItem list
End If
Next i
End Sub

Just a minor tweak, but you might want to try...

For i = 1 To 20
   list = INITool1.GetFromINI("Track" & i, "Location", App.Path & "\settings.ini")
       If list <> "[NOT FOUND]" Then
           playlist.AddItem list
       End If
   Next i
End Sub

  • Author

@maxXPsoft

its ok, I was making dinner. lol

ooh! i like this A LOT! thanks.

  • Author
Just a minor tweak, but you might want to try...

heh, revised that this mornin, was tired as hell when i coded it and didn't get around to changing it. thanks for pointing it out :D

What methods do you use to compile? I personally use Compile to P-Code, as it removes a lot of needless data from your application, literally cutting the size in half and doubling the speed.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.