How to create webarchives with content via Applescript

I use the following line to create webarchives from Applescript:

create record with {name:theName, type:webarchive, URL:theUrl, creation date:theCreation, tags:theTags} in theGroup

This works - except that the resulting record doesn’t contain any content. :frowning:

How can I create webarchives with content via Applescript?

Do I have to add the content in a 2nd Applescript step as “capture” via applescript - DEVONthink / Automation - DEVONtechnologies Community suggests?

Thanks for any pointers! :slight_smile:

You should consult DEVONthink’s AppleScript dictionary as well as look at the included scripts in the Download directory.

A simple example…

property theURL : "http://jacopastorius.com/life/"

tell application id "DNtp"
	set currentLocation to current group
	create web document from theURL in currentLocation
end tell

Thanks. Make sense - and works. :slight_smile:

One more question: create web document returns a record id. How can I then change the other attributes of the record with that id to {name:theName, creation date:theCreation, tags:theTags}?

I looked for something like change record with but couldn’t find it. (I’m not an AppleScript expert.)

A teaching edition example…

set newRecord to (create web document from theURL in currentLocation)
set comment of newRecord to "This is a comment."
set label of newRecord to 1
…

Thanks a lot, Jim. Works as advertised - except for theCreation:

set creation date of theRec to theCreation

doesn’t seem to do anything while it works in the original version

create record with {name:theName, type:webarchive, URL:theUrl, creation date:theCreation, tags:theTags} in theGroup

How do I set the creation (and preferably the modification) date to a given variable theCreation?