iView home page
iView Multimedia Forum Index

FAQ FAQ     SearchSearch     MemberlistMemberlist     UsergroupsUsergroups    RegisterRegister  
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cleaning up Copyright "wierd" character

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> VB Script
View previous topic :: View next topic  
Author Message
ojaste



Joined: 23 Dec 2005
Posts: 60
Location: Toronto, Ontario

PostPosted: Sat Nov 04, 2006 1:16 am    Post subject: Cleaning up Copyright "wierd" character Reply with quote

Here is a neat way to clean on the replace "wierd" "" that often is in the beginning of the Copyright annotation when you copy from one media item to another.

Add the following expression around the use of the CopyrightNotice annotation.

Replace(ivItem.Annotations.CopyrightNotice, "", "")

A kludge, but it works.
_________________
\marty
www.perspectva.com
Back to top
View user's profile Send private message Visit poster's website
Barbatto



Joined: 03 Sep 2006
Posts: 7
Location: Southern California

PostPosted: Sat Nov 04, 2006 8:05 am    Post subject: Reply with quote

Any idea what causes that to appear in the first place?
Back to top
View user's profile Send private message
ojaste



Joined: 23 Dec 2005
Posts: 60
Location: Toronto, Ontario

PostPosted: Sat Nov 04, 2006 2:57 pm    Post subject: Reply with quote

That I wish I really knew the answer to that, but I have little time to find out. I suspect it happens when I enter the symbol.

This will show up if you use any of the VB scripts that copy annotations from one image to another, like the one provided by IView ("Copy from Items with Same Name.vbs") and others written by John B.

I am trying to convert an archive to DNG from NEF and a lot of the images are in many sub-folders levels (3-4 levels) and a large percentage of the media is older and such been edited by various tools. So when I did the convert to DNG (via DNG converter), many of the annotations in IVMP associated with the NEF files were not copied over; thus the need to run the "Copy from Items with Same Name.vbs" to copy the annotations from the IVMP to the DNG.

When I did that, the "" showed up in many (>50%) of the media's Copyright field. I could have gone through and corrected all of them by hand, but that was too painful. So I modified the VB script to edit the "" out when the annotations are copied. Now I can use DNG converter, which works on sub-folders, then run the "Copy from Items with Same Name.vbs" on a "union selection" of media to copy all annotations in IVMP the DNG, without any post-processing editing.

The only other viable and reliable way of duplicating the annotations is to first extract the metadata into a XMP file, then run DNG Converter. The problem with this way is it will over write any existing XMP files and the IVMP ExtractMetaData does not work on sub-folders structures, only on a single folder. This means I had to do the extract for each sub-folder, run DNG Converter and Import for each sub-folder. Now I can run DNG Converter, import/update and then run the script without any worries.

BTW: the "Copy from Items with Same Name.vbs", still does NOT COPY all the annotations and I had to modify it to include them. Below is the VBScript I now use.

Code:
Option Explicit

Const kMsgBoxTitle = "iView MediaPro"
Dim app, mediaItems, selectedMediaItem, mediaItem, filename1, filename2, ann1, ann2, i, custCount

' display an about box
If (MsgBox("This script will copy annotations of selected items to items of the same name" +VbCr + "but with different suffix, or having the same full name in other folders.", 65, kMsgBoxTitle) = vbOk) Then
   Main()
End If

Sub Main()
   Set app = CreateObject("iView.Application")

   ' get the active catalog
   If (app.Catalogs.count = 0) Then
      MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle
   Elseif (app.ActiveCatalog.Selection.Count = 0) Then
      MsgBox "You need to select at least one media item in the active catalog in order to use this script.", vbCritical, kMsgBoxTitle
   Else
       custCount = app.ActiveCatalog.CustomFields.Count
      
      For Each selectedMediaItem In app.ActiveCatalog.Selection
         For Each mediaItem In app.ActiveCatalog.MediaItems
             If (mediaItem.Selected = False) Then
                 filename1 = Left(mediaItem.Name, InStrRev(mediaItem.Name, ".") - 1)
                 filename2 = Left(selectedMediaItem.Name, InStrRev(selectedMediaItem.Name, ".") - 1)

                    If (filename1 = filename2) Then
                        mediaItem.Label = selectedMediaItem.Label
                        mediaItem.Rating = selectedMediaItem.Rating
                        mediaItem.Annotations.Description = selectedMediaItem.Annotations.Description
                        mediaItem.Annotations.DescriptionWriter = selectedMediaItem.Annotations.DescriptionWriter
                        mediaItem.Annotations.Headline = selectedMediaItem.Annotations.Headline
                        mediaItem.Annotations.Instructions = selectedMediaItem.Annotations.Instructions
                        mediaItem.Annotations.Creator = selectedMediaItem.Annotations.Creator
                        mediaItem.Annotations.CreatorTitle = selectedMediaItem.Annotations.CreatorTitle
                        mediaItem.Annotations.CreatorAddress = selectedMediaItem.Annotations.CreatorAddress
                        mediaItem.Annotations.CreatorCity = selectedMediaItem.Annotations.CreatorCity
                        mediaItem.Annotations.CreatorCountry = selectedMediaItem.Annotations.CreatorCountry
                        mediaItem.Annotations.CreatorEmail = selectedMediaItem.Annotations.CreatorEmail
                        mediaItem.Annotations.CreatorPhone = selectedMediaItem.Annotations.CreatorPhone
                        mediaItem.Annotations.CreatorPostcode = selectedMediaItem.Annotations.CreatorPostcode
                        mediaItem.Annotations.CreatorState = selectedMediaItem.Annotations.CreatorState
                        mediaItem.Annotations.CreatorURL = selectedMediaItem.Annotations.CreatorURL
                        mediaItem.Annotations.Provider = selectedMediaItem.Annotations.Provider
                        mediaItem.Annotations.Source = selectedMediaItem.Annotations.Source
                        mediaItem.Annotations.Title = selectedMediaItem.Annotations.Title
                        mediaItem.Annotations.City = selectedMediaItem.Annotations.City
                        mediaItem.Annotations.State = selectedMediaItem.Annotations.State
                        mediaItem.Annotations.Country = selectedMediaItem.Annotations.Country
                        mediaItem.Annotations.CountryCode = selectedMediaItem.Annotations.CountryCode
                        mediaItem.Annotations.JobIdentifier = selectedMediaItem.Annotations.JobIdentifier
                        mediaItem.Annotations.Category = selectedMediaItem.Annotations.Category
                        mediaItem.Annotations.IntellectualGenre = selectedMediaItem.Annotations.IntellectualGenre
                        mediaItem.Annotations.CopyrightNotice = replace (selectedMediaItem.Annotations.CopyrightNotice, "", "")
                        mediaItem.Annotations.Status = selectedMediaItem.Annotations.Status
                        mediaItem.Annotations.Event = selectedMediaItem.Annotations.Event
                        mediaItem.Annotations.Location = selectedMediaItem.Annotations.Location
                        mediaItem.Annotations.DateCreated = selectedMediaItem.Annotations.DateCreated
                        mediaItem.Annotations.Categories = selectedMediaItem.Annotations.Categories
                        mediaItem.Annotations.Keywords = selectedMediaItem.Annotations.Keywords
                        mediaItem.Annotations.People = selectedMediaItem.Annotations.People
                        mediaItem.Annotations.Scenes = selectedMediaItem.Annotations.Scenes
                        mediaItem.Annotations.SubjectCodes = selectedMediaItem.Annotations.SubjectCodes
                        mediaItem.Annotations.URL = selectedMediaItem.Annotations.URL
                        mediaItem.Annotations.UsageTerms = selectedMediaItem.Annotations.UsageTerms
                       
                        For i = 1 To ivItem.CustomFields.Count
                            mediaItem.CustomFields(i).Value = selectedMediaItem.CustomFields(i).Value
                        Next

                    End If
             End If
          Next
        Next
   
   End If

End Sub


/Marty

(PS: I've submitted a suggestion to Microsoft to add the sub-folder functionality and to include the ExtractMetaData function for VBScripting. I'm sure they will consider it.)

UPDATE: 5 Nov 05. I noticed that the custom fields are NOT copied also. This is a bug inthe IVMP original code also. I've corrected the code above.
_________________
\marty
www.perspectva.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> VB Script All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



  © iView Multimedia Ltd. | All Rights Reserved Privacy Policy | Copyright | Site Map