Passwords and Lost .ini files.

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Passwords and Lost .ini files.

Post by Plethora » Sun Mar 07, 2004 5:44 pm

:oops: I really did it this time
I have apparently deleted my scripts.ini file, can I get another?

Also I have purchased the Life Time Membership for MM, but I can't find my password for registering. I would like toclear my computer out one day but want to be able to reload MM. How can I get this information?

-Thnx

pl3thora

oops

Post by pl3thora » Sun Mar 07, 2004 5:58 pm

I've written a new scripts.ini file, but I am still curious about the password.

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Email support

Post by Lowlander » Sun Mar 07, 2004 6:04 pm

Email support they normally are able to help with lost passwords.
Lowlander (MediaMonkey user since 2003)

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Help Anyone?

Post by Plethora » Sun Mar 07, 2004 7:44 pm

:wink: Hey Lowlander

Can u help me? I know your busy... but I think my problem is simple...

I'm trying to have a script that does something like this...

Artist1___Album1
________Album2
________Album3
Artist2___Album1
________Album2
Artist3___Album1

Any Ideas?

Code: Select all

'  Iterate through the list and export all songs
  Progress.MaxValue = list.count
  Dim i, itm
  for i=0 to list.count-1
    Set itm = list.Item(i)
        if itm.art = itm.ArtistName then
		WS.Cells(i+2,1).Value = "& n b s p ;"
	else
		WS.Cells(i+2,1).Value = itm.ArtistName
	end if
	if itm.alb = itm.AlbmName then
		WS.Cells(i+2,2).Value = "& n b s p ;"
	else
		WS.Cells(i+2,2).Value = itm.AlbumName
	end if
    Set itm.art = itm.ArtistName
    Set itm.alb = itm.AlbumName

    Progress.Value = i+1
    if Progress.Terminate then
      Exit For
    end if
  next
Do I need a "Dim itm.art" at beginning of vbs script?
Or change the varible?

THnx-

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Sun Mar 07, 2004 8:07 pm

Well I'm not sure yet as I got stuck here too. In my HTML scripts post I have tracks from one artist subdivided by album.

http://www.songs-db.com/forum/viewtopic.php?p=2395#2395 but make sure that you read the first post as code from that post is needed too.

A big problem is that I wasn't able to sort export tracks from within the code to export them.

What are you exporting the output to?
Lowlander (MediaMonkey user since 2003)

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Sun Mar 07, 2004 8:11 pm

If itm.AlbumName <> currentalbum Then
fout.WriteLine "<TR><TD COLSPAN=6 ID=album><BR><BR>"&itm.AlbumName&"</TD></TR>"
currentalbum=itm.AlbumName
This part is the key in the code as it checks the new track to be written to the output file is the same as before.

In this case if not the same an output is written.

My question now is if you are just trying to write a list of albums per artist or also the tracks?
Lowlander (MediaMonkey user since 2003)

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

list

Post by Plethora » Sun Mar 07, 2004 8:16 pm

:) the list should just contain the artist subdivided into albums.

Export is to excel.

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
  for i=0 to list.count-1
    Set itm = list.Item(i)
        if itm.art = itm.ArtistName then
		WS.Cells(i+2,1).Value = "&"
	else
		WS.Cells(i+2,1).Value = itm.ArtistName
	end if
	if itm.alb = itm.AlbmName then
		WS.Cells(i+2,2).Value = "&"
	else
		WS.Cells(i+2,2).Value = itm.AlbumName
	end if
    Set itm.art = itm.ArtistName
    Set itm.alb = 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

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Sun Mar 07, 2004 8:17 pm

Outside the for loop (above) you would need to declare the itm.art and itm.alb as done in my script.

It seems you are otherwise on the right track. I haven't tried your script so I can't see whats going on.

You might want to change the names of itm.art & itm.alb as I believe you are referencing an array this way. Use names like currentArtist & currentAlbum.

A limitation of the script is that the list needs to be sorted on artist and than album.

Maybe the program makers can help us on the script to sort the tracklistings in the script itself before using it.
Lowlander (MediaMonkey user since 2003)

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Sun Mar 07, 2004 8:21 pm

I get the idea that you are exporting to excel.
WS.Cells(i+2,1).Value = "& n b s p ;"
the & n b s p ; you can replace most likely by a single space or actually nothing. The & n b s p ; is needed for HTML.
Lowlander (MediaMonkey user since 2003)

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

declaring?

Post by Plethora » Sun Mar 07, 2004 8:21 pm

:oops: Do you mean "Dim" , is that declaring?

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Post by Plethora » Sun Mar 07, 2004 8:23 pm

so this instead?

Code: Select all

' Iterate through the list and export all songs
  Progress.MaxValue = list.count
  Dim i, itm
  for i=0 to list.count-1
    Set itm = list.Item(i)
        if itm.art = itm.ArtistName then
		WS.Cells(i+2,1).Value = ""
	else
		WS.Cells(i+2,1).Value = itm.ArtistName
	end if
	if itm.alb = itm.AlbmName then
		WS.Cells(i+2,2).Value = ""
	else
		WS.Cells(i+2,2).Value = itm.AlbumName
	end if
    Set itm.art = itm.ArtistName
    Set itm.alb = itm.AlbumName

    Progress.Value = i+1
    if Progress.Terminate then
      Exit For
    end if
  next
I Have this in my scripts.ini file

Code: Select all

[Export for Excel]
Filename=Outputlist.vbs
ProcName=ExportXLS
Order=1
DisplayName=Output The List
Language=VBScript
ScriptType=1

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Sun Mar 07, 2004 9:15 pm

Dim variable is a variable declaration
Iterate through the list and export all songs
Progress.MaxValue = list.count
Dim i, itm
Dim currentArtist, currentAlbum
for i=0 to list.count-1
Set itm = list.Item(i)
if currentArtist = itm.ArtistName then
WS.Cells(i+2,1).Value = ""
else
.......
I replaced the itm.art with currentArtist as described before it probably doesn't work with a . in the name. It still would need to be replaced for the remaining code.
I also added the declaration for the currentArtist & currentAlbum.

This should get you closer.


PS remember I haven't had a chance to check code, so problems might still exist.
Lowlander (MediaMonkey user since 2003)

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Post by Plethora » Sun Mar 07, 2004 11:27 pm

:-?

ok so I need to change th variable.

I want the script to save the artist name to "prevartist"

then I want it to go to the next song, and check if "prevartist=itm.artistname"

If they are the same then the script will move on to the Album
If the album is the same then it will skip to next song.

Does this make since? :wink:

I have this so far and it gives me no errors but it doesn't do what I want.

Code: Select all

' Iterate through the list and export all songs
  Progress.MaxValue = list.count
  Dim i, itm
  Dim prevArtist, prevAlbum
  for i=0 to list.count-1
    Set itm = list.Item(i)
    
    WS.Cells(i+2,1).Value = itm.ArtistName
    WS.Cells(i+2,2).Value = itm.AlbumName
    **
    Progress.Value = i+1
    if Progress.Terminate then
      Exit For
    end if
  next
As soon as I put in "Set prevartist = itm.ArtistName" at the ** I get an error.

Am I going at this the wrong way or using the wrong commands?

Lowlander
Posts: 46252
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Sun Mar 07, 2004 11:38 pm

Set prevartist = itm.ArtistName
You can't use set here. It's just prevartist = itm.ArtistName.


As for the rest you actually now miss the check:
if currentArtist = itm.ArtistName then
WS.Cells(i+2,1).Value = ""
else
WS.Cells(i+2,1).Value = itm.ArtistName
end if
and the one for album as well.


Please report what output you do get when posting, might help in analyzing the error.
Lowlander (MediaMonkey user since 2003)

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Beautiful

Post by Plethora » Sun Mar 07, 2004 11:40 pm

:oops:
Did I tell you your beautifullll!!!!

Well you are!!

THnx-

That helped a lot... now for the rest :lol:
Last edited by Plethora on Mon Mar 08, 2004 12:47 am, edited 2 times in total.

Post Reply