' MacroName: ScatSearch ' MacroDescription: Go Forward until a particular scat is found ' Written by: Joel Hahn, Niles Public Library District Sub main ' Go forward (F8) a certain number of records or items Dim CS as session Set CS = CurrentSession Dim nTimeOut as Integer nTimeOut = 60 CS.GetTextInRegion CallerCheck$, 3, 1, 3, 79 If InStr(1, CallerCheck$, "BIB/ITEM MAINTENANCE - Call Number Search")=0 Then MsgBox "You are not viewing a call number search" Goto Done End If CS.GetTextInRegion ScnText, 2, 65, 2, 80 place=InStr(ScnText, " of ") j=1 Do while j<=place If Mid(ScnText, j, 1) Like "[0-9]" Then place2=j Exit Do End If j=j+1 Loop CurrRec=Val(Mid(ScnText, place2, place-place2)) 'EndRec=Val(Right(ScnText, Len(ScnText)-place-3)) EndRec=Val(Mid(ScnText, place+3, Len(ScnText)-place-2)) CS.GetTextInRegion CurrScat$, 11, 58, 11, 63 CurrScat$=Trim(CurrScat$) DoDialog: Begin Dialog UserDialog 119, 45, "Find Scats" Text 4, 8, 70, 8, "Type the scat to find:" TextBox 76, 6, 36, 12, .Num OkButton 28, 24, 40, 14 CancelButton 72, 24, 40, 14 End Dialog Dim Recs as UserDialog Recs.Num = CurrScat$ z = Dialog(Recs) If z = 0 Then Goto Done a$=Recs.Num i=1 : alph=0 Do If Mid(a$, i, 1) Like "[!0-9]" Then alph=1 Exit Do End If i=i+1 Loop While i<=Len(a$) If (alph=1 or a$="") Then MsgBox "Numbers only, please." Goto DoDialog End If ' total=Val(Recs.Num) ' If total>EndRec-CurrRec Then total=EndRec-CurrRec total=EndRec-CurrRec CS.GetTextInRegion CheckScat$, 11, 58, 11, 63 CheckScat$=Trim(CheckScat$) curr=1 Do While CheckScat$<>Recs.Num And curr<=total CS.GetTextInRegion CheckScat$, 11, 58, 11, 63 CheckScat$=Trim(CheckScat$) 'MsgBox CheckScat$ If CheckScat$=Recs.Num Then Exit Do CS.Send chr(1) + "H" ' Wait for response from host. CS.Receive nTimeout, chr(27) + "[?25h" curr=curr+1 Loop If curr>total Then MsgBox "End of list" Goto Done End If 'Set LockStep = Nothing MsgBox "Bad Scat! Bad!" '"Done!" Done: End Sub