'MacroName:musicGenres '-------------- function replace(strString as string, strOld as string, strNew as string) as string dim pos as integer pos = instr(strString, strOld) do while pos > 0 strString = left(strString, pos - 1) & strNew & mid(strString, pos + len(strOld)) pos = instr(strString, strOld) loop replace = strString end function '--------------- Sub Main Dim CS As Object Set CS = CreateObject("Connex.Client") excerpts = FALSE arrangements = FALSE do x% = x% + 1 CS.GetField "650", x%, temp$ if temp$ = "" then exit do else if instr(temp$, chr(223) & "2 fast") then 'do nothing else temp$ = mid(temp$, 6) 'Excerpts and arrangements if instr(temp$, "v Excerpts") then excerpts = TRUE if instr(temp$, ", Arranged") then arrangements = TRUE 'remove $z pos% = instr(temp$, chr(223) & "z") if pos% > 0 then temp$ = left(temp$, pos% - 2) 'remove $y and move to 046 pos% = instr(temp$, chr(223) & "y") if pos% > 0 then tag046k$ = mid(temp$, pos% + 3) temp$ = left(temp$, pos% - 2) pos% = instr(tag046$, chr(223) & "y") if pos% > 0 then tag046k$ = left(temp$, pos% - 2) if instr(tag046k$, "century") then tag046k$ = left(tag046k$, 2) tag% = cint(tag046k$) - 1 tag046k$ = cstr(tag%) else tag046l$ = mid(tag046k$, 6, 4) tag046k$ = left(tag046k$, 4) end if end if if tag046k$ > "" then CS.AddField 1, "046 " & chr(223) & "k " & tag046k$ & " " & chr(223) & "l " & tag046l$ 'remove $v pos% = instr(temp$, chr(223) & "v") if pos% > 0 then temp$ = left(temp$, pos% - 2) 'remove inverted info pos% = instr(temp$, ",") if pos% > 0 then temp$ = left(temp$, pos% - 1) 'remove qualifiers pos% = instr(temp$, "(") if pos% > 0 then if instr$(temp$, "(Music)") = 0 then temp$ = left(temp$, pos% - 1) 'remove Children's temp$ = replace(temp$, "Children's", "") CS.AddField x%, "655 7" & temp$ end if end if loop if excerpts then CS.AddField 99, "655 7Excerpts" if arrangements then CS.AddField 99, "655 7Arrangements (Music)" End Sub