' MacroName: MarcSwitch ' MacroDescription: Switch from an item record in a call number search to the corresponding MARC record. ' Written by: Joel Hahn, Niles Public Library District Sub main Dim CS as Session Set CS=CurrentSession 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 On Error Resume Next path$ = CurDir$ ChDir "C:\CLSI" If Err = 76 Then 'Path not found Err = 0 MkDir "C:\CLSI" End If ChDir path$ On Error Goto 0 CS.GetTextInRegion WhereAreWe$, 3, 21, 3, 62 WhereAreWe$ = Trim(WhereAreWe$) If InStr(WhereAreWe$, "Call Number")=0 Then MsgBox "You are not viewing the results of a call number search. Exiting..." Goto Done End If CS.GetTextInRegion RecNum$, 2, 50, 2, 78 numplace = InStr(1, RecNum$, "Record", 0) numplace2 = InStr(numplace+8, RecNum$, "of", 0) RecNum$ = Mid(RecNum$, numplace+8, numplace2 - (numplace+9)) CS.GetTextInRegion ATKey$, 5, 61, 5, 76 ATKey$ = Trim(ATKey$) If InStr(1, ATKey$, " ")>4 Then ATKey$ = Left(ATKey$, 9) CS.Send Chr(1)+"C" '[F3] ' Wait for response from host. CS.Receive nTimeout, chr(27) + "[?25h" CS.GetTextInRegion SearchStr$, 19, 21, 19, 48 SearchStr$ = Trim(SearchStr$) filename$ = "C:\clsi\MarcSwch.dat" filenum% = FreeFile Open filename$ for Output as filenum% retrn$ = RecNum$+";"+SearchStr$ Print #filenum%, retrn$ Close filenum% CS.Send Chr(1)+"d" '[S-F4] ' Wait for response from host. CS.Receive nTimeout, chr(27) + "[?25h" CS.Send ATKey$+Chr(13) ' Wait for response from host. CS.Receive nTimeout, chr(27) + "[?25h" CS.Send Chr(13) CS.Send Chr(1)+"g" '[S-F7] ' Wait for response from host. CS.Receive nTimeout, chr(27) + "[?25h" Done: End Sub