Sub filletaging()
Dim intlistindex As Integer
Dim strpath As String
Dim strtext As String
Dim strtext2 As String
Dim strtext3 As String
Dim x As Integer
Dim strfile As String
Dim x2 As Integer
Dim intdeeltext As Integer
strpath = Dir1.path
strfile = File1.filename
For x = 0 To Combo2.UBound
For x2 = 0 To Combo2.UBound
If x > Combo2.UBound Then Exit Sub
intlistindex = Combo2.item(x).ListIndex
If intlistindex <> 7 Then
Exit For
End If
x = x + 1
Next
Select Case x
Case 0
strtext = funfinddirname2(strpath, "", "")
Case 1
strtext = funfinddirname2(strpath, "", "")
Case 2
strtext = funfinddirname2(strfile, "", txttaginfo.item(0).text)
Case 3
intdeeltext = Len(strfile) - Len(strtext) + 1
'intdeeltext = intdeeltext - 1
'strfile = File1.filename
strfile = Right(strfile, intdeeltext)
strtext = funfinddirname2(strfile, txttaginfo.item(0), txttaginfo.item(1))
Case 4
intdeeltext = Len(strfile) - Len(strtext) - Len(txttaginfo.item(0))
strfile = Right(strfile, intdeeltext)
strtext = funfinddirname2(strfile, txttaginfo.item(1), txttaginfo.item(2))
Case 5
intdeeltext = Len(strfile) - Len(strtext) - Len(txttaginfo.item(1))
strfile = Right(strfile, intdeeltext) & " "
strtext = funfinddirname2(strfile, txttaginfo.item(2), txttaginfo.item(3))
End Select
Select Case intlistindex
Case 0 '"artist"
txtArtist = strtext
Case 1 '"songname"
txtTitle = strtext
Case 2 '"tracknr"
txttracknr = strtext
Case 3 '"album"
txtAlbum = strtext
Case 4 '"genre"
txtGenreCode = strtext
Case 5 '"year"
txtYear = strtext
Case 6 '"artist-album"
strtext2 = funfinddirname2(strtext, "", "-")
strtext3 = funfinddirname2(strtext, "-", "")
txtArtist = strtext2
txtAlbum = strtext3
Case 7 '"not used"
End Select
Next
End Sub
Function funfinddirname2(parpath As String, parscheiding As String, parscheiding2 As String) As String
On Error GoTo Errordb
Dim intaantal As Integer
Dim intplaats As Integer
Dim intplaats2 As Integer
Dim intstart As Integer
Dim intlengte As Integer
intstart = 1
If parscheiding = "" And parscheiding2 = "" Then
Exit Function
ElseIf parscheiding <> "" And parscheiding2 <> "" Then
intplaats = InStr(intstart, parpath, parscheiding)
intstart = intplaats + Len(parscheiding)
intplaats2 = InStr(intstart, parpath, parscheiding2)
intlengte = Len(parpath)
If intplaats <> 0 And intplaats2 <> 0 Then
intplaats2 = intplaats2 - intstart
funfinddirname2 = Mid(parpath, intstart, intplaats2)
Exit Function
End If
funfinddirname2 = "not found" & parscheiding & " or " & parscheiding2
Exit Function
ElseIf parscheiding <> "" Then
intplaats = InStr(intstart, parpath, parscheiding)
intstart = intplaats + 1
intlengte = Len(parpath)
funfinddirname2 = Right(parpath, intlengte - intstart + Len(parscheiding))
Exit Function
ElseIf parscheiding2 <> "" Then
intplaats = InStr(1, parpath, parscheiding2)
funfinddirname2 = Left(parpath, intplaats - Len(parscheiding2))
Exit Function
End If
Errordb:
Select Case Err.Number
Case 5
funfinddirname2 = "not found " & parscheiding & " or " & parscheiding2
Exit Function
Case Else
MsgBox error
End Select
End Function