' MacroName: DeleteHoldings ' MacroDescription: Takes an input list of OCLC #'s and ' deletes holdings on each record in turn ' Macro written by: Joel Hahn, Niles Public Library District sub main ' Set up session abbreviation & variable strings dim CS as session set CS = CurrentSession Dim Check$, DelNums$, RecNum$, TestNum$, TestNum2$ On Error Goto ErrHandler ' Set up input window, get input Begin Dialog DHolds 320, 52 Caption "OCLC records to delete 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 DHolds dialog NChoice ' Count total of entered record numbers c=1 Check$="+" TestNum$=NChoice.Nums For i=1 to Len(TestNum$) TestNum2$=Mid(TestNum$,i,1) If Asc(TestNum2$)=Asc(Check$) Then c=c+1 Next i '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 CS.PutText "delh", 1, 1 RunMacro "PRSMUTIL!SendCommand" 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 'Ok Goto Ret End Select ErrHandler: MsgBox "Error " & Err & "(" & Erl & "): " & Error Resume done done: end sub