ApplyScript. commands

Scripts and programs to automate Astroart
Post Reply
fabdev
Posts: 503
Joined: 03 Dec 2018, 21:43

ApplyScript. commands

Post by fabdev » 14 May 2022, 13:29

Astroart 8.0 contains four new script commands which are used with the Apply Script Window.

ApplyScript.First
ApplyScript.Last
ApplyScript.Index
ApplyScript.Count


For example, try the following simple script:

Print Image.Background

On a single image, it will print the background of the image.
When used inside the Apply Script Window it will produce the following output:
Now add the ApplyScript.First and .Last commands, this is the script and the result:

Code: Select all

stats = ""
if ApplyScript.First then stats = "First"
if ApplyScript.Last then stats = "Last"
print Round(Image.Background) ; stats
For example, the .Last could be used to save automatically the content of the output panel.
The .First could be used to initialize some calculations, for example some reference from the first image.

A last example with the .Index and .Count commands:
When these commands (.Count and .Index) are used in a standalone script (so without the ApplyScript window) they return 0 / 0. This can be used to define a behaviour when the script is used on a single image.

Post Reply