Excel Vba'dan Mp3 (mümkünse diğer) Dosya türlerinin özellikleri ni okumak...

Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
Excel Vba'dan Mp3 (mümkünse diğer) Dosya türlerinin özellikleri ni okumak...

Aşağıdaki kodlar forumda bulunan plemp3.xls dosyasından uyarlamadır.
Aşağıdaki 2.yordama dosyamız eğer mp3 uzantılı ise 1. yordamdan yönlendiriliyoruz. Fakat
Şarkı Numarası (1,2,3 vs), Şarkı Türü (Tsm, Aranjman, Pop, Rock) Gibi verilerine ulaşamıyorum. bunlara aşağıdaki yöntem veya başka bir yöntem ile nasıl ulaşabilirim?

Not: Kodların tamamı http://www.excel.web.tr/showpost.php?p=312872&postcount=7 bağlantısında olup, sadece Dosya özellikleri yordamı değiştirilmiş, Mp3_Ozellikleri yordamı eklenmiştir.

1.Yordam
Kod:
Private Sub DosyaOzellikleri(dsyBak As String)                                                             '>>|
401 Set Dosyam = DsSisKnt.GetFile(dsyBak)                                                                  '>>|
402 With Dosyam                                                                                            '>>|
403    ActiveSheet.Hyperlinks.Add Anchor:=Range("B" & ui), address:=dsyBak                                 '>>|
404    Range("C" & ui) = .Type                                                                             '>>|
405    Range("D" & ui) = Format(.Size / 1024, "#,##0.0000") & " Kb"                                        '>>|
406    Range("E" & ui) = Format(.DateCreated, "dd.mm.yyyy")                                                '>>|
407    Range("F" & ui) = Format(.DateLastAccessed, "dd.mm.yyyy")                                           '>>|
408    Range("G" & ui) = Format(.DateLastModified, "dd.mm.yyyy")                                           '>>|
409    Range("H" & ui) = Format(.DateLastModified, "hh:mm:ss")                                             '>>|
410    Range("I" & ui) = src_Kok                                                                           '>>|
411    Range("J" & ui) = src_SNo                                                                           '>>|
412    Range("K" & ui) = src_Etk                                                                           '>>|
413    Range("L" & ui) = src_Tip                                                                           '>>|
'      uzantı = Right(Dosyam.Name, 3)
    Select Case Right(Dosyam.Name, 3)
        Case "mp3"
            Range("M" & ui) = "MP3 ÖZL"
           Call Mp3_Ozellikleri(dsyBak)
        Case "jpg"
            Range("M" & ui) = "jpg ÖZL"
        Case Else
            Range("M" & ui) = ""
    End Select
415 End With                                                                                               '>>|
416 Set Dosyam = Nothing                                                                                   '>>|
End Sub
2.Yordam
Kod:
Private Sub Mp3_Ozellikleri(Filename)
'Dim Filename As String
'Filename = "C:\Users\Dr.Gürsel\Desktop\AYŞE TUNALI - 1994 - SAATLER Mİ DURMUŞ (12-12)\08 - DİYEMEDİM.mp3"
Dim HasTag As Boolean
Dim tag As String * 3
Dim Songname As String * 30
Dim Artist As String * 30
Dim Album As String * 30
Dim Year As String * 4
Dim Comment As String * 30
Dim Genre As String * 10
Dim TrackNumber As String * 3
Open Filename For Binary As #1
Get #1, FileLen(Filename) - 127, tag
If Not tag = "TAG" Then
    Close #1
    HasTag = False
    Exit Sub
End If
HasTag = True
Get #1, , Songname
Get #1, , Artist
Get #1, , Album
Get #1, , Year
Get #1, , Comment
Get #1, , Genre
Get #1, , TrackNumber
    Close #1
'MsgBox Songname & Chr(13) & Artist & Chr(13) & Album & Chr(13) & Year & Chr(13) & Comment & Chr(13) & Genre
'MsgBox Songname & "_" & Artist & "_" & Album & "_" & Year & "_" & Comment & "_" & Genre
'MsgBox Songname
'MsgBox Artist
'MsgBox Album
'MsgBox Year
'MsgBox Comment
'MsgBox Genre
Range("M" & ui) = Artist:                Range("N" & ui) = Album                                          '>>|
Range("O" & ui) = TrackNumber:            Range("Q" & ui) = Songname                                        '>>|
Range("R" & ui) = Year:                  Range("S" & ui) = Comment                                        '>>|
Range("T" & ui) = Genre:                 Range("U" & ui) = "??Albüm Sanatçısı"                                        '>>|
End Sub
 
Son düzenleme:

Levent Menteşoğlu

Administrator
Yönetici
Admin
Katılım
13 Ekim 2004
Mesajlar
16,056
Excel Vers. ve Dili
Excel 2010-32 bit-Türkçe
Excel 365 -32 bit-Türkçe
Aşağıdaki kodla herhangi bir dosyanın tüm özelliklerine ulaşabilirsiniz. Kırmızı renkli alanları kendinize göre değiştirin.

Kod:
Sub dosyaozellikleri()
Set dosya = CreateObject("Shell.Application").Namespace("[B][COLOR=red]d:\[/COLOR][/B]").ParseName("[COLOR=red][B]muzikadi.mp3[/B][/COLOR]")
For a = 0 To 50
Cells(a + 1, "a") = CreateObject("Shell.Application").Namespace("[B][COLOR=red]d:\[/COLOR][/B]").GetDetailsOf(, a)
Cells(a + 1, "b") = CreateObject("Shell.Application").Namespace("[B][COLOR=red]d:\[/COLOR][/B]").GetDetailsOf(dosya, a)
Next
End Sub
 
Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
Aşağıdaki kodla herhangi bir dosyanın tüm özelliklerine ulaşabilirsiniz. Kırmızı renkli alanları kendinize göre değiştirin.

Kod:
Sub dosyaozellikleri()
Set dosya = CreateObject("Shell.Application").Namespace("[B][COLOR=red]d:\[/COLOR][/B]").ParseName("[COLOR=red][B]muzikadi.mp3[/B][/COLOR]")
For a = 0 To 50
Cells(a + 1, "a") = CreateObject("Shell.Application").Namespace("[B][COLOR=red]d:\[/COLOR][/B]").GetDetailsOf(, a)
Cells(a + 1, "b") = CreateObject("Shell.Application").Namespace("[B][COLOR=red]d:\[/COLOR][/B]").GetDetailsOf(dosya, a)
Next
End Sub
hocam alakanıza teşekkür ederim... ancak burada benim istediğimin fazlası var... tercih hakkım nasıl olacak;

AdıBoyutTürDeğiştirilme TarihiOluşturulma TarihiErişim TarihiÖzniteliklerDurumSahibiYazanBaşlıkKonuKategoriSayfaAçıklamalarTelif HakkıSanatçıAlbüm BaşlığıYılParça NumarasıTarzSüreBit DeğeriKorumalıKamera ModeliResmin Alındığı TarihBoyutlarBölüm AdıProgram AçıklamasıSes örneği boyutuSes örnek değeriKanallarŞirketAçıklamaDosya sürümüÜrün AdıÜrün SürümüProfilGenişlikYükseklikSüreBit OranıKare OranıÖrnekleme OranıKeywords
 

Levent Menteşoğlu

Administrator
Yönetici
Admin
Katılım
13 Ekim 2004
Mesajlar
16,056
Excel Vers. ve Dili
Excel 2010-32 bit-Türkçe
Excel 365 -32 bit-Türkçe
Kod:
.GetDetailsOf(dosya, a)
Yukarıdaki a yerine istediğiniz bilginin sayısal değerini yazın. Bu numara verdiğim koddaki satır nosudur.
 
Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
teşekkür ederim hocam deneyeceğim. yalnız vista işetim sistemindeki gelişmiş dosya özellikleri xp ye göre daha geniş uyumludurlar değil mi?windows vistadadaki diğer detayları alabilmek mümkün mü?
 

Haluk

𐱅𐰇𐰼𐰚
Katılım
7 Temmuz 2004
Mesajlar
12,313
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Son düzenleme:

Haluk

𐱅𐰇𐰼𐰚
Katılım
7 Temmuz 2004
Mesajlar
12,313
Excel Vers. ve Dili
64 Bit 2010 - İngilizce
+
Google Sheets
+
JScript
Altın Üyelik Bitiş Tarihi
Yani;

Kod:
Type TagInfo
    Tag As String * 3
    Songname As String * 30
    Artist As String * 30
    Album As String * 30
    Year As String * 4
    Comment As String * 30
    Genre As String * 1
End Type
'
Sub Test()
    Dim FileName As String
    Dim CurrentTag As TagInfo
    On Error Resume Next
    
    FileName = Application.GetOpenFilename("MP3 dosyalari (*.mp3), *.mp3", , "MP3 Dosyasi secin...")
    If Not FileName = False Then
        Open FileName For Binary As #1
        With CurrentTag
            Get #1, FileLen(FileName) - 127, .Tag
            
            If Not .Tag = "TAG" Then
                MsgBox "Tag bulunamadi"
                Close #1
                Exit Sub
            End If
            
            Get #1, , .Songname
            Get #1, , .Artist
            Get #1, , .Album
            Get #1, , .Year
            Get #1, , .Comment
            Get #1, , .Genre
            Close #1
        
            MsgBox "Sarki :  " & Trim(.Songname)
            MsgBox "Sanatci :  " & Trim(.Artist)
            MsgBox "Album :  " & Trim(.Album)
            MsgBox "Yil :  " & Trim(.Year)
            MsgBox "Not :" & Trim(.Comment)
            
            Select Case Asc(Trim(.Genre))
                Case 0: MyGenre = "Blues"
                Case 1: MyGenre = "Classic Rock"
                Case 2: MyGenre = "Country"
                Case 3: MyGenre = "Dance"
                Case 4: MyGenre = "Disco"
                Case 5: MyGenre = "Funk"
                Case 6: MyGenre = "Grunge"
                Case 7: MyGenre = "Hip Hop"
                Case 8: MyGenre = "Jazz"
                Case 9: MyGenre = "Metal"
                Case 10: MyGenre = "New Age"
                Case 11: MyGenre = "Oldies"
                Case 12: MyGenre = "Other"
                Case 13: MyGenre = "Pop"
                Case 14: MyGenre = "R&B"
                Case 15: MyGenre = "Rap"
                Case 16: MyGenre = "Reggae"
                Case 17: MyGenre = "Rock"
                Case 18: MyGenre = "Techno"
                Case 19: MyGenre = "Industrial"
                Case 20: MyGenre = "Alternative"
                Case 21: MyGenre = "Ska"
                Case 22: MyGenre = "Death Metal"
                Case 23: MyGenre = "Pranks"
                Case 24: MyGenre = "Soundtrack"
                Case 25: MyGenre = "Euro - Techno"
                Case 26: MyGenre = "Ambient"
                Case 27: MyGenre = "Trip Hop"
                Case 28: MyGenre = "Vocal"
                Case 29: MyGenre = "Jazz - Funk"
                Case 30: MyGenre = "Fusion"
                Case 31: MyGenre = "Trance"
                Case 32: MyGenre = "Classical"
                Case 33: MyGenre = "Instrumental"
                Case 34: MyGenre = "Acid"
                Case 35: MyGenre = "House"
                Case 36: MyGenre = "Game"
                Case 37: MyGenre = "Sound Clip"
                Case 38: MyGenre = "Gospel"
                Case 39: MyGenre = "Noise"
                Case 40: MyGenre = "Alt.Rock"
                Case 41: MyGenre = "Bass"
                Case 42: MyGenre = "Soul"
                Case 43: MyGenre = "Punk"
                Case 44: MyGenre = "Space"
                Case 45: MyGenre = "Meditative"
                Case 46: MyGenre = "Instrumental Pop"
                Case 47: MyGenre = "Instrumental Rock"
                Case 48: MyGenre = "Ethnic"
                Case 49: MyGenre = "Gothic"
                Case 50: MyGenre = "Darkwave"
                Case 51: MyGenre = "Techno - Industrial"
                Case 52: MyGenre = "Electronic"
                Case 53: MyGenre = "Pop / Folk"
                Case 54: MyGenre = "Eurodance"
                Case 55: MyGenre = "Dream"
                Case 56: MyGenre = "Southern Rock"
                Case 57: MyGenre = "Comedy"
                Case 58: MyGenre = "Cult"
                Case 59: MyGenre = "Gangsta Rap"
                Case 60: MyGenre = "Top 40"
                Case 61: MyGenre = "Christian Rap"
                Case 62: MyGenre = "Pop / Funk"
                Case 63: MyGenre = "Jungle"
                Case 64: MyGenre = "Native American"
                Case 65: MyGenre = "Cabaret"
                Case 66: MyGenre = "New Wave"
                Case 67: MyGenre = "Psychedelic"
                Case 68: MyGenre = "Rave"
                Case 69: MyGenre = "Showtunes"
                Case 70: MyGenre = "Trailer"
                Case 71: MyGenre = "Lo - fi"
                Case 72: MyGenre = "Tribal"
                Case 73: MyGenre = "Acid Punk"
                Case 74: MyGenre = "Acid Jazz"
                Case 75: MyGenre = "Polka"
                Case 76: MyGenre = "Retro"
                Case 77: MyGenre = "Musical"
                Case 78: MyGenre = "Rock 'n'Roll"
                Case 79: MyGenre = "Hard Rock"
                Case 80: MyGenre = "Folk"
                Case 81: MyGenre = "Folk / Rock"
                Case 82: MyGenre = "National Folk"
                Case 83: MyGenre = "Swing"
                Case 84: MyGenre = "Fast Fusion"
                Case 85: MyGenre = "Bebob"
                Case 86: MyGenre = "Latin"
                Case 87: MyGenre = "Revival"
                Case 88: MyGenre = "Celtic"
                Case 89: MyGenre = "Blue Grass"
                Case 90: MyGenre = "Avant Garde"
                Case 91: MyGenre = "Gothic Rock"
                Case 92: MyGenre = "Progressive Rock"
                Case 93: MyGenre = "Psychedelic Rock"
                Case 94: MyGenre = "Symphonic Rock"
                Case 95: MyGenre = "Slow Rock"
                Case 96: MyGenre = "Big Band"
                Case 97: MyGenre = "Chorus"
                Case 98: MyGenre = "Easy Listening"
                Case 99: MyGenre = "Acoustic"
                Case 100: MyGenre = "Humour"
                Case 101: MyGenre = "Speech"
                Case 102: MyGenre = "Chanson"
                Case 103: MyGenre = "Opera"
                Case 104: MyGenre = "Chamber Music"
                Case 105: MyGenre = "Sonata"
                Case 106: MyGenre = "Symphony"
                Case 107: MyGenre = "Booty Bass"
                Case 108: MyGenre = "Primus"
                Case 109: MyGenre = "Pr0n Groove"
                Case 110: MyGenre = "Satire"
                Case 111: MyGenre = "Slow Jam"
                Case 112: MyGenre = "Club"
                Case 113: MyGenre = "Tango"
                Case 114: MyGenre = "Samba"
                Case 115: MyGenre = "Folklore"
                Case 116: MyGenre = "Ballad"
                Case 117: MyGenre = "Power Ballad"
                Case 118: MyGenre = "Rhythmic Soul"
                Case 119: MyGenre = "Freestyle"
                Case 120: MyGenre = "Duet"
                Case 121: MyGenre = "Punk Rock"
                Case 122: MyGenre = "Drum Solo"
                Case 124: MyGenre = "Euro - House"
                Case 125: MyGenre = "Dance Hall"
                Case 126: MyGenre = "Goa"
                Case 127: MyGenre = "Drum & Bass"
                Case 128: MyGenre = "Club - House"
                Case 129: MyGenre = "Hardcore"
                Case 130: MyGenre = "Terror"
                Case 131: MyGenre = "Indie"
                Case 132: MyGenre = "Brit Pop"
                Case 133: MyGenre = "Negerpunk"
                Case 134: MyGenre = "Polsk Punk"
                Case 135: MyGenre = "Beat"
                Case 136: MyGenre = "Christian Gangsta Rap"
                Case 137: MyGenre = "Heavy Metal"
                Case 138: MyGenre = "Black Metal"
                Case 139: MyGenre = "Crossover"
                Case 140: MyGenre = "Contemporary Christian"
                Case 141: MyGenre = "Christian Rock"
                Case 142: MyGenre = "Merengue"
                Case 143: MyGenre = "Salsa"
                Case 144: MyGenre = "Thrash Metal"
                Case 145: MyGenre = "Anime"
                Case 146: MyGenre = "JPop"
                Case 147: MyGenre = "Synth Pop"
                Case Else: MyGenre = "Bilinmiyor"
            End Select
            
            MsgBox "Tarz :  " & MyGenre
        End With
    End If
End Sub
 
Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
haluk hocam alakanıza teşekkür ederim.. dün bağlantı sorunu nedeni ile teşekkür edememiştim.
 
Üst