APSF //- Import the contents of a .pln file created by DeepSky software. //- The objects in the file will be added to the currently open plan document. //- //- Paul Rodman, May 2008 //- //- Version 1.0, 19 May 2008 //- Initial release dim pln as APTextFile dim objlist(-1),s,notfound(-1) as string dim i as integer dim sch as APSearch // Open the pln file pln = ReadTextFile if pln=nil then return // Read in the objects while not pln.EOF s=pln.ReadLine if left(s,1)="""" then s=mid(s,2) i=instr(s,"""") if i>1 then objlist.Append left(s,i-1) end if end if wend pln.Close if ubound(objlist)<0 then Print "No objects found in the imported file" return end if // Lookup the IDs and insert the results into the plan document StartProgress("Importing "+str(ubound(objlist)+1)+" Objects",true,ubound(objlist)) for i=0 to ubound(objlist) sch=new APSearch sch.MaxResults=1 if sch.Search(objlist(i),false) and sch.nObjects>0 then call sch.GetObject(1).AddToPlan else notfound.Append objlist(i) end if if UpdateProgress(i) then exit next StopProgress if ubound(notfound)>=0 then Print "Could not find the following objects:"+EndOfLine+EndOfLine+Join(notfound,EndOfLine) end if Bleep