Another Secret Windows Question

I don’t think I will ever understand “Secret” windows. Must be some sort of mental block with me.
If I open a secret widow - opensecret - do some manipulation on it, and later on in the procedure want to make that secret window visible (so I can check on its status), what is the best way to do so?
Vic

You use the window statement.

A secret window isn’t actually a window. It’s just a way of making a database active without opening any window. In Panorama X, the same thing can be accomplished with the setactivedatabase statement. Jim came up with the new name because it doesn’t use the word window.

There is no window to make visible. If you want to see the database in a visible window, you should use setactivedatabase to make the database active, and then do an opensheet, or openform.

Yes, KJM, I know that.
What is the name of the window I should use?
If I use Window “dbname:SECRET”, nothing opens.
If I use Window “dbname”, I get an error message that no such window exists.

OK, Dave. You sent that note as I was typing my previous. So, maybe I am starting to get it. THERE IS NO WINDOW to request a Window command for. So you have to make the database active some other way, and then do an opensheet. Yes, makes sense.
Thanks Dave. I can always count on you or Gary.

The easiest way is just to use OpenFile “database name” with database name being the name of the database that is secret. It will open the database to the last window you used.

One new way to deal with these is to set the database preference so that the file will stay open even if there are no windows open. So you can open a window in the file without windows, do what you want, close the window, and the file will remain open in memory afterwards.

Thanks to everyone.

After I have used an arraybuild command on the secret database, I want to close that database, i.e., remove it from memory. I used the following steps:

 message info("files")
 setactivedatabase "dbname"
closefile
message info("files")

At the first line, the secret file is shown, because it is still open. But the file is still there at the last message command. Shouldn’t it have been closed by then?

Your code should work, but there is a simpler way using a statement designed specifically for this purpose.

Is dbname the actual name of your secret file?

Really weird, Jim. I re-did the procedure as

message info("files")
closedatabase "dbname"
message info("files")

But the file dbname is still listed in the last message window. Is it really still open?

Check Memory Usage to see if it is still there. It may be that info(“files”) just hasn’t been updated yet.

Late news.

I did the following, on a hunch:

message info("files")
closedatabase "dbname"
message info("files")
message info("files"

The first 3 lines of code give the result I described before. But repeating the last line DOES NOT SHOW dbname. Apparently, even though the closedatabase command closed the file, the info(“files”) needed one extra step to update itself. That may be why my earlier code didn’t seem to work either. But I like your closedatabase command Jim.

Dave,

You answer faster than I can type.