' MacroName: UpdateHoldings ' MacroDescription: Input a list of OCLC record #'s and macro ' will update holdings of each in turn ' Macro written by: Joel Hahn, Niles Public Library District Declare Sub Update(Agency$) sub main ' Set up session abbreviation & variable strings Dim CS as session 'Set up "CS" as an alternative Set CS = CurrentSession 'to "CurrentSession" Dim Check$, DelNums$, RecNum$, TestNum$, TestNum2$, Agency$ 'Put your library's four-letter holdings code here Agency$="####" On Error Goto Errhandler ' Set up input window, get input Begin Dialog UHolds 320, 52 Caption "OCLC records to update holdings for" Text 1, 1, 140, 11, "Drop '#', separate numbers with '+'" Text 14, 13, 50, 11, "OCLC #'s:" TextBox 50, 13, 212, 11, .Nums OkButton 5, 28, 40, 20 CancelButton 55, 28, 40, 20 End Dialog Dim NChoice as UHolds Dialog NChoice ' Count total of entered record numbers c=1 Check$="+" TestNum$=NChoice.Nums place=0 Do place=InStr(place+1, TestNum$, Check$) If place<>0 then c=c+1 Loop While place<>0 'Main loop cc=1 Do If GetField(NChoice.Nums,cc,"+")="" then goto Looper RecNum$="#"+GetField(NChoice.Nums,cc,"+") CS.PutText RecNum$, 1, 1 RunMacro "PRSMUTIL!SendCommand" Goto Choice Ret: 'Choice "Ok" return point #1 Call Update(Agency$) Looper: 'Choice "Skip" return point. cc=cc+1 Loop Until cc>=c+1 Goto done 'Go to the end of the macro 'Choose whether to continue with procedure on current record, 'skip current record and go on to the next, or abort altogether Choice: Begin Dialog Glitch 320, 100, 44, 65 Caption "Stopper" ButtonGroup .bg PushButton 2, 2, 40, 20, "Ok" PushButton 2, 22, 40, 20, "Skip" PushButton 2, 42, 40, 20, "Quit" End Dialog Dim Stopper as Glitch Dialog Stopper SChoices=Stopper.bg Select Case SChoices Case 2 'Quit Goto done 'End macro Case 1 'Skip Goto Looper Case 0 Goto Ret End Select ErrHandler: MsgBox "Error " & Err & "(" & Erl & "): " & Error Resume done done: end sub sub Update(Agency$) Dim CS as session Set CS = CurrentSession CS.PutText "tag 049", 1, 1 RunMacro "PRSMUTIL!SendCommand" CS.PutText Agency$, 6, 16 CS.ToggleEdit ' Send an Alt-F10 to send the changes RunMacro "PRSMUTIL!SendEdits" ' Automatically update record CS.PutText "u", 1, 1 RunMacro "PRSMUTIL!SendCommand" end sub