I am trying to get DevonTHINK to create web documents in the subgroup of a group using AppleScript, but it completely fails to do so without errors or feedback.
The script terminology I use is:
set myRecord to create web document from (URL) in child “Working” of parent “Websites” of database “Database”
set myItem to convert record myRecord to html
delete record myRecord
(The reason for converting the record is that I only need the HTML source and not the full x-MB web archive representation. There are thousands of documents, I don’t need multi-teen-GB databases)
Even with a valid (URL) with the existing child and parent, this script fails to create anything. If I choose a different subgroup, it’s fine. It appears DevonTHINK is allergic to “Working” ???
Maybe there are multiple parents (both tags & groups) having that name?
There’s only one child called “Working” in the parent “Websites”. There is another child called “!Working” in that parent, but if I download to there that’s fine.
What do you see when you run the code in script editor (in its protocol window, that is).
And it might help to post complete, real code, preferably enclosed in back ticks
```
code goes here
```
So others can see what might be the problem.
DevonTHINK replies to the “create web document” message with “missing value”. No errors, no nothing. So: it sees that there is a child “Working” in the parent “Websites” in database “Database” OK… it just doesn’t create a new record there…
I suggest, again, that you post complete code. And a screenshot of the script editor log
Why are you using an AppleScript in this case? Shouldn’t this simple smart rule be sufficient…
Note this is using the Location
placeholder so the Converted
group is a subgroup of where the original is located.
At the end you can see, and optionally delete, the labeled original items.
set myRecord to create web document from myLink in child "Working" of parent "Websites" of database "Database"
set myItem to convert record myRecord to html
delete record myRecord
to which DevonTHINK responds
missing value
The Smart Rule does the same thing and does work. Why doesn’t AppleScript then do the same?
I don’t use the Smart Rule this way as, after converting the records, I do extract information from the HTML source. DevonTHINK cannot do this so since I’m in AppleScript anyway I may as well create and convert the documents there.
There are several panes in the protocol window, at least one showing the send and received events. That would potentially have been useful.
But I’m out, this to and fro games is too tedious for me.
1 Like
We would generally advocate using the smart rule, which as you noted, works correctly.
Also, why are you using a child of parent of database
form? While it’s not necessarily wrong, you’d be better off using the reference URL
or get item at
and supplying the location.
If you want the event output:
[DevonTHINK] create web document from "https://.." in child "Working" of parent "Websites" of database "Database"
--> missing value
[DevonTHINK] convert record missing value to html
--> missing value
It doesn’t appear to matter if I abstract the destination group first:
set myGroup to child "Working" of parent "Websites" of database "Database"
...
set myRecord to create web document from myLink in myGroup
--> missing value
Again… If I give this group any other name, it’s fine. But ‘Working’ dus not work…