Passwords and Lost .ini files.
You are welcome!
I assume it works, I guess?
I assume it works, I guess?
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Just for thoughts
Hey it's working as far as I can tell!!!
Here is what we were working on
There might be a way to get rid of the j calculations by not placing "" in cells of the worksheet. I'll have to work with that later, but as of right now it is working on my entire library. Some editing is needed in Excel to make it look pretty but I like Excel for transfering over to my PDA. This way I'll never buy duplicate CD's again ! With 11,822 MP3's the chances are great!
And if your looking for the whole code!!
THNX LOWLANDER!!!!
Here is what we were working on
Code: Select all
' Iterate through the list and export all songs
Progress.MaxValue = list.count
Dim i, itm
Dim prevArtist, prevAlbum, j
for i=0 to list.count-1
Set itm = list.Item(i)
if prevArtist = itm.ArtistName then
WS.Cells(i+2,1).Value = ""
else
WS.Cells(i+2-j,1).Value = itm.ArtistName
end if
if prevAlbum = itm.AlbumName then
WS.Cells(i+2,2).Value = ""
j = j+1
else
WS.Cells(i+2-j,2).Value = itm.AlbumName
end if
prevArtist = itm.ArtistName
prevAlbum = itm.AlbumName
Progress.Value = i+1
if Progress.Terminate then
Exit For
end if
next
And if your looking for the whole code!!
Code: Select all
Option Explicit ' report undefined variables, ...
' function for quoting strings
Function QStr( astr)
QStr = chr(34) & astr & chr(34)
End Function
Dim list ' list of songs to be exported
Dim res ' results of dialogs calls
Dim fullfile ' fully specified output file name
Dim fso ' FileSystemObject
' SDB variable is connected to MediaMonkey application object
Sub InitExport( ext, filter, iniDirValue)
fullfile = ""
' Get a list of songs to be exported
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
If list.count=0 Then
res = SDB.MessageBox( "Select tracks to be exported, please.", mtError, Array(mbOk))
Exit Sub
End If
' Open inifile and get last used directory
Dim iniF
Set iniF = SDB.IniFile
' Create common dialog and ask where to save the file
Dim dlg
Set dlg = SDB.CommonDialog
dlg.DefaultExt=ext
dlg.Filter=filter
dlg.Flags=cdlOFNOverwritePrompt + cdlOFNHideReadOnly
dlg.InitDir = iniF.StringValue( "Scripts", iniDirValue)
dlg.ShowSave
if Not dlg.Ok Then
Exit Sub ' if cancel was pressed, exit
End If
' Get the selected filename
fullfile = dlg.FileName
' Connect to the FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")
' Write selected directory to the ini file
iniF.StringValue( "Scripts", iniDirValue) = fullfile
End Sub
Sub FinishExport( ok)
On Error Resume Next
' remove the output file if terminated
if not Ok then
fso.DeleteFile( fullfile)
end if
' Notify user that it was successful
if ok then
res = SDB.MessageBox( "Export was completed successfully.", mtInformation, Array(mbOk))
else
res = SDB.MessageBox( "Export was terminated.", mtInformation, Array(mbOk))
end if
End Sub
Sub ExportXLS
' initialize export
Call InitExport( ".xls", "Excel sheet (*.xls)|*.xls|All files (*.*)|*.*", _
"LastExportExcelDir")
if fullfile="" then
Exit Sub
end if
if fso.FileExists( fullfile) then
fso.DeleteFile( fullfile)
end if
On Error Resume Next
' Connect to Excel
Dim Excel, WB, WS
Set Excel = CreateObject("Excel.application")
If Err.Number<>0 then
MsgBox "Microsoft Excel could not be found, please install it and try again."
Err.Clear
Exit Sub
End If
On Error GoTo 0
' Create a new workbook and get its worksheet
Set WB = Excel.WorkBooks.Add
Set WS = WB.Sheets(1)
' Use progress to notify user about the current action
Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Exporting to an Excel file..."
' Create a header
WS.Cells(1,1).Value = "Artist"
WS.Cells(1,2).Value = "Album"
WS.Rows("1:1").Font.Bold = True
' Iterate through the list and export all songs
Progress.MaxValue = list.count
Dim i, itm
Dim prevArtist, prevAlbum, j
for i=0 to list.count-1
Set itm = list.Item(i)
if prevArtist = itm.ArtistName then
WS.Cells(i+2,1).Value = ""
else
WS.Cells(i+2-j,1).Value = itm.ArtistName
end if
if prevAlbum = itm.AlbumName then
WS.Cells(i+2,2).Value = ""
j = j+1
else
WS.Cells(i+2-j,2).Value = itm.AlbumName
end if
prevArtist = itm.ArtistName
prevAlbum = itm.AlbumName
Progress.Value = i+1
if Progress.Terminate then
Exit For
end if
next
' Was it successfull?
Dim ok
if Progress.Terminate then
ok = False
else
ok = True
WB.SaveAs fullfile
end if
WB.Close false
' hide progress
Set Progress = Nothing
FinishExport( ok)
End Sub
It works
Tried it and it worked.
Didn't get this problem:
Didn't get this problem:
j calculations by not placing "" in cells of the worksheet.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
itm... album artist??
I'm working on an update and getting close. But I miss the album artist variable. Which one is that?
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
update?
Update for what I just did or update for something else? variable is prevArtist & prevAlbum... because your checking the prev artist with new one[itm.*.*Name].
The j calculations are in the code to move the inputs to Excel up.
In other words if you are counting by song then the code puts that many spaces before it puts another artist or album. so the j calculations subtract the spaces.
The j calculations are in the code to move the inputs to Excel up.
In other words if you are counting by song then the code puts that many spaces before it puts another artist or album. so the j calculations subtract the spaces.
An addition to your code.
The j thing explains some things as I got confused in your code. There is another way to do it so you wouldn't need to delete empty rows.
Something like:
The only thing I don't get right now is that your code writes artist & album. But I have two artists for one album (actually just artist feat artist) and this one is not written down as an artist in the output. That is confusing me.
The j thing explains some things as I got confused in your code. There is another way to do it so you wouldn't need to delete empty rows.
Something like:
If (itm.ArtistName <> prevArtist) && (itm.Album <> prevAlbum) then
write artist in cell
write album in cell
Else If (itm.ArtistName == prevArtist) && (itm.Album <> prevAlbum) then
write empty artist cell
write album cell
Else
Do nothing (as artist and album are already written by previous track
End if
The only thing I don't get right now is that your code writes artist & album. But I have two artists for one album (actually just artist feat artist) and this one is not written down as an artist in the output. That is confusing me.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Code and Things
Yeah I was thinking there was an easier way to code that section with the j calculations. I don't really know all the commands but it looks like you have a good handle on them.
So I knew you could group comparing functions just did't know how..
<> means anything but. (correct?)
Does && work for numbers and letters or does it not matter?
Is == for text and numbers or does it not matter either?
Is the (Do nothing) code read like that, it just seems too simple.
Does the code read (write artist in cell) and complete the task or are you paraphrasing? If so how does Excel know what cell to put info in? Does Excel auto.. move to next cell on an input?
With you feat. artist issue.... not to be silly but did you move the column bars in excel? The entire artist cell may not be showing because of the album name that's in the next cell. Otherwise... is your feat. artist in the same cell in MM? If so then I guess the export should export the complete MM artist cell....
hope this makes since....Thnx for your time and patience
So I knew you could group comparing functions just did't know how..
<> means anything but. (correct?)
Does && work for numbers and letters or does it not matter?
Is == for text and numbers or does it not matter either?
Is the (Do nothing) code read like that, it just seems too simple.
Does the code read (write artist in cell) and complete the task or are you paraphrasing? If so how does Excel know what cell to put info in? Does Excel auto.. move to next cell on an input?
With you feat. artist issue.... not to be silly but did you move the column bars in excel? The entire artist cell may not be showing because of the album name that's in the next cell. Otherwise... is your feat. artist in the same cell in MM? If so then I guess the export should export the complete MM artist cell....
hope this makes since....Thnx for your time and patience
I was paraphrasing. I'm not familiar myself with Excel so I would need to play with the code to figure that one out.
You'll need to mess around with this:
I exported 2 albums from the same artist. On one album one song has the artist mentioned with a feat.
The output file has only 2 lines The first line mentions the artist & album 1. The second line mentions no artist (as is same artist) & album 2.
If I add a counter to the code it does count 2 artists. So it counts well, but writes wrong.
I actually want to achieve this, and that's why I want to use the album artist.
You'll need to mess around with this:
maybe deleting the -j gets you somewhere. Anyway the code works so that's perfect. No real need to change it.WS.Cells(i+2-j,1).Value = itm.ArtistName
I exported 2 albums from the same artist. On one album one song has the artist mentioned with a feat.
The output file has only 2 lines The first line mentions the artist & album 1. The second line mentions no artist (as is same artist) & album 2.
If I add a counter to the code it does count 2 artists. So it counts well, but writes wrong.
I actually want to achieve this, and that's why I want to use the album artist.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
More Code
I've got this so far...
Getting an error 1002 at [if (prevArtist <> itm.ArtistName) && (prevAlbum <> itm.AlbumName) then]
Any ideas?
Code: Select all
' Iterate through the list and export all songs
Progress.MaxValue = list.count
Dim i, itm
Dim prevArtist, prevAlbum, j
for i=0 to list.count-1
Set itm = list.Item(i)
if (prevArtist <> itm.ArtistName) && (prevAlbum <> itm.AlbumName) then
WS.Cells(i+2,1).Value = itm.ArtistName
WS.Cells(i+2,2).Value = itm.AlbumName
else if (prevArtist == itm.ArtistName) && (prevAlbum <> itm.AlbumName) then
WS.Cells(i+2,1).Value = ""
WS.Cells(i+2,2).Value = itm.AlbumName
else
end if
end if
prevArtist = itm.ArtistName
prevAlbum = itm.AlbumName
Progress.Value = i+1
if Progress.Terminate then
Exit For
end if
next
Any ideas?
Well I would need to check the naming conventions of VBscript. What I'm not sure about are these:
<> means not
== means equal
&& means and
else if is the construction for multiple if statement
Need to check those codes.
can probably be replaced with just one end if. At least the double end if needs to be reduced to one as you are only closing one if statement.
<> means not
== means equal
&& means and
else if is the construction for multiple if statement
Need to check those codes.
Code: Select all
else
end if
end if
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Can you have just
Even though there is no command for the else?
Code: Select all
else
end if
You probably code (probably no errors will appear), but it is bad practice. And remember that the program will run thru that code each time the others don't execute, which will be many times (10-20 times for an average album). So this could lead to longer execution time of the script.
Anyway your script itself would work, except that it is inefficient, as it keeps writing empty rows which are deleted again.
Anyway your script itself would work, except that it is inefficient, as it keeps writing empty rows which are deleted again.
Download MediaMonkey | License
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
Help: Knowledge Base | MediaMonkey for Windows 5 | MediaMonkey for Android
Lowlander (MediaMonkey user since 2003)
What about this?
This one doesn't add blank spaces, and still moves the list up.
Tell me what you think
Tell me what you think
Code: Select all
' Iterate through the list and export all songs
Progress.MaxValue = list.count
Dim i, itm
Dim prevArtist, prevAlbum, j
for i=0 to list.count-1
Set itm = list.Item(i)
if prevArtist <> itm.ArtistName then
WS.Cells(i+2-j,1).Value = itm.ArtistName
end if
if prevAlbum <> itm.AlbumName then
WS.Cells(i+2-j,2).Value = itm.AlbumName
else
j=j+1
end if
prevArtist = itm.ArtistName
prevAlbum = itm.AlbumName
Progress.Value = i+1
if Progress.Terminate then
Exit For
end if
next