'MacroName:CoverTitle 'MacroDescription:Converts phrase "Cover title" to "Title from cover." ' ' This macro was written by Walter F. Nickeson, ' University of Rochester, Rochester, NY ' wnickeson@library.rochester.edu ' ' Last updated: 27 October 2006. ' Check for the latest versions of this and my other macros at ' http://docushare.lib.rochester.edu/docushare/dsweb/View/Collection-2556 ' Please e-mail me with bug reports or to suggest improvements. ' ' Works in Connexion client 2.10. ' '*************************************************************** ' How it works: This macro converts the note "Cover title." in a ' 500 field of a bibliographic record to "Title from cover." If ' such a note is not found, the macro will offer to add it. ' Cursor position is irrelevant when running this macro. '*************************************************************** Option Explicit Sub Main Dim CS As Object Set CS = CreateObject("Connex.Client") Dim BoxLabel$ : BoxLabel$ = "Search for " & Chr$( 034 ) & "Cover title" & Chr$( 034 ) Dim BoxMessage$ : BoxMessage$ = Chr$( 034 ) & "Cover title" & Chr$( 034 ) & " note not found. Add?" Dim Field$ Dim Answer% Dim Instance% : Instance% = 1 Dim TypeOfWindow% Dim Result : Result = TRUE ' First, make sure that a bibliographic record is displayed TypeOfWindow% = CS.ItemType Select Case TypeOfWindow% Case 0 To 2, 17, 19 GoTo Continue: Case Else MsgBox "This macro only works in a bibliographic record!", 48, "Macro cannot proceed" GoTo Done: End Select Continue: ' Cycle through all the 500 fields looking for the phrase "Cover ' title." If found, replace it with "Title from cover." If not ' found, offer to add the note "Title from cover." If that note ' is already on the record, do nothing Do Result = CS.GetField( "500", Instance%, Field$ ) If Result = TRUE Then If Field$ = "500 Cover title." or Field$ = "500 Cover-title." Then If CS.SetField( Instance%, "500 Title from cover." ) = FALSE Then MsgBox "Sorry, could not change note.", 64, "Macro failed" GoTo Done: Else GoTo Done: End If ElseIf Field$ = "500 Title from cover." Then GoTo Done: Else Instance% = Instance% + 1 End If Else Exit Do End If Loop Until Result = FALSE Answer% = MsgBox( BoxMessage$, 68, BoxLabel$ ) If Answer% = 6 Then If CS.AddField( 1, "500 Title from cover." ) = FALSE Then MsgBox "Sorry, could not add note.", 64, "Macro failed" End If Done: End Sub