Choosing a database is set in the Options in the Action menu of the Download Manager.
This is noted in the Help > Documentation > Windows > Download Manager.
However the Download Mgr does not seem to be able download to a specific location (i.e. in the same group as the original bookmark).
So I ended up using “download url” rather, which worked like a charm once I could figure out how to get its data into a new record:
set theData to download URL theDownloadURL
set theRecord to create record with {name:theName, type:PDF document, MIME type:"application/PDF"} in theGroup
set data of theRecord to theData
Will share the resulting script in this forum once I’m done with it.
I dare to burst in as I’m working on something similar, not for Google Docs but also URL to PDF.
What I’ve got so far is working quite good. I create a PDF from a URL in the destination I want and I convert hashtags to tags. My source is a plain text/Markdown file with a URL at the beginning and hashtags at the end.
What’s causing a problem is the stuff in between: I might have commented the web page and I’d like to transfer that comment to the PDF. Annotations don’t work with PDF says the dictionary. But it doesn’t say the same about comments. I still can’t get access to them, though. What am I doing wrong? Or are there alternatives?
In a Markdown file constructed like this:
Paragraph 1: url to create PDF from
Paragraph 2 to x (optional): comment
Last Paragraph (optional): hashtags
I might change the order of comment and hashtags, I might allow the hashtag paragraph to be freely movable, but the question remains where to put the comment in a newly created PDF.
set theNewDocument to create PDF document from theURL in theDestination name theName with readability and pagination
set tags of theNewDocument to theTags
Here’s the current working copy of this script which snapshots any bookmark of a google doc as a PDF doc. I use it for offline usage and search results.
You may use it in a Smart Rule or on selected items.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use script "RegexAndStuffLib" version "1.0.6"
use scripting additions
-- when calling on selection / single file
on run
tell application id "DNtp"
snapshotGDocs((selection of think window 1) as list) of me
end tell
end run
-- when called by smart rule
on performSmartRule(theRecords)
snapshotGDocs(theRecords as list) of me
end performSmartRule
-- generic wrapper to handle multiple snapshots
on snapshotGDocs(theRecords)
tell application id "DNtp"
show progress indicator "Snapshotting Google Docs ..." steps (length of theRecords) + 1
repeat with theRecord in theRecords
step progress indicator (name of theRecord) as text
snapshotGDoc(theRecord) of me
end repeat
hide progress indicator
end tell
end snapshotGDocs
-- record snapshotting
on snapshotGDoc(theBookmark)
tell application id "DNtp"
-- prepare some vars
set bookmarkURL to URL of theBookmark
set gDocID to regex search once bookmarkURL search pattern "[^/]{32,52}"
set exportURL to "https://docs.google.com/document/u/0/export?format=pdf&id=" & gDocID
set exportName to name of theBookmark & " (PDF Snapshot)"
set exportGroup to first parent of theBookmark
set referenceURL to get reference URL of theBookmark
-- download new snapshot
set exportData to download URL exportURL
-- cleanup old snapshots
set oldSnapshots to search "kind:pdf name:~snapshot url==" & referenceURL
repeat with oldSnapshot in (oldSnapshots as list)
move record oldSnapshot to trash group of current database
end repeat
-- save new snapshot
set theExport to create record with {name:exportName, type:PDF document, MIME type:"application/PDF", URL:referenceURL} in exportGroup
set data of theExport to exportData
-- reproduce replicates and tags of bookmark
repeat with parentGroup in parents of theBookmark
if id of parentGroup = id of exportGroup then
-- do not replicate to first parent
else
set theRep to replicate record theExport to parentGroup
end if
end repeat
end tell
end snapshotGDoc
I am using DTP3 so i don’t know about the simpler versions. Try it out and keep us informed.
My bet is that it could possibly work since the capture mechanism needs to also download URLs.
This workflow works really really well! Thanks for that!
How hard is it to expand it to google slides? The export URL doesn’t look like it’s working for slides