Open database going Secret with Keyboard Maestro activation

On my .Initialize procedure I do the following:

;closes all forms and procedures, among other things
makesecret

openform “Edit Form Rename”
openform “Edit Form”
Message “Just past openform statements”
Show

The purpose with the makesecret is to ensure that I only have the forms I want open and I do not want to see any dangling procedures that I had opened when I quit.

Since I often have more than one database open I found suddenly that one particular database would disappear. It was open but had been made secret.

I boiled it down to the fact that after this “Workhorse” database is open I may open another database.

If I activate the “Workhorse” database with the pulldown menu at the top or I click a section of the database that is visible but not active there is no problem. Ditto for “Apple `” dual keystroke.

HOWEVER, I use Keyboard Maestro 10.2 and if I use a hot key to activate “Workhorse” even though “Workhorse” is already open it, Keyboard Maestro, does activate the database but also the .Initialize Procedure, at least part of it, is also executed.

I will see the “Workhorse” database for a moment and then “poof”, it’s invisible.

makesecret is executed but the follow on Openform statements are not.

So, the database is made secret and I have to quit Pan X, save the invisible “Workhorse” database, then reopen with a cold start of Pan X.

I know that Jim uses Keyboard Maestro. I mention this mainly because some others may have had this vexing phenomena.

The problem is only occurring when more than one database is open and the “Workhorse” database is not active.

I may upgrade Keyboard Maestro to see if this goes away. That is not necessary actually. I am running Version 10.2 that says that is the current latest version.

Computer Mac Studio, OS 13.4.1 (Ventura)

Please, please, remove all this code from your .Initialize procedure, these statements were definitely not intended to be used this way. Fortunately, the ability to specify what windows you want when a database is first opened is now built in to the Database Options dialog. You can set it up in a few seconds.

Thanks Jim.

Eliminated that code and your sage advice implemented.

I am trying to figure out how I went down that road. Methinks I stumbled across this on this discussion forum. Obviously not you. In any case thanks for saving my bacon again.

The Window Arrangement feature I just recommended is fairly new, less than a year old. So you may have found a discussion about this from before that feature existed. Using that sort of code in .Initialize didn’t really work, so I added this feature since it was a common request.

Ah. That explains it.

I had gleaned from this discussion group how to not open procedures and was using that also.

Your addition obviates that method too.

Thanks for the history.