I had a related problem, here is my workaround, which may or may not apply to you.
StarAlignment's 'Detect Stars' working mode creates a new view/window named <name>_stars<n> where <name> is the fullId of the target view and <n> is a typically a one or a two digit suffix added for uniqueness by StarAlignment. My script needs to determine the fullId of this new view. Of course my script knows <name> but not <n>.
So immediately prior to executing the process, my script generates a sequence of fullId's <name>_stars, <name>_stars1, <name>_stars2, ... The first name in the sequence that is NOT the fullId of an open view is assumed to be the name StarAlignment will use.
The code below is a helper function. For StarAlignment the "%d" format is appropriate. For other processes "%02d" is a better choice.
After executing StarAlignment I look for a view with the predicted name, using View.viewById(). If found, great, if not the prediction failed and I throw an error.
This scheme is designed to handle cases like this: Suppose prior to execution <name>_stars, <name>_stars1, and <name>_stars3 are open views. StarAlignment will use <name>_stars2. If no prediction is used and you do the simple thing of looking for the name with the largest <n> suffix, you will fail to find the proper view.
function uniqueViewId1(baseId) {
var id = baseId;
for (var i = 1; !View.viewById(id).isNull; ++i) {
id = baseId + format("%d", i);
}
return id;
}