'======================================================================================== 'by John Beardsworth 04/8/06 'version 1.4 'Loops through selected media items 'looks for files with one extension, finds files with same name but other extension 'and copies the metadata from the other '======================================================================================== Const kMsgBoxTitle = "Files with identical names" Const ivTargetDefault= "dng" Const ivFromDefault = "nef" Const pmtFrom = "What extension contains the source metadata?" Const pmtTarget = "What is the extension of the files you want to update?" Const pmtSuffix = "Don't include the dot - ie write NEF not .NEF" ivFrom = InputBox(pmtFrom & vbCrLf & vbCrLf & pmtSuffix, kMsgBoxTitle, ivFromDefault) If ivFrom <> "" Then ivTarget = InputBox(pmtTarget & vbCrLf & vbCrLf & pmtSuffix, kMsgBoxTitle, ivTargetDefault) end if if ivFrom ="" or ivTarget ="" then else Main() end if Sub Main() Set ivApp = CreateObject("iView.Application") ivFrom = Lcase(ivFrom) ivTarget = LCase(ivTarget) ' get the active catalog If (ivApp.Catalogs.Count = 0) Then MsgBox "Please launch Iview MediaPro.", vbCritical, kMsgBoxTitle Exit Sub Else Set ivCat = ivApp.ActiveCatalog End If 'check we've selected at least one ivCount = ivCat.Selection.Count If (ivCount <= 1) Then MsgBox "You need to select at least two media item in the active catalog in order to use this script.", vbCritical, kMsgBoxTitle Exit Sub Else 'build an array to hold the filenames Dim ivItems() ReDim ivItems(ivCount) For i = 1 To ivCount ivItems(i) = ivCat.Selection(i).Name Next End If For Each ivItemTarget In ivCat.Selection 'Debug.Print ivItemTarget.Name & " " & LCase(ivTarget) & " " & LCase(Right(ivItemTarget.Name, 3)) If LCase(Right(ivItemTarget.Name, 3)) = LCase(ivTarget) Then i = ArrayItem(ivItems, ivItemTarget.Name) If i = False Then LogTxt = LogTxt & ivItemTarget.Name & vbCrLf Else Set ivItemFrom = ivCat.MediaItems(i) With ivItemTarget.Annotations .AnnotationWriter = ivItemFrom.Annotations.AnnotationWriter .Author = ivItemFrom.Annotations.Author .AuthorTitle = ivItemFrom.Annotations.AuthorTitle .Caption = ivItemFrom.Annotations.Caption .Categories = ivItemFrom.Annotations.Categories .Copyright = ivItemFrom.Annotations.Copyright .CopyrightNotice = CSTR(ivItemFrom.Annotations.CopyrightNotice) .Creator = ivItemFrom.Annotations.Creator .CreatorAddress = ivItemFrom.Annotations.CreatorAddress .CreatorCity = ivItemFrom.Annotations.CreatorCity .CreatorCountry = ivItemFrom.Annotations.CreatorCountry .CreatorEmail = ivItemFrom.Annotations.CreatorEmail .CreatorPhone = ivItemFrom.Annotations.CreatorPhone .CreatorPostcode = ivItemFrom.Annotations.CreatorPostcode .CreatorState = ivItemFrom.Annotations.CreatorState .CreatorTitle = ivItemFrom.Annotations.CreatorTitle .CreatorURL = ivItemFrom.Annotations.CreatorURL .Credit = ivItemFrom.Annotations.Credit .DateCreated = ivItemFrom.Annotations.DateCreated .Description = ivItemFrom.Annotations.Description .Event = ivItemFrom.Annotations.Event .EventDate = ivItemFrom.Annotations.EventDate .Genre = ivItemFrom.Annotations.Genre .Headline = ivItemFrom.Annotations.Headline .Instructions = ivItemFrom.Annotations.Instructions .IntellectualGenre = ivItemFrom.Annotations.IntellectualGenre .Keywords = ivItemFrom.Annotations.Keywords .Country = ivItemFrom.Annotations.Country .City = ivItemFrom.Annotations.City .State = ivItemFrom.Annotations.State .Location = ivItemFrom.Annotations.Location .People = ivItemFrom.Annotations.People .Provider = ivItemFrom.Annotations.Provider .Source = ivItemFrom.Annotations.Source .Status = ivItemFrom.Annotations.Status .Title = ivItemFrom.Annotations.Title .Transmission = ivItemFrom.Annotations.Transmission .URL = ivItemFrom.Annotations.URL .UsageTerms = ivItemFrom.Annotations.UsageTerms End With 'label ivItemTarget.LabelIndex = ivItemFrom.LabelIndex ivItemTarget.Rating = ivItemFrom.Rating On Error Resume Next With ivItemTarget .CustomFields(1).Value = ivItemFrom.CustomFields(1).Value .CustomFields(2).Value = ivItemFrom.CustomFields(2).Value .CustomFields(3).Value = ivItemFrom.CustomFields(3).Value .CustomFields(4).Value = ivItemFrom.CustomFields(4).Value .CustomFields(5).Value = ivItemFrom.CustomFields(5).Value .CustomFields(6).Value = ivItemFrom.CustomFields(6).Value .CustomFields(7).Value = ivItemFrom.CustomFields(7).Value .CustomFields(8).Value = ivItemFrom.CustomFields(8).Value .CustomFields(9).Value = ivItemFrom.CustomFields(9).Value .CustomFields(10).Value = ivItemFrom.CustomFields(10).Value .CustomFields(11).Value = ivItemFrom.CustomFields(11).Value .CustomFields(12).Value = ivItemFrom.CustomFields(12).Value .CustomFields(13).Value = ivItemFrom.CustomFields(13).Value .CustomFields(14).Value = ivItemFrom.CustomFields(14).Value .CustomFields(15).Value = ivItemFrom.CustomFields(15).Value .CustomFields(16).Value = ivItemFrom.CustomFields(16).Value End With End If On Error GoTo 0 End If Next If LogTxt = "" Then MsgBox "Done", vbOKOnly, kMsgBoxTitle Else MsgBox "Problems with these items. Were both files selected?" & vbCrLf & LogTxt, vbOKOnly + vbQuestion, kMsgBoxTitle End If End Sub Function ArrayItem(ArrayItems, ivFile) ivFindFile = LCase(Replace(ivFile, ivTarget, ivFrom, vbTextCompare)) For i = 1 To UBound(ArrayItems) If LCase(ArrayItems(i)) = ivFindFile Then ArrayItem = i Exit Function End If Next ArrayItem = False End Function