Change in behaviour of 'import' verb

I’ve posted a support ticket about this, but I am posting it here because it has caused some of my scripts to break or behave in strange ways

The behaviour of the applescript import verb appears to have changed in 2.8.8. Now as soon as an applescript imports a document using the ‘import’ verb, the imported document is automatically selected.

These seems to me to be an undesirable behaviour. An import action taken by a script should be silent to the user of the script unless the script specifically makes the imported document the selected document. The script may take other actions in the background including wanting to keep the existing selection.

If you have existing scripts which rely on the fact that the selection state hasn’t changed after an import, the scripts may not work or may give an unexpected result.

An example:

A script splits up a document into pages and imports them. Each import should not result in a new automatic selection of the imported document.

This is a brief applescript which demonstrates the behaviour

tell application id "DNtp"
activate
try
set theInbox to (create location "/Inbox")

-- this results in the existing selection being removed and the new test.jog being selected and displayed
set r to import "/Users/[user]/Desktop/test.jpg" name "test.jpg" to theInbox

on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
end try
end tell

Frederiko

I don’t see a selection change unless the import destination is the same as the selection location.

The selected document is changed to the imported document no matter the directory the import occurs too

Script running before import

Screen Shot 2016-01-02 at 5.44.29 PM.jpg

Script running immediately after import

Screen Shot 2016-01-02 at 5.50.15 PM.jpg

Frederiko

Note: This is particular to Split View and whether the destination is open. Close the Inbox and select a file in another Group. Run the script and the selection shouldn’t change.