Opened/Closed State of a Database

I have two questions regarding the opened/closed state of a database:

  1. Is it possible to retrieve the opened/closed state of a database in a script at all? If so, how?
    I have a Smart Rule to move items from the Global Inbox to a database. The Rule is triggered every minute which leads to an annoyingly high number of errors (indicated at the messages icon) when the database is not open.

  2. If a script can retrieve the opened/closed state of a database in general, is it possible too that a Reminder script retrieves the opened/closed state of a database before the Reminder had kicked in and (maybe) opened the database it is attached to?
    I have set up Reminder scripts to regularly save zipped databases to a cloud folder. All in all that works fine. The one thing I’d like to improve was to set the databases to their previous opened/closed state. Reminders always open the databases that hold the file the reminder is attached to. (Or maybe it’s the zipping script?) I’d like to see them get closed if they were closed before, while I’d like to see see the databases open that have been opened before.

The “Move” action of smart rules should automatically open the destination database, isn’t that the case?

AppleScript can only access opened databases, therefore to figure out whether a certain database is opened/closed use this list and compare the name/UUID/path of the databases to the desired one.

If a reminder is located in a closed database, then it should be automatically opened too when necessary.

It’s a script moving items. And it is not intended to open the database. What use would closing a database have at all if a Smart Rule re-opens it every minute?

Which list? And how?

It does. But I want it to close it again at the last step—if it was closed before.

tell application id "DNtp" to return databases

A reminder script can’t figure out whether the database was closed before.