APSF //- This script exports the plan objects to a file in NexTour format, //- suitable for use with NexRemote/NexTour for Celestron telescope owners. //- It will run on both Mac and Windows, but NexRemote is Windows-only. //- Note that you will have to rename your output file to have the ".hct" extension, //- and make sure it resides in the Tours folder in NexRemote. //- //- (with thanks to Michael Swanson for supplying the format) //- //- V1.0 - Initial release //- V1.1 - bug fixes //- V1.2 - compatibility fixes //- V1.3 - restrict # objects to 200 (NexRemote limitation) //- V1.4 - changes for negative declinations and European numbering systems. //- V1.5 - Automatically save .hct file with plan name as an option // Set the following statement to true to automatically save the .hct file // in the AstroPlanner folder with the same name as the plan. e.g. if your // plan is Fantastic.apd then the file saved will be Fantastic.hct. const saveWithPlanName = false function ConstellationCode(c as string) as integer select case c case "And" return 0 case "Ant" return 1 case "Aps" return 2 case "Aqr" return 3 case "Aql" return 4 case "Ara" return 5 case "Ari" return 6 case "Aur" return 7 case "Boo" return 8 case "Cae" return 9 case "Cam" return 10 case "Cnc" return 11 case "CVn" return 12 case "CMa" return 13 case "CMi" return 14 case "Cap" return 15 case "Car" return 16 case "Cas" return 17 case "Cen" return 18 case "Cep" return 19 case "Cet" return 20 case "Cha" return 21 case "Cir" return 22 case "Col" return 23 case "Com" return 24 case "CrA" return 25 case "CrB" return 26 case "Crv" return 27 case "Crt" return 28 case "Cru" return 29 case "Cyg" return 30 case "Del" return 31 case "Dor" return 32 case "Dra" return 33 case "Equ" return 34 case "Eri" return 35 case "For" return 36 case "Gem" return 37 case "Gru" return 38 case "Her" return 39 case "Hor" return 40 case "Hya" return 41 case "Hyi" return 42 case "Ind" return 43 case "Lac" return 44 case "Leo" return 45 case "LMi" return 46 case "Lep" return 47 case "Lib" return 48 case "Lup" return 49 case "Lyn" return 50 case "Lyr" return 51 case "Men" return 52 case "Mic" return 53 case "Mon" return 54 case "Mus" return 55 case "Nor" return 56 case "Oct" return 57 case "Oph" return 58 case "Ori" return 59 case "Pav" return 60 case "Peg" return 61 case "Per" return 62 case "Phe" return 63 case "Pic" return 64 case "Psc" return 65 case "PsA" return 66 case "Pup" return 67 case "Pyx" return 68 case "Ret" return 69 case "Sge" return 70 case "Sgr" return 71 case "Sco" return 72 case "Scl" return 73 case "Sct" return 74 case "Ser" return 75 case "Sex" return 76 case "Tau" return 77 case "Tel" return 78 case "Tri" return 79 case "TrA" return 80 case "Tuc" return 81 case "UMa" return 82 case "UMi" return 83 case "Vel" return 84 case "Vir" return 85 case "Vol" return 86 case "Vul" return 87 else return 88 end select end function function TypeCode(c as string) as integer select case c case "Asterism","Ast" return 0 case "Globular","Glob","GC" return 1 case "Double","Dbl","Star+Dbl" return 2 case "ENeb","E Neb" return 3 case "Galaxy","Gal","Gx" return 4 case "Neb","R Neb","BrNeb","DkNeb" return 5 case "Open","OC" return 6 case "PNeb","Planetary","PN","P Neb" return 7 case "Star","Var Star" return 8 case "Triple","Mult" return 9 else return 10 end select end function dim iObject,j,nsaved as integer dim fields(-1),s as string dim f as APTextFile if saveWithPlanName then s=ReplaceAll(GetPlanName,".apd","") f = WriteTextFile(s+".hct") else f = WriteTextFile() end if if f=nil then return nsaved=0 for iObject=1 to nObjects if nsaved>=200 then print "Only first 200 objects exported. This is a NexRemote limitation." exit end if redim fields(-1) nsaved=nsaved+1 // RA s=Obj(iObject).RAFormatted(true,"hms:") s=left(s,len(s)-1) s=ReplaceAll(s,",",".") fields.Append s // Dec s=Obj(iObject).DecFormatted(false,"+dms:") s=ReplaceAll(s,",",".") fields.Append s // Name s=Obj(iObject).ID if s="" then s=Obj(iObject).Name if len(s)>16 then s=left(s,16) s=ReplaceAll(s,"#","_") fields.Append s // Desc s=trim(Obj(iObject).Notes) s=ReplaceAll(s,chr(13)+chr(10)," ") s=ReplaceAll(s,chr(13)," ") s=ReplaceAll(s,chr(10)," ") s=ReplaceAll(s," "," ") s=ReplaceAll(s,"#","_") if len(s)>16 then s=" "+s fields.Append s // Size (tenths of arcmin) s=str(round(max(Obj(iObject).Size1,Obj(iObject).Size2)*10)) fields.Append s // Sep (tenths of arcsec) s=str(round(Obj(iObject).Separation*10)) fields.Append s // PosAng s=str(Obj(iObject).PosAngle) fields.Append s // Mag (tenths of magnitude) s=str(round(Obj(iObject).Magnitude*10)) fields.Append s // MinMag (tenths of magnitude) s=str(round(Obj(iObject).Magnitude2*10)) fields.Append s // MaxMag (tenths of magnitude) s=str(round(Obj(iObject).Magnitude*10)) fields.Append s // Constellation code s=str(ConstellationCode(Obj(iObject).Constellation)) fields.Append s // Type code s=str(TypeCode(Obj(iObject).Type)) fields.Append s // ID fields.Append "" // Catalog fields.Append "Custom" // User1 - User4 for j=1 to 4 select case j case 1 s=trim(Obj(iObject).User1) case 2 s=trim(Obj(iObject).User2) case 3 s=trim(Obj(iObject).User3) case 4 s=trim(Obj(iObject).User4) end select if len(s)>16 then s=left(s,16) s=ReplaceAll(s,"#","_") fields.Append s next f.Write Join(fields,"#")+chr(13)+chr(10) next f.Close if not saveWithPlanName then print "Make sure to change the saved NexTour file name so that it has the extension '.hct', and is in the 'Tours' folder in NexRemote." end if