'MacroName:PrintRecordNoDiacritics 'MacroDescription:Draft-print a full record and replace all diacritics with printable characters 'Macro originally written by: OCLC, for Passport for Windows (SaveScreen) 'Macro converted for Connexion by: Joel Hahn, Niles Public Library District 'Last modified: 31 May 2005 Declare Function GetRecordData() As String Dim Indent% Sub Main '$CSTRINGS Const None$ = "" Const OneBlankLine$ = "\r\n" Const TwoBlankLines$ = "\r\n\r\n" Const FormFeed$ = "\f" Const BlankStarBlank$ = "\r\n********************************************************************************\r\n\r\n" ' ' To customize the SaveRecord settings do the following: ' To enable extended translation, set Translation = True ' To change the name of the file the data is saved in, modify SaveRecordFilename$ ' To select different separation, set SeparationString = ' (the s are defined above None$, OneBlankLine$, etc.) Dim FileTest$ FileTest$ = Dir("records-print.txt") If FileTest$ <> "" Then Kill "records-print.txt" End If SaveRecordFilename$ = "C:\windows\temp\records-print.txt" SaveRecordFilename$ = "records-print.txt" ExtendedTranslation% = False SeparationString$ = BlankStarBlank$ Indent% = 2 Const EndOfLineCharacter% = 197 Const SOMCharacter% = 220 Const EOMCharacter% = 221 Const SubfieldCharacter% = 223 Const FillCharacter% = 252 Translated$ = GetRecordData() If Translated$ = "ERROR" Then 'MsgBox "No record is available to print" Exit Sub End If Text$ = "" If ExtendedTranslation% then For Counter% = 1 to Len(Translated$) Select Case Mid(Translated$, Counter%, 1) Case Chr$(SubfieldCharacter%) Text$ = Text$ + Chr$(31) Case Chr$(SOMCharacter%) Text$ = Text$ + Chr$(28) Case Chr$(EOMCharacter%) Text$ = Text$ + Chr$(29) If (Counter% + 1 <= Len(Translated$)) AND (Mid(Translated$, Counter% + 1, 1) = Chr$(EndOfLineCharacter%)) then Counter = Counter +1 End If Case Else Text$ = Text$ + Mid(Translated$, Counter%, 1) End Select Next Counter% Else For Counter% = 1 to Len(Translated$) Char$ = Mid(Translated$, Counter%, 1) Select Case Char$ Case Chr$(SubfieldCharacter%) Text$ = Text$ + "$" Case Chr$(FillCharacter%) Text$ = Text$ + "*" Case Else If (Char$ > Chr$(127)) then if (Char$ <> Chr$(EOMCharacter%)) then Text$ = Text$ + "*" Else Text$ = Text$ + Char$ End If End Select Next Counter% End If FileNumber% = FreeFile Open SaveRecordFilename$ for Append As FileNumber% Print # FileNumber%, Text$ Print # FileNumber%, SeparationString$ Close FileNumber% bool = Shell("C:\\Windows\\Notepad.exe \/p " & SaveRecordFilename$, 7) 'MsgBox "The record has been added to the file 'records.txt' in your Connexion program directory." End Sub Function GetRecordData() As String Dim CS as Object Set CS = CreateObject("Connex.Client") If CS.ItemType < 0 Or (CS.ItemType > 4 And CS.ItemType < 17) Or CS.ItemType > 20 Then GetRecordData = "ERROR" Exit Function End If 'Get fixed field data FFPosition% = CS.FixedFieldPosition If FFPosition% = 0 Then CS.FixedFieldPosition = 1 End If bool = CS.GetFixedField("Type", RecType$) If RecType$ <> "z" Then 'Bibliographic record 'Get LDR and non-008 fields bool = CS.GetFixedField("Rec Stat", RecStat$) bool = CS.GetFixedField("BLvl", BLvl$) bool = CS.GetFixedField("Ctrl", Ctrl$) bool = CS.GetFixedField("ELvl", ELvl$) bool = CS.GetFixedField("Desc", Desc$) bool = CS.GetFixedField("OCLC", OCLC$) bool = CS.GetFixedField("Replaced", Replaced$) Ctrl$ = Left(Ctrl$ & " ", 1) ELvl$ = Left(ELvl$ & " ", 1) OCLC$ = Left(OCLC$ & " ", 8) Replaced$ = RTrim(Replaced$) 'Get standard 008 fields bool = CS.GetFixedField("Entered", Entered$) bool = CS.GetFixedField("DtSt", DtSt$) bool = CS.GetFixedField("Dates", Dates1$) bool = CS.GetFixedField(",", Dates2$) bool = CS.GetFixedField("Ctry", Ctry$) bool = CS.GetFixedField("Lang", Lang$) bool = CS.GetFixedField("MRec", MRec$) bool = CS.GetFixedField("Srce", Srce$) Dates1$ = Left(Dates1$ & " ", 4) MRec$ = Left(MRec$ & " ", 1) Srce$ = Left(Srce$ & " ", 1) 'Start setting up output outdata$ = "OCLC: " & OCLC$ & " " & "Rec Stat: " & RecStat$ & " " & "Entered: " & Entered$ & " " & "Replaced: " & Replaced$ & "\r\n" 'Get special 008 fields & set up output Select Case RecType$ Case "a", "t" 'BKS, SER If BLvl$ <> "s" Then 'BKS bool = CS.GetFixedField("Audn", Audn$) bool = CS.GetFixedField("Form", Form$) bool = CS.GetFixedField("Conf", Conf$) bool = CS.GetFixedField("Biog", Biog$) bool = CS.GetFixedField("Cont", Cont$) bool = CS.GetFixedField("GPub", GPub$) bool = CS.GetFixedField("LitF", LitF$) bool = CS.GetFixedField("Indx", Indx$) bool = CS.GetFixedField("Ills", Ills$) bool = CS.GetFixedField("Fest", Fest$) Audn$ = Left(Audn$ & " ", 1) Form$ = Left(Form$ & " ", 1) Conf$ = Left(Conf$ & " ", 1) Biog$ = Left(Biog$ & " ", 1) Cont$ = Left(Cont$ & " ", 4) GPub$ = Left(GPub$ & " ", 1) LitF$ = Left(LitF$ & " ", 1) Indx$ = Left(Indx$ & " ", 1) Ills$ = Left(Ills$ & " ", 4) Fest$ = Left(Fest$ & " ", 1) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & "Audn: " & Audn$ & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "Form: " & Form$ & " " & "Conf: " & Conf$ & " " & "Biog: " & Biog$ & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & " " & " " & "Cont: " & Cont$ & " " & "GPub: " & GPub$ & " " & "LitF: " & LitF$ & " " & "Indx: " & Indx$ & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & " " & "Ills: " & Ills$ & " " & "Fest: " & Fest$ & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" Else 'SER bool = CS.GetFixedField("GPub", GPub$) bool = CS.GetFixedField("Form", Form$) bool = CS.GetFixedField("Conf", Conf$) bool = CS.GetFixedField("Freq", Freq$) bool = CS.GetFixedField("S/L", SL$) bool = CS.GetFixedField("Orig", Orig$) bool = CS.GetFixedField("EntW", EntW$) bool = CS.GetFixedField("Regl", Regl$) bool = CS.GetFixedField("ISSN", ISSN$) bool = CS.GetFixedField("Alph", Alph$) bool = CS.GetFixedField("SrTp", SrTp$) bool = CS.GetFixedField("Cont", Cont$) GPub$ = Left(GPub$ & " ", 1) Form$ = Left(Form$ & " ", 1) Conf$ = Left(Conf$ & " ", 1) Freq$ = Left(Freq$ & " ", 1) SL$ = Left(SL$ & " ", 1) Orig$ = Left(Orig$ & " ", 1) EntW$ = Left(EntW$ & " ", 1) Regl$ = Left(Regl$ & " ", 1) ISSN$ = Left(ISSN$ & " ", 1) Alph$ = Left(Alph$ & " ", 1) SrTp$ = Left(SrTp$ & " ", 1) Cont$ = Left(Cont$ & " ", 3) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & "GPub: " & GPub$ & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "Form: " & Form$ & " " & "Conf: " & Conf$ & " " & "Freq: " & Freq$ & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & "S/L: " & SL$ & " " & "Orig: " & Orig$ & " " & "EntW: " & EntW$ & " " & "Regl: " & Regl$ & " " & "ISSN: " & ISSN$ & " " & "Alph: " & Alph$ & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & " " & "SrTp: " & SrTp$ & " " & "Cont: " & Cont$ & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" End If Case "g", "k", "r", "o" 'VIS bool = CS.GetFixedField("Audn", Audn$) bool = CS.GetFixedField("Form", Form$) bool = CS.GetFixedField("GPub", GPub$) bool = CS.GetFixedField("Time", PTime$) bool = CS.GetFixedField("TMat", TMat$) bool = CS.GetFixedField("Tech", Tech$) Audn$ = Left(Audn$ & " ", 1) Form$ = Left(Form$ & " ", 1) GPub$ = Left(GPub$ & " ", 1) PTime$ = Left(PTime$ & " ", 3) TMat$ = Left(TMat$ & " ", 1) Tech$ = Left(Tech$ & " ", 1) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & "Audn: " & Audn$ & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "Form: " & Form$ & " " & "GPub: " & GPub$ & " " & "Time: " & PTime$ & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & " " & "TMat: " & TMat$ & " " & "Tech: " & Tech$ & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" Case "p" 'MIX bool = CS.GetFixedField("Form", Form$) Form$ = Left(Form$ & " ", 1) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & " " & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "Form: " & Form$ & " " & " " & " " & " " & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & " " & " " & " " & " " & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" Case "e", "f" 'MAP bool = CS.GetFixedField("Relf", Relf$) bool = CS.GetFixedField("Form", Form$) bool = CS.GetFixedField("GPub", GPub$) bool = CS.GetFixedField("SpFm", SpFm$) bool = CS.GetFixedField("CrTp", CrTp$) bool = CS.GetFixedField("Indx", Indx$) bool = CS.GetFixedField("Proj", Proj$) Relf$ = Left(Relf$ & " ", 4) Form$ = Left(Form$ & " ", 1) GPub$ = Left(GPub$ & " ", 1) SpFm$ = Left(SpFm$ & " ", 2) CrTp$ = Left(CrTp$ & " ", 1) Indx$ = Left(Indx$ & " ", 1) Proj$ = Left(Proj$ & " ", 2) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & "Relf: " & Relf$ & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "Form: " & Form$ & " " & "GPub: " & GPub$ & " " & "SpFm: " & SpFm$ & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & "CrTp: " & CrTp$ & " " & "Indx: " & Indx$ & " " & "Proj: " & Proj$ & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & "\r\n" Case "c", "d", "i", "j" 'SCO, REC bool = CS.GetFixedField("Audn", Audn$) bool = CS.GetFixedField("Form", Form$) bool = CS.GetFixedField("Comp", Comp$) bool = CS.GetFixedField("AccM", AccM$) bool = CS.GetFixedField("FMus", FMus$) bool = CS.GetFixedField("LTxt", LTxt$) Audn$ = Left(Audn$ & " ", 1) Form$ = Left(Form$ & " ", 1) Comp$ = Left(Comp$ & " ", 2) AccM$ = Left(AccM$ & " ", 6) FMus$ = Left(FMus$ & " ", 1) LTxt$ = Left(LTxt$ & " ", 2) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & "Audn: " & Audn$ & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "Form: " & Form$ & " " & "Comp: " & Comp$ & " " & "AccM: " & AccM$ & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & " " & "FMus: " & FMus$ & " " & "LTxt: " & LTxt$ & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" Case "m" 'COM bool = CS.GetFixedField("Audn", Audn$) bool = CS.GetFixedField("File", File$) bool = CS.GetFixedField("GPub", GPub$) Audn$ = Left(Audn$ & " ", 1) File$ = Left(File$ & " ", 1) GPub$ = Left(GPub$ & " ", 2) outdata$ = outdata$ & "Type: " & RecType$ & " " & "ELvl: " & ELvl$ & " " & "Srce: " & Srce$ & " " & "Audn: " & Audn$ & " " & "Ctrl: " & Ctrl$ & " " & "Lang: " & Lang$ & "\r\n" outdata$ = outdata$ & "BLvl: " & BLvl$ & " " & "File: " & File$ & " " & "GPub: " & GPub$ & " " & " " & " " & "MRec: " & MRec$ & " " & "Ctry: " & Ctry$ & "\r\n" outdata$ = outdata$ & "Desc: " & Desc$ & " " & " " & " " & " " & " " & "DtSt: " & DtSt$ & " " & "Dates: " & Dates1 & ", " & Dates2 & "\r\n" Case Else GetRecordData = "ERROR" Exit Function End Select Else 'Authority record 'Get LDR and non-008 fields bool = CS.GetFixedField("Rec Stat", RecStat$) bool = CS.GetFixedField("ARN", ARN$) 'Get 008 fields bool = CS.GetFixedField("Entered", Entered$) bool = CS.GetFixedField("Replaced", Replaced$) bool = CS.GetFixedField("Upd status", UpdStatus$) bool = CS.GetFixedField("Enc lvl", ELvl$) bool = CS.GetFixedField("Source", Source$) bool = CS.GetFixedField("Roman", Roman$) bool = CS.GetFixedField("Ref status", RefStatus$) bool = CS.GetFixedField("Mod rec", MRec$) bool = CS.GetFixedField("Name use", NameUse$) bool = CS.GetFixedField("Govt agn", GovtAgn$) bool = CS.GetFixedField("Auth status", AuthStatus$) bool = CS.GetFixedField("Subj", Subj$) bool = CS.GetFixedField("Subj use", SubjUse$) bool = CS.GetFixedField("Series", Series$) bool = CS.GetFixedField("Auth/ref", AuthRef$) bool = CS.GetFixedField("Geo subd", GeoSubd$) bool = CS.GetFixedField("Ser use", SerUse$) bool = CS.GetFixedField("Ser num", SerNum$) bool = CS.GetFixedField("Name", IsName$) bool = CS.GetFixedField("Subdiv tp", SubTp$) bool = CS.GetFixedField("Rules", Rules$) Replaced$ = RTrim(Replaced$) 'Set up output outdata$ = "ARN: " & ARN$ & "\r\n" outdata$ = outdata$ & "Rec stat: " & RecStat$ & " " & "Entered: " & Entered$ & " " & "Replaced: " & Replaced$ & "\r\n" outdata$ = outdata$ & "Type: " & RecType$ & " " & "Upd status: " & UpdStatus$ & " " & "Enc lvl: " & ELvl$ & " " & "Source: " & Source$ & "\r\n" outdata$ = outdata$ & "Roman: " & Roman$ & " " & "Ref status: " & RefStatus$ & " " & "Mod rec: " & MRec$ & " " & "Name use: " & NameUse$ & "\r\n" outdata$ = outdata$ & "Govt agn: " & GovtAgn$ & " " & "Auth status: " & AuthStatus$ & " " & "Subj: " & Subj$ & " " & "Subj use: " & SubjUse$ & "\r\n" outdata$ = outdata$ & "Series: " & Series$ & " " & "Auth/ref: " & AuthRef$ & " " & "Geo subd: " & GeoSubd$ & " " & "Ser use: " & SerUse$ & "\r\n" outdata$ = outdata$ & "Ser num: " & SerNum$ & " " & "Name: " & IsName$ & " " & "Subdiv tp: " & SubTp$ & " " & "Rules: " & Rules$ & "\r\n" End If 'Get variable field data bool = TRUE : TagNum% = 0 Do Until bool = FALSE TagNum% = TagNum% + 1 bool = CS.GetFieldLine(TagNum%, indata$) If bool = TRUE Then If indata$ <> "Data contains non-latin script" Then If Indent% > 0 Then outdata$ = outdata$ & String(Indent%, " ") & Mid(indata$, 1, 3) & " " & Mid(indata$, 4, 2) & " " & Mid(indata$, 6) & "\r\n" Else outdata$ = outdata$ & Mid(indata$, 1, 3) & " " & Mid(indata$, 4, 2) & " " & Mid(indata$, 6) & "\r\n" End If End If GetRecordData = outdata$ End If Loop If FFPosition% = 0 Then CS.FixedFieldPosition = 0 End If End Function