jamiesmithnc
Well-known member
In my processing I tend to rename my views to like "Red", "Green", etc., which makes many of the other processes quickly repeatable.
This is my first endeavor with PI scripting...
I threw together a (very fragile) script that changes the ID for a file based on an "indexOf", but what I'd rather is grab the filter name out of the properties or FITS headers (wherever I can) and use that instead.
Is there a way to do that? In the long run I'd like to be able to:
Thanks,
-jamie
My script thus far is:
This is my first endeavor with PI scripting...
I threw together a (very fragile) script that changes the ID for a file based on an "indexOf", but what I'd rather is grab the filter name out of the properties or FITS headers (wherever I can) and use that instead.
Is there a way to do that? In the long run I'd like to be able to:
- have it iterate all open views in the current workspace
- include a prefix or suffix
Thanks,
-jamie
My script thus far is:
Code:
function getFilter(view)
{
newId = "WTH";
if (view.id.indexOf("Lum") > 0)
{
newId = "Lum"
}
else if (view.id.indexOf("Red") > 0)
{
newId = "Red"
Console.writeln("ZZZZ");
}
else if (view.id.indexOf("Green") > 0)
{
newId = "Green"
}
else if (view.id.indexOf("Blue") > 0)
{
newId = "Blue"
}
else if (view.id.indexOf("Sii") > 0)
{
newId = "Sii"
}
else if (view.id.indexOf("Ha") > 0)
{
newId = "Ha"
}
else if (view.id.indexOf("Oiii") > 0)
{
newId = "Oiii"
}
else
{
newId = "WTH";
}
return newId;
}
function main()
{
if (Parameters.isViewTarget)
{
filter = getFilter(Parameters.targetView);
Parameters.targetView.id = filter;
}
}
main();