Switching between databases

I started to experiment using different databases with DT but found it a bit cumbersome to move an alias file all the time. So I made this quick applescript to do the switching (I haven’t done any AppleScripting in a long time so the code quality might be lacking a bit), this seems to work fine allowing me to play with multiple databases while waiting for DT Pro.

I didn’t check to see if someone have made this already (I didn’t even check the DT distribution  ;D ). Anyone who wants to use it needs to modify the paths

property dataFolder : alias "Macintosh HD:Users:jem:Aktuellt:DEVONthink data:"
property destFolder : alias "Macintosh HD:Users:jem:Library:Application Support:"

on run
   set dbList to findDTdatabases()
   if dbList ? {} then
       set userSelection to choose from list dbList with prompt "Select DEVONthink database" OK button name "Select"
       if userSelection ? "" then
       end if
   end if
   return dbList
end run

on findDTdatabases()
   set theList to {}
   if kind of (info for dataFolder) ? "Folder" then
       return theList
   end if
   set x to list folder dataFolder
   repeat with cur in x
       set curItem to alias ((dataFolder as text) & cur)
       set curInfo to info for curItem
       if kind of curInfo = "Folder" and visible of curInfo then
           set theList to theList & cur
       end if
   end repeat
   return theList
end findDTdatabases

on makeDEVONthinkAlias(f)
   set f to alias ((dataFolder as text) & f)
   tell application "DEVONthink"
   end tell
   tell application "Finder"
       set x to make alias file to f with properties {name:"DEVONthink"}
       move x to destFolder with replacing
   end tell
   tell application "DEVONthink"
   end tell
end makeDEVONthinkAlias

Finally - I’ve been expecting such a script since the support of aliases in DT 1.x.y (can’t remember the version when DT started resolving aliases)   ;D ;D  ;D

I understand that the upcoming PRO version of DT will allow multiple databases. If I create multiple databases using this AppleScript or a similar method, will they be usable in PRO?


DT Pro will be able to use DT PE databases of course - no matter where they are actually stored.

if dbList ? {} then 

Expected "then", etc. but found unknown token. The question mark (?) is producing an error.

The ? should be the “not equal” sign (it obviously didn’t survive the transfer to HTML code)