' MacroName: ChangeByCallNumber ' MacroDescription: Make changes to a list of item records gotten via a call number search. ' Written by: Joel Hahn, Niles Public Library District '$Include: "CCS-2!ChangeSubs" 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 InitChoice: Begin Dialog ChoiceDialog 211, 45, "Initial Choice" OkButton 164, 8, 40, 14 CancelButton 164, 24, 40, 14 OptionGroup .WkFmYN OptionButton 8, 12, 156, 10, "Use Workform/Format Change/Add/Del./etc.", .WkFmY OptionButton 8, 24, 134, 10, "Add to/Delete from Call Number only", .WkFmN End Dialog Dim ChoiceDia As ChoiceDialog CD=Dialog(ChoiceDia) If CD=0 Then Goto done WkFmYN=ChoiceDia.WkFmYN SecondChoice: If WkFmYN=0 Then 'If only changing call numbers, but not using the built-in 'workform to do so, comment out the following two lines. WkFm=WorkForm If WkFm="" Then Goto done NBLTPT=Left(WkFm, 2) : WkFm=Right(WkFm, Len(WkFm)-2) NB=Left(NBLTPT, 1) : LTPT=Right(NBLTPT, 1) WkFm=chr(9)+WkFm End If If WkFmYN=1 Then 'Don't use workform AddDelete: Begin Dialog AddDelete 197, 118, "Add or Delete" OptionGroup .AddDel OptionButton 9, 4, 116, 10, "Add to start of Adult call number", .ADAdd OptionButton 9, 19, 118, 10, "Add after 'J/' of Juv. call number", .ADAddJ OptionButton 9, 40, 132, 10, "Delete from start of Adult call number", .ADDel OptionButton 8, 53, 126, 10, "Delete after 'J/' of Juv. call number", .ADDelJ OptionButton 8, 72, 33, 10, "Delete", .ADAD OptionButton 8, 86, 33, 10, "Delete", .ADADJ TextBox 127, 11, 63, 12, .Add Text 9, 28, 188, 8, "______________________________________________" TextBox 142, 44, 12, 12, .Del Text 157, 46, 39, 8, "characters" Text 9, 60, 188, 8, "______________________________________________" TextBox 41, 71, 12, 12, .Del2 Text 57, 73, 67, 8, "characters and add" TextBox 130, 71, 52, 12, .Add2 TextBox 41, 85, 12, 12, .Del2J Text 57, 87, 94, 8, "characters after J/ and add" TextBox 151, 85, 36, 12, .Add2J OkButton 8, 100, 40, 14 CancelButton 52, 100, 40, 14 End Dialog Dim AddDel as AddDelete AD=Dialog(AddDel) If AD=0 Then Goto InitChoice AddD=AddDel.AddDel If (AddD="0" or AddD="1") and AddDel.Add="" Then MsgBox "You need to fill in the proper box" Goto AddDelete ElseIf (AddD="2" or AddD="3") and AddDel.Del="" Then MsgBox "You need to fill in the proper box" Goto AddDelete ElseIf AddD="4" and (AddDel.Add2="" or AddDel.Del2="") Then MsgBox "You need to fill in the proper boxes" Goto AddDelete ElseIf AddD="5" and (AddDel.Add2J="" or AddDel.Del2J="") Then MsgBox "You need to fill in the proper boxes" Goto AddDelete End If End If CS.GetTextInRegion RecNums$, 2, 50, 2, 78 place=Instr(RecNums$, "Records") RecNums$=Right(RecNums$, Len(RecNums$)-place) place2=Instr(RecNums$, "of") CurrRec=Val(Mid(RecNums$, 7, place2-7)) TotalRecs=Val(Mid(RecNums$, place2+2, Len(RecNums$)-place2)) HM$=" Enter the total number of records to change, starting with " HM$=HM$+"the current record." ThirdChoice: Begin Dialog ChangeRecs 126,57,"How Many?" TextBox 4,40,20,12,.HowMany Text 4,4,120,32,HM$ OKButton 28,40,32,12 CancelButton 64,40,32,12 End Dialog Dim HowMany as ChangeRecs HowMany.HowMany=CStr(TotalRecs-CurrRec+1) HMy=Dialog(HowMany) If HMy=0 Then Goto SecondChoice HMany$=HowMany.HowMany If HMany$="0" Then Goto Done Else howm=Val(HMany$) If howm=0 Then MsgBox "Data must be a number" Goto ThirdChoice 'ElseIf TotalRecs"/" Then AddText$=AddText$+"/" NewCall$=AddText$+CallNum$ Case 1 AddText$=AddDel.Add If Right(AddText$, 1)<>"/" Then AddText$=AddText$+"/" NewCall$="J/"+AddText$+Right(CallNum$, Len(CallNum$)-2) Case 2 NumDel=Val(AddDel.Del) NewCall$=Right(CallNum$, Len(CallNum$)-NumDel) Case 3 NumDel=Val(AddDel.Del) NewCall$="J/"+Right(CallNum$, Len(CallNum$)-(NumDel+2)) Case 4 NumDel=Val(AddDel.Del2) NewCall$=Right(CallNum$, Len(CallNum$)-NumDel) AddText$=AddDel.Add2 'If Right(AddText$, 1)<>"/" Then AddText$=AddText$+"/" NewCall$=AddText$+NewCall$ Case 5 NumDel=Val(AddDel.Del2J) NewCall$=Right(CallNum$, Len(CallNum$)-(NumDel+2)) AddText$=AddDel.Add2J 'If Right(AddText$, 1)<>"/" Then AddText$=AddText$+"/" NewCall$="J/"+AddText$+NewCall$ End Select If Len(NewCall$)>48 Then NewCall$=Left(NewCall$, 48) DnArr$="" For DownArrows=1 to 5 '4 DnArr$=DnArr$+chr(27)+"[B" 'Down Arrows Next DownArrows CS.Send DnArr$+chr(4) CS.Send NewCall$ ' Wait for response from host. CS.Receive nTimeout, chr(27) + "[?25h" End If 'If Cost$="$0.00" then Msgbox "Cost needs to be added for " & ATKey$ & "." '*************************************************************** 'CS.Wait 1 CS.Send chr(1) + "J" '[F10] CS.Receive nTimeOut, "[9;11H"+chr(27)+"[?25h" 'CS.Wait 2 CS.Send " " CS.Receive nTimeOut, "System" ' "[?25h" GoNext: If z<((TotalRecs-CurrRec)+2)-1 then CS.Send chr(1) + "H" '[F8] CS.Receive nTimeOut, "[?25h" end if z=z+1 Loop Until z=((TotalRecs-CurrRec)+2) MsgBox "Done!" done: end sub