Page 6 of 11

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Mon Jul 21, 2008 8:59 pm
by meric
Thanks! My scripting skills are rudimentary and very rusty but I was determined to make the script work somehow! After changing that line, it worked great. Thanks for saving me hours of work!

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sat Aug 30, 2008 12:06 pm
by wavicle3
The script works great.

On my Vista machine I had the same VB script error, line 429.

Right clicking the MM icon, and choosing "Run as Administrator" solved the problem, as someone in this forum suggested.

Thank you!

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Mon Sep 15, 2008 2:58 pm
by landoranon
the explanation at "http://www.mediamonkey.com/wiki/index.p ... w_computer" and the scropt worked perfectly. I had over 13,000 files to manage. It took less than 30 seconds to convert the MM library from one drive to another.

Well Done! and thanks again.

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Thu Sep 18, 2008 1:12 am
by MickRob
Many thanks for your great script - it was really easy to transfer my MM database containing nearly 40,000 songs to a larger HD.

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sat Sep 20, 2008 11:15 am
by Benn
Thank you, just about to use this. So, whether I've used this or not, am I right to assume that changing the drive letter only doesn't grey the tracks out?

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sat Sep 20, 2008 5:01 pm
by MoDementia
Yes changing drive letters will not require this script.
It is only for swapping physical drives (upgrades etc)
If the change in letter is the result of partitioning the drive the script will probably be required

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sun Sep 21, 2008 11:19 am
by Benn
Yeah I installed a new drive, moved my music to that, then de-partitioned my old drive, then changed the letter of my new drive again to make it all neat and tidy...

Worked flawlessly, thank you.

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Thu Nov 13, 2008 9:06 am
by tatoosh
i need something that do this:

move from mapped network drive to external hdd - how to do so?
thanks!

okay solved it this way:
i opened the database file with SQLLiteBrowser http://sqlitebrowser.sourceforge.net/
go to Table MEDIAS
then i changed the SERIAL NUMBER, DRIVE TYPE, LABEL and SHOW LABEL to the new Drive
Image

I got the values for the new drive the same way. Just put some files in the database and the read out your serial number (drive id).
fast solution!!

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Fri Dec 19, 2008 2:16 pm
by theunderwaterdog
I have followed the instructions but when i try to save the script.ini with the update i get an error message saying 'Cannont create the C:\...\script.ini file. Make sure that the path and file name are correct.' Anyone any ideas? Thanks

PS I'm using Vista home premium - could this be the cause?

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sat Dec 20, 2008 5:45 am
by tatoosh
i will write a little programm which can do the changes automatical.
but i am new in pogramming, so it will took a while ;)

i will give u the link, when i has finished.

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sun Dec 21, 2008 8:37 am
by tatoosh
Now i have finished my little work:
You can download my software here. Please make a Backup of MM.DB before you use this.

MediaMonkey3 DB Drive Changer v0.1:
Image
Download http://www.tatoosh.de/download/MM3-DBDCv0.1.zip

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sun Dec 21, 2008 8:39 am
by nynaevelan
There are already two scripts which do this, what is different about yours? And you should probably add yours to it's own thread explaining how to use it.

Nyn

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Sun Dec 21, 2008 9:00 am
by tatoosh
okay i didnt know there are other scripts for it.
i posted it as a new script with a short description: http://www.mediamonkey.com/forum/viewto ... =2&t=35197

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Mon Jan 12, 2009 12:20 pm
by unnicorn
hi,

Can someone please paste the code that I need to paste in MM_HDDSerial.vbs

Right now when I click on move device content I get an error message.

Thanks

Re: [MM2+3] Change Drive-ID after moving Files to a new Drive

Posted: Mon Jan 12, 2009 12:47 pm
by nynaevelan
It should be in the first post but if not here it is:

Code: Select all

'1. Shutdown MediaMonkey

'2. Create the follwing Lines (without 'REM ' )  in MediaMonkey\Scripts\Scripts.ini:
REM [HDDSerial]
REM FileName=MM_HDDSerial.vbs
REM ProcName=Change_HDD_Serial
REM Order=99
REM DisplayName=Move Device Content
REM Description=Corrects broken links after exchanged harddrive
REM Language=VBScript
REM ScriptType=0

'3.  Restart MediaMonkey
'4. Make sure every Device (harddrive) has a Label (Library -> Location)
'5. Select Tools -> Scripts -> Move Device Content
'6. Select on the left side the old device (harddrive)
'7. Select on the right side the new drive
'8. OK
'9. Restart MediaMonkey

'Now MediaMonkey should find all the files which where located on the old drive and are now on the new one.

Option Explicit

Sub Change_HDD_Serial()
  Const PanelWidth = 200
  Const PanelHeight = 100
  Const objSpace = 10
  
  Dim cntMedias
  Dim arrRadioMedia()
  Dim arrRadioMediaID()
  Dim cntDrives
  Dim arrRadioDrive()
  Dim arrRadioDriveLetter()
  Dim arrRadioDriveSN()
  Dim arrRadioDriveTypes()

  Dim SDB
  Set SDB = CreateObject("SongsDB.SDBApplication")
  Dim FSO
  Set FSO = CreateObject("Scripting.FileSystemObject")
  Dim UI
  Set UI = SDB.UI

  'Create the window to be shown
  Dim Form
  Set Form = UI.NewForm
  Form.Common.ClientWidth = objSpace + PanelWidth + objSpace + PanelWidth + objSpace
  Form.FormPosition = 4   ' Screen Center
  Form.BorderStyle = 3    ' Dialog
  Form.Caption = "Move MediaMonkey's Device Content"
  
  Dim Label
  Set Label = UI.NewLabel(Form)
  Label.Caption = "from ..."
  Label.Common.Top = objSpace
  Label.Common.Left = objSpace
  Label.Common.Width = PanelWidth
  
  Set Label = UI.NewLabel(Form)
  Label.Caption = "to ..."
  Label.Common.Top = objSpace
  Label.Common.Left = objSpace + PanelWidth + objSpace
  Label.Common.Width = PanelWidth
  
  Dim PanelMedia
  Set PanelMedia = UI.NewPanel(Form)
  PanelMedia.Common.SetRect objSpace, objSpace + Label.Common.Height + objSpace, PanelWidth, PanelHeight
  
  'Add Medias
  Dim ds
  Dim RadioBtn
  Dim BtnTop
  Dim Caption
  
  BtnTop = 0
  cntMedias = 0
  Set ds = SDB.DataBase.OpenSQL("SELECT * FROM Medias WHERE DriveType < 10")
  While Not ds.EOF
    Caption = ""
    'If ds.StringByName("Driveletter") <> "" Then Caption = Chr(ds.ValueByName("DriveLetter") + 65) & ": "
    If ds.StringByName("Label") <> "" Then
      'If Caption <> "" Then Caption = Caption & "- "
      Caption = Caption & ds.StringByName("Label")
    End If
    If ds.StringByName("ShowLabel") <> "" Then
      If Caption <> "" Then Caption = Caption & "- "
      Caption = Caption & ds.StringByName("ShowLabel")
    End If
    If Caption = "" Then Caption = ds.StringByName("Comment")
    
    Set RadioBtn = UI.NewRadioButton(PanelMedia)
    RadioBtn.Common.Top = BtnTop
    RadioBtn.Common.Width = PanelWidth
    BtnTop = BtnTop + RadioBtn.Common.Height + 3
    PanelMedia.Common.ClientHeight = BtnTop
    RadioBtn.Caption = Caption
    RadioBtn.Common.Hint = ds.StringByName("Comment")
    
    cntMedias = cntMedias + 1
    ReDim Preserve arrRadioMedia(cntMedias)
    ReDim Preserve arrRadioMediaID(cntMedias)
    Set arrRadioMedia(cntMedias) = RadioBtn
    arrRadioMediaID(cntMedias) = ds.ValueByName("IDMedia")
    
    ds.Next
  Wend
  
  Dim PanelDrives
  Set PanelDrives = UI.NewPanel(Form)
  PanelDrives.Common.SetRect objSpace + PanelWidth + objSpace, objSpace + Label.Common.Height + objSpace, PanelWidth, PanelHeight
  
  'Add DriveLetters
  BtnTop = 0
  cntDrives = 0
  Dim Drive
  For Each Drive In FSO.Drives
    If Drive.IsReady Then
      Caption = Drive.DriveLetter & ":"
      Caption = Caption & " - " & Drive.VolumeName
    
      Set RadioBtn = UI.NewRadioButton(PanelDrives)
      RadioBtn.Common.Top = BtnTop
      RadioBtn.Common.Width = PanelWidth
      BtnTop = BtnTop + RadioBtn.Common.Height + 3
      PanelDrives.Common.ClientHeight = BtnTop
      RadioBtn.Caption = Caption
     RadioBtn.Common.Hint = CStr(Drive.SerialNumber) 'TotalSize / 1024 / 1024 / 1024
    
      cntDrives = cntDrives + 1
      ReDim Preserve arrRadioDrive(cntDrives)
      ReDim Preserve arrRadioDriveLetter(cntDrives)
      ReDim Preserve arrRadioDriveSN(cntDrives)
      ReDim Preserve arrRadioDriveTypes(cntDrives)
      Set arrRadioDrive(cntDrives) = RadioBtn
      arrRadioDriveLetter(cntDrives) = Drive.SerialNumber
      arrRadioDriveSN(cntDrives) = Drive.SerialNumber
      arrRadioDriveTypes(cntDrives) = Drive.DriveType + 1
    End If
  Next
  
  If PanelDrives.Common.Height > PanelMedia.Common.Height Then
    BtnTop = PanelDrives.Common.Height
  Else
    BtnTop = PanelMedia.Common.Height
  End If
  
  Set Label = UI.NewLabel(Form)
  Label.Caption = "Only the Database-Entries are updates. The Files aren't moved physically on the Harddisk!"
  Label.Common.Top = objSpace + Label.Common.Height + objSpace + BtnTop + objSpace
  Label.Common.Left = objSpace
  Label.Common.Height = Label.Common.Height * 2
  Label.Common.Width = Form.Common.ClientWidth - objSpace - objSpace
  Label.MultiLine = True
  
  Dim Btn
  Set Btn = UI.NewButton(Form)
  
  BtnTop = Label.Common.Top + Label.Common.Height + objSpace
  
  Btn.Caption = SDB.Localize("&Ok")
  Btn.Common.SetRect objSpace, BtnTop, PanelWidth, 25
  Btn.ModalResult = 1
  Btn.Default = True

  Set Btn = UI.NewButton(Form)
  Btn.Caption = SDB.Localize("&Cancel")
  Btn.Common.SetRect objSpace + PanelWidth + objSpace, BtnTop, PanelWidth, 25
  Btn.ModalResult = 2
  Btn.Cancel = True
  
  Form.Common.ClientHeight = BtnTop + 25 + objSpace
  
  If Form.ShowModal = 1 Then 'OK
    Dim SelMedia     'Media-ID
    Dim SelDrive     'Drive Letter
    Dim selDriveSN   'SerialNumber
    Dim SelDriveType 'Drive Type
    SelMedia = ""
    SelDrive = ""
    
    Dim intTemp
    For intTemp = 1 To cntMedias
      If arrRadioMedia(intTemp).Checked Then SelMedia = arrRadioMediaID(intTemp)
    Next
    For intTemp = 1 To cntDrives
      If arrRadioDrive(intTemp).Checked Then
        SelDrive = arrRadioDriveLetter(intTemp)
        selDriveSN = arrRadioDriveSN(intTemp)
        SelDriveType = arrRadioDriveTypes(intTemp)
      End If
    Next
    
    If (SelDrive <> "") And (SelMedia <> "") Then
      If SDB.MessageBox("Are you really sure?", 0, Array(0, 2)) = 6 Then
        Set ds = SDB.DataBase.OpenSQL("SELECT * FROM Medias WHERE SerialNumber = " & selDriveSN)
        If Not ds.EOF Then
          SDB.DataBase.ExecSQL ("Update Songs set IDMedia = " & ds.StringByName("IDMedia") & " WHERE IDMedia = " & SelMedia)
        Else
          SDB.DataBase.ExecSQL ("Update Medias set SerialNumber = " & selDriveSN & ", DriveType = " & SelDriveType & " WHERE IDMedia = " & SelMedia)
        End If
      SDB.MessageBox "Please restart MediaMonkey", 2, Array(4)
      End If
    End If
  End If
End Sub
Nyn