' MacroName: UpdateFileMake ' MacroDescription: Make a file of OCLC numbers of records to have OCLC holdings updated ' Macro created by: Joel Hahn, Niles Public Library District sub main '! Add the OCLC number of the current record to a file to be updated in OCLC. Dim CS as Session Set CS = CurrentSession Agency$="KAJA" Dim nContinue as Integer Dim nTimeOut as Integer ' The default timeout for each command is 1 minute. ' Increase this value if your host requires more time ' for each command. nTimeOut = 60 CS.GetTextInRegion CheckScreen, 3, 30, 3, 59 'CheckScreen=Session.ScreenText(3, 30, 1, 30) If InStr(1,CheckScreen,"Brief Titles")<1 Then MsgBox "Please go the Brief Titles screen, select the record, and try again." Goto Done End if CS.Send Chr(1)+"g" '[S-F7] CS.Receive nTimeOut, chr(27) + "[?25h" CS.GetTextInRegion CheckScreen, 12, 12, 12, 44 'CheckScreen=Session.ScreenText(12, 12, 1, 33) If InStr(1,CheckScreen, "You must make a selection before") Then MsgBox "Please select the record, and try again." CS.Send " " Goto Done End If CS.GetTextInRegion CheckScreen, 10, 24, 10, 60 'CheckScreen=Session.ScreenText(10, 24, 1, 37) If InStr(1,CheckScreen, "This record is currently locked by") Then MsgBox "Someone else is using the record; please try again later." CS.Send " " Goto Done End If CS.GetTextInRegion CheckTag, 7, 17, 7, 19 'CheckTag=Session.ScreenText(7,17,1,3) If CheckTag<>"001" Then Goto BadRec End If CS.GetTextInRegion OCLCNum$, 7, 27, 7, 56 OCLCNum$=Trim(OCLCNum$) 'OCLCNum$=Trim(Session.ScreenText(7,27,1,30)) If InStr(1,OCLCNum$, "Fix me") Then Goto BadRec End If If Left(OCLCNum$,3)="cls" Then Goto BadRec ElseIf Left(OCLCNum$,3)="ocm" Then OCLCNum$=Right(OCLCNum$, Len(OCLCNum$)-3) End If If Len(OCLCNum$)<>8 Then Goto BadRec End If If Val(Left(OCLCNum$,3))>300 Then i=9 Do CS.GetTextInRegion CheckTag, i, 17, i, 19 'CheckTag=Session.ScreenText(i,17,1,3) If CheckTag="010" Then CS.GetTextInRegion CheckLN$, i, 30, i, 56 CheckLN$=Trim(CheckLN$) 'CheckLN$=Trim(Session.ScreenText(i,30,1,27)) Exit Do End If i=i+9 Loop While i<15 If OCLCNum$=CheckLN$ Then Goto BadRec End If ElseIf Val(Left(OCLCNum$,3))>600 Then Goto BadRec End If NumSessions%=GetNumSessions() If NumSessions%>1 Then Dim OCLC as Session Dim CCS as Session FoundOCLC=0 CurrentSession.GetName CurSession$ For i=1 to NumSessions% Set CCS=GetSession(i) CCS.GetName SessionName$ If SessionName$="Telnet to OCLC" Then Set OCLC=CCS FoundOCLC=1 ElseIf SessionName$="Telnet to CCS" Then Set CS=CCS End If Next i If FoundOCLC=1 Then Set CurrentSession=OCLC OCLC.PutText "#"+OCLCNum$, 1, 1 RunMacro "PRSMUTIL!SendCommand" OCLC.PutText "tag 049" RunMacro "PRSMUTIL!SendCommand" OCLC.PutText "KAJA", 6, 16 OCLC.ToggleEdit OCLC.PutText "u", 1, 1 RunMacro "PRSMUTIL!SendCommand" Set CurrentSession=CS Else filename$="G:\UPDATE.TXT" filenum%=FreeFile Open filename$ For Append As filenum% Print #filenum%, OCLCNum$ Close filenum% CS.Send chr(1)+"C" '[F3] CS.Receive nTimeOut, chr(27) + "[?25h" End If Else filename$="G:\UPDATE.TXT" filenum%=FreeFile Open filename$ For Append As filenum% Print #filenum%, OCLCNum$ Close filenum% CS.Send chr(1)+"C" '[F3] CS.Receive nTimeOut, chr(27) + "[?25h" End If Goto Done BadRec: MsgBox "Please put the printout aside, to be updated manually." CS.Send chr(1)+"C" '[F3] CS.Receive nTimeOut, chr(27) + "[?25h" Done: End Sub