So far I have not been able to reproduce this.
Using FM with an FM native modal window open. Using a Powershell script to get the active document: it has all the right properties including the full name.
What environment / language are you using?
Currently using CSharp to query FileMaker.
The problem does not actually occur under a Modal (Dialog) window, only under a Floating Window. To recreate this error, open a new Blank DB (only DB open). Simple script;
Set variable [ $old ; Get ( WindowName) ]
New Window [ Name: "Floating" - Type:Floating]
Close Window [$old]
To test, I would run the query on FM before you run the script, and then after.
Running the revers of this script to open a normal window instead of a Floating window should rest the FilerMakerDoc to return an active result.
Though this is not what you would normally run as a task, the error will occur when you just open a Floating Window in some situations, thus causing potential problems at random within the normal working of a DB.
I have raised this as an application error with FM Support, and they have been able to verify my finds. They have made no mention about solutions, fixes, or workarounds. Though I might expect something to be amended in the next version or release that would fix the problem.
Got it. I see the error when it's a floating window. The bug does not happen on a regular document window or a modal window. Good catch!
It is fairly annoy, as the floating window makes for a better UI on Windows OS. But, we shall see what happens.
I have a level of work around built into my CSharp script which tests the active doc before doing anything, and informs the user that the error has occurred. At the moment, the only solution is to close all DB and reopen.. Which is less that optimal of User Experience
The issue only happens if the ONLY window of the file is a floating window... if you don't close the old window in your example then the code still works.
I hear you on the annoying part.
I have found that at times, if the Floating Window is open for so long, the ActiveDoc does not, unlock (not sure on what the best term is) when the floating window is closed, which means that when you return to the normal DB window only, the ActiveDoc stays as Null.
This is not all the time though, and I've not been able to pin this one to either an exact amount of time or if it another script that is run while the floating window is open. I will keep you posted if I find the reason.
There is a known bug where FM's activeX interface will stop responding if you make a certain amount of calls to it in a given time frame. Never been able to determine the # of calls or the time frame but the issue is definitely there. That may be what you are seeing when you make calls with a regular and a floating window open...
Interesting. I will have to look into that a bit more then to see if I can determine this.
I have found though, that sometime even when I don't make any calls it stops responding, so the time might be the key driver here, over the # of calls.