Thanks a lot for your quick response, @BLUEFROG .
I am trying to pick the database from a predefined list. Depending on the database I pick, some other programs should open as well.
I know that saved Workspaces can be selected via AppleScript. But this would be a workaround, so I am trying to figure out whether a database can be picked directly.
-- Open database (and other apps)
property databaseFolderPath : "/Users/Username/Documents/DEVONthink/DEVONthink Datenbanken/"
property databaseNames : {"database 1", "database 2"}
tell application id "DNtp"
try
set theChoice to choose from list databaseNames with prompt "Open database:" default items (item 1 of databaseNames) with title ""
if theChoice is false then return
set databaseName to item 1 of theChoice
open database (databaseFolderPath & databaseName & ".dtBase2") as string
open window for record (root of database databaseName)
activate
if databaseName = item 1 of databaseNames then
-- open new safari window
tell application "Safari"
make new document
activate
end tell
else if databaseName = item 2 of databaseNames then
-- do stuff
end if
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell