SwitcherV2.2. Switching and retaining database context in main windows for workflow continuation

UPDATED 2019.09.26: I have attached script V2.2 that supersedes all previous versions.

This script might become obsolete very soon :clap::clap::clap::+1::+1::+1:. See Feature request DEVONthink Pro 3: 3 pane view & tabbed windows

The script uses a popup list to switch between sidebar, view, preview, inspector bar, and database. The script will retain the latest context of an opened database (selected document, group, or search results) in each opened main window when user begins to use the script to switch among databases in main windows. Maximum of 5 opened main windows and 20 opened databases.

Options: The script can show database list only, or together with a list of 9 views in DT menu>view. User can assign numeric labeling to the view list and/or alphabetical labeling to database list.

Limitation: I only test the database context retention for list view and column view. Retention for icon and cover flow views have not been tested. If multiple items are selected, only the first item in the selection will remain selected after the switch. It is possible that sometimes the script might not be able to retain the database context. But a quick fix procedure will resolve the issue in most of the time.

I suggest putting the script in the DT3 script menu and assign the script a shortcut, by direct naming or in the MacOS system preference. The attached script in post#2 is assigned with ctrl-Q as an example.

Demo (these are images for an older version, the uncluttered version is shown in post#3)
(1) View in DB1, a file is selected. Invoke the script and switch to DB2. Global inbox (โ€œInboxโ€) will always be the first database in the db list.

(2) Switched to DB2. Invoke the script and switch to DB1 again.

(3) The previously selected item is retained.

Script and option setting in post#2

2 Likes

The setting:

The first comment block is a reference list for choosing views:

(* SETUP REFERENCE
**Sidebar**
1	Navigate			keystroke 1 using {option down, command down}
2	Reading List	keystroke 2 using {option down, command down}
3	Import			keystroke 3 using {option down, command down}
4	Extras			keystroke 4 using {option down, command down}
**View**
5	as Icons			keystroke 1 using {command down}
6	as List			keystroke 2 using {command down}
7	as Columns		keystroke 3 using {command down}
8	Cover Flow		keystroke 4 using {command down}
**Preview**
9	None				keystroke 5 using {command down}
10	Standard		keystroke 6 using {command down}
11	Widescreen		keystroke 7 using {command down}
**InspectorBar**
12	Generic			keystroke 1 using {control down}
13	Custom			keystroke 2 using {control down}
14	Annotations & Reminder	keystroke 3 using {control down}
15	Table of Contents		keystroke 4 using {control down}
16	Thumbnails		keystroke 5 using {control down}
17	Properties		keystroke "p" using {control down}
18	Annotations		keystroke 6 using {control down}
19	Links				keystroke 7 using {control down}
20	List				keystroke 8 using {control down}
21	Clouds			keystroke 9 using {control down}
22	See Also & Classify	keystroke "s" using {control down}
23	Search			keystroke "u" using {control down}
*)

Option settings

property labelView : true
property labelDB : false
property dbListOnly : false

set theDisplayList to {1, 3, 6, 7, 9, 10, 11, 12, 13}
set theSeparatorList to {2, 2, 3, 2}

No option for database list, all opened databases will be listed, with global inbox always at the top of the list. If โ€œdbListOnlyโ€ is set to true, only the database list will be shown in the popup list.
theDisplayList : the list must select 9 views from the 23 views in the comment block. The four sections (Sidebar, View, Preview, Inspector) must each choosing at least one view.
theSeparatorList: must specify the number of views in each section. In this list, I have chosen 2 views in Sidebar (Navigate and Import), 2 views in View, 3 views in Preview, and 2 views in InspectorBar.
labelView & labelDB: Set to true to show the numeric label for view list and alphabetical label for database list.

When database switcher doesnโ€™t work: The most typical bugs of this DIY switcher, if it happens, is the database not switching or switch to the wrong database. Quick fix: for example, you are in DB1 wanting to switch to DB2, but the script doesnโ€™t work. The solution: manually use the sidebar to goto DB2, select any item in DB2, and run the script to switch to another DB. This quick-fix works most of the times. If it doesnโ€™t then I would suggest not to use the script.

The script. For those who know how to fork, u will know that u can change the name of the views shown in the list. It should be easy to shorten or extend the view list IF labelview is true, but more tricky if labelview is false.

The script (latest version) is posted on 2019.09.26
SwitcherV2.2____Ctrl-Q.scpt.zip (482.7 KB)

V2.2 is a more uncluttered version and retain database context for up to 5 opened main windows. There is an option to only show database list. The separator lines donโ€™t have the section title now.

PS: This script might become obsolete very soon :clap::clap::clap::+1::+1::+1:. See Feature request DEVONthink Pro 3: 3 pane view & tabbed windows

Demo
A search list in DB1, invoke the script and switch to DB2.

In DB2, switch back DB1 again.

The search list in DB1 is retained.
Limitation: the exact selection in the search results canโ€™t be retained. Only the search list is retained.

In DB1, switch back to DB2

The list and selection is DB2 are retained

The uncluttered list, if views are also enabled.

EDITED 2019.09.26: the latest version that supports multiple main windowโ€™s database context retentions is attached in post#2.

1 Like