' MacroName: PrintRecordRemoveDiacritics ' MacroDescription: Print an entire record, stripping out all diacritics without replacement ' OldMacroDescription: Print an entire record, replacing diacritics ' with given characters. This is a modification ' of OCLC's PrintRecord macro. ' Modified by: Jim Ferguson ' Catalog Dept., Geisel Library ' University of California, San Diego ' Further Modified by: Joel Hahn ' Niles Public Library District function CheckMessage(Text$, Beginning$, Ending$) bRetVal = FALSE Temp$ = Left$(Text$, Len(Beginning$)) if StrComp(Beginning$, Temp$) = 0 then Temp$ = Right$(Text$, Len(Ending$)) if StrComp(Ending$, Temp$) = 0 then bRetVal = TRUE end if end if CheckMessage = bRetVal end function sub main dim CS as Session set CS = CurrentSession Dim CheckDiatritic as Integer ' Determine how many columns are in the record if CS.CommMode = BLOCK then Columns% = CS.BlockColumns else Columns% = CS.FDXColumns end if ' Make sure we are at the top of the record CS.GetTextInRegion Text$, 2, 1, 2, Columns% ' Check for "Entire --- displayed." if CheckMessage(Text$, "Entire ", " displayed.") = FALSE then ' Check for "Beginning of --- displayed." if CheckMessage(Text$, "Beginning of ", " displayed.") = FALSE then ' Check for "You are already at beginning of the ---" if CheckMessage(Text$, "You are already at beginning of the ", "") = FALSE then ' Check for "You are already viewing the entire ---" if CheckMessage(Text$, "You are already viewing the entire ", "") = FALSE then ' Move position to the beginning of the record CS.PutText "HOME", 1, 1 RunMacro "PRSMUTIL!SendCommand" end if end if end if end if bLoop% = TRUE nPages = 0 ' Get text to be printed Do While bLoop% = TRUE Row% = CS.GetLastRowUsed CS.GetTextInRegion Temp$, 6, 1, Row%, Columns%, TRUE Buffer$ = Buffer$ + Temp$ ' Get message at the top of the record CS.GetTextInRegion Text$, 2, 1, 2, Columns% bLoop% = FALSE bAtTop% = FALSE ' Check for "Entire --- displayed." if CheckMessage(Text$, "Entire ", " displayed.") = TRUE then bAtTop% = TRUE else ' Check for "End of --- displayed." if CheckMessage(Text$, "End of ", " displayed.") = FALSE then ' Check for "You are already at end of the ---" if CheckMessage(Text$, "You are already at end of the ", "") = FALSE then ' Check for "You are already viewing the entire ---" if CheckMessage(Text$, "You are already viewing the entire ", "") = TRUE then bAtTop% = TRUE else ' Move to the next page RunMacro "PRSMUTIL!PageDown" nPages = nPages + 1 ' Allow only 15 pages to print if nPages < 15 then bLoop% = TRUE end if end if end if end if end if Loop ' Move position to the beginning of the record if bAtTop% = FALSE then CS.PutText "HOME", 1, 1 RunMacro "PRSMUTIL!SendCommand" end if if Buffer$ <> "" then StrLen%=Len(Buffer$) CheckDiacritic=1 Do While CheckDiacritic"" Then Result%=Asc(Char$) Else Goto Looper If Asc(Mid$(Buffer$, CheckDiacritic, 1))>127 Then l$=Left(Buffer$, CheckDiacritic-1) r$=Mid$(Buffer$, CheckDiacritic+1, StrLen%-CheckDiacritic-1) 'Right(Temp$, StrLen%-CheckDiacritic-1) Buffer$=l$+r$ End If Looper: CheckDiacritic = CheckDiacritic +1 Loop PrintBuffer Buffer$ 'filenum%=FreeFile 'Open "C:\tester.txt" for Output as filenum% ' Write #filenum%, Buffer$ 'Close filenum% SetStatusMessage "Full record printed." else SetStatusMessage "Unable to print record." end if end sub