APSF //- This script removes blanks from selected IDs in the //- global observation database. Useful for changing, say, //- ID = "M 13" to ID="M13" to correspond better with the way //- AstroPlanner represents IDs. You'll be given a list of //- potential IDs to change before making the decision to do so. //- //- NOTE: REQUIRES V1.5.9a17 or later. //- //- Paul Rodman, September 2007 //- //- Version 1.0 (16 Sep 2007) //- Original release //- Version 1.1 (17 Sep 2007) //- Handles case where there are no possible IDs to change dim i,j,check(-1),count(-1),n as integer dim ob as APGlobalObservation dim s,prefix(-1),example(-1) as string for i=1 to nGlobalObservations ob=GlobalObservation(i) if instr(ob.ID," ")>1 then s=NthField(ob.ID," ",1) if not IsNumeric(s) and len(s)<4 then j=prefix.IndexOf(s) if j<0 then prefix.Append s example.Append s+" (e.g. "+ob.ID+")" check.Append 0 count.Append 1 else count(j)=count(j)+1 end if end if end if next for i=0 to ubound(prefix) example(i)=example(i)+". "+str(count(i))+" found." next if ubound(prefix)<0 then print "No suitable observations found" return end if SetCheckListParameter("IDs to change",check,example) if not EditParameters("Remove Blanks from IDs") then return check=GetCheckListParameter("IDs to change") for i=1 to nGlobalObservations ob=GlobalObservation(i) if instr(ob.ID," ")>1 then s=NthField(ob.ID," ",1) j=prefix.IndexOf(s) if not IsNumeric(s) and len(s)<4 and j>=0 and check(j)<>0 then n=n+1 ob.ID=ReplaceAll(ob.ID," ","") end if end if next print str(n)+" observations changed"