Default directory and asteroid target list

Scripts and programs to automate Astroart
Post Reply
Wayne Hawley
Posts: 7
Joined: 04 Mar 2020, 17:14

Default directory and asteroid target list

Post by Wayne Hawley » 30 Dec 2020, 19:14

I’m trying to save images to a new directory that I create in the script using the date$() and create.directory functions.

It creates the directory fine

But I cannot see how to select this as the default directory to save the images into or how to automatically write the new directory into the save.image format.

I am trying to use the system clock to create the directory with the date then save the images on that session into the new directory

I can obviously write the directory name into the script but cannot work out how to do this automatically from within the script.

Is there a way to pick up to date RA and DEC from the MPC with the script directly accessing these. If I had a text list of the asteroid names can the program access the MPC and get accurate RA and DEC for telescope control or is there another way to do this?

AlessandroMaitan
Posts: 7
Joined: 09 May 2019, 08:02

Re: Default directory and asteroid target list

Post by AlessandroMaitan » 31 Dec 2020, 08:28

Hi Wayne,
I solved this kind of problem defining a variable with the name of the directory where I intended to save the observation files.
In particular I used this code (some words are in Italian, however it's easy to understand):
QUOTE
oggi=today()
year=left(date,4)
ImgPath= "C:\Users\user\Pictures\"+year+"\"
SeqDir = ImgPath +oggi
SearchDir=FindDirs(ImgPath,oggi)
if SearchDir=oggi then
print "daily directory already exist"
else
CreateDir(SeqDir)
print "daily directory created"
endif
SeqDir=SeqDir+"\"
UNQUOTE
Please note that I'm using the default Windows directory tree ("C:\Users\user\Pictures"). The file are saved in a path such as "C:\Users\user\Pictures\2020\20201231\".
This works fine with Astroart 7 SP5.

Alessandro Maitan

AlessandroMaitan
Posts: 7
Joined: 09 May 2019, 08:02

Re: Default directory and asteroid target list

Post by AlessandroMaitan » 31 Dec 2020, 13:58

Hi Wayne,
I forgot to add the code relevant to the file name:
QUOTE
ora=mid(UTDateTime(),9,4)
fileName = oggi+"-"+ora+SeqSep+name + SeqSep + flt+SeqSep+Format(idx,"000")+SeqSep+str(exp)+"s"
fileName=fileName+".fit"
UNQUOTE

Alessandro Maitan

fabdev
Posts: 240
Joined: 03 Dec 2018, 21:43

Re: Default directory and asteroid target list

Post by fabdev » 31 Dec 2020, 14:19

About getting the coordinate of a minor planet from script (before doing that it's required to open the MPCOrb):

ra,de = ObjectCoordinates("Ceres")
print ra, de
ra,de = ObjectCoordinates("12289")
print ra, de

It's not safe to set and use the windows current directory. It's better to add the directory everytime you access a file. Here is an example:

Dir = "D:\Astro\Images\"

test = BuildFileName("M31", 5)
print test

Function BuildFileName(name,idx)
return Dir + name + "-" + Format(idx,"000") + ".fit"
End Function

Wayne Hawley
Posts: 7
Joined: 04 Mar 2020, 17:14

Re: Default directory and asteroid target list

Post by Wayne Hawley » 31 Dec 2020, 17:17

Many thanks,

I will give these a try, it’s great that there is a way to pick things up from MPCOrb..

Wayne

Post Reply