I am trying to do essentially the same thing as “adad” in this post: ([url]How to change which database is "active" in a script]), that is, ensure the right database is open when running Sampsa’s tickler file script (no. 2 here: [url]Scripts for a Tickler File]).
Applying the corrections suggested by Korm, I am trying to run the script below, but if another database is open in DT the actions happen there. ```
property FOLDERS_MONTHS : {“01 January”, “02 February”, “03 March”, “04 April”, “05 May”, “06 June”, “07 July”, “08 August”, “09 September”, “10 October”, “11 November”, “12 December”}
property FOLDERS_DAYS : {“01”, “02”, “03”, “04”, “05”, “06”, “07”, “08”, “09”, “10”, “11”, “12”, “13”, “14”, “15”, “16”, “17”, “18”, “19”, “20”, “21”, “22”, “23”, “24”, “25”, “26”, “27”, “28”, “29”, “30”, “31”}
tell application “DEVONthink Pro”
activate
set myDB to database “Daily”
tell database myDB
activate
set todayFolder to create location “/* Inbox”
set ticklerFolder to “/** Tickler”
set currentMonth to item (month of (current date)) of FOLDERS_MONTHS
set currentDay to item (day of (current date)) of FOLDERS_DAYS
set currentFolder to create location (ticklerFolder & “/” & currentMonth & “/” & currentDay)
set theChildren to the children of currentFolder
repeat with theRecord in theChildren
move record theRecord to todayFolder
end repeat
end tell
end tell
None of the other suggestions made work either, e.g., specifying the database for each action as follows:
set todayFolder to create location “/* Next Actions” in database “Daily”
I've tried simplifying the script (as below), just to switch to another database, with variations on the details for the path, but I consistently get the error "missing value" for the database, so I suspect this is where the problem lies.
tell application “DEVONthink Pro”
activate
set myDB to open database “Daily”
tell database myDB
activate
end tell
end tell
tell application “DEVONthink Pro”
activate
set myDB to open database “~/Documents/DevonThink/Daily”
tell database myDB
activate
end tell
end tell
Only this script:
tell application “DEVONthink Pro”
activate
set myDB to open database “~/Documents/DevonThink/Daily.dtBase2”
tell database myDB
activate
end tell
end tell
returns the reply --> database id 2
but changing the path this way in the first script just returns another error:
"DEVONthink Pro got an error: Can’t get database \"~/Documents/DevonThink/Daily.dtBase2\".
I'd be grateful for any advice!