I am using the script below to archive the current Firefox URL to DT, but the script is unfortunately configured to archive the URL to whatever database happens to be open at the moment, and if none are open, then it will open the database that I’ve specified as the ‘Default DT Dtatabase’ within the DT preferences, and then it will archive the URL to that database…
I was hoping that someone might be able to respond back with a modified version of the script below that will archive the current firefox URL to a particular database…specifically:
Database Name: Tech Database.dtBase
Database Path: HD1:DEVONthink Pro Database:Tech Database.dtBase
Not sure if its the default behavior of the program, or if any additional customization would need to be done, to first close any currently opened DT database (that isn’t the one specified above) before opening the specific database I want to archive firefox URLs to - but in case that’s not the default behavior, I would of course need the script setup to do this…
Any help with this would be greatly appreciated…Thanks!
tell application "GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Add webarchive"}
-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the growl prefpane.
set the enabledNotificationsList to ¬
{"Add webarchive"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application ¬
"WebImporter" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "DEVONthink Pro"
end tell
on getCurrentURL()
tell application "System Events"
set myApp to name of first application process whose frontmost is true
if myApp is "Camino" then
-- tell application "Camino"
-- URL of window 1
-- end tell
else if myApp is "firefox-bin" then
tell application "Firefox"
«class curl» of window 1
end tell
else if myApp is "Safari" then
tell application "Safari"
URL of document 1
end tell
else if myApp is "Opera" then
-- tell application "Opera"
-- set myInfo to GetWindowInfo of window 1
-- item 1 of myInfo
-- end tell
else
return
end if
end tell
end getCurrentURL
tell application "DEVONthink Pro"
set this_url to my getCurrentURL()
display dialog this_url
set theArchive to create record with {name:this_url, type:html, URL:this_url} ¬
in incoming group
try
with timeout of 60 seconds
set data of theArchive to download web archive from this_url
try
set this_source to source of theArchive
if this_source is not missing value then
set this_title to get title of this_source
if this_title is not missing value and this_title is not "" then
set the name of theArchive to this_title
end if
end if
end try
end timeout
tell application "GrowlHelperApp"
notify with name "Add webarchive" title this_title ¬
description "Added to DEVONthink Pro" application name "WebImporter"
end tell
on error msg
tell application "GrowlHelperApp"
notify with name "Add webarchive" title this_title description msg ¬
application name "WebImporter"
end tell
end try
end tell