The script is:
tell application "DEVONthink Pro"
activate
end tell
tell application "System Events"
tell process "DEVONthink Pro Office"
tell menu bar 1
tell menu bar item "Data"
tell menu "Data"
tell menu item "Open With"
tell menu "Open With"
click menu item "Preview (default)"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
If run direct from the AppleScript Editor, it would work as expected, i.e. open the selected file with Preview. But if run from DEVONthink itself, it would do nothing except pause the application for some seconds.
Why is this happening? How to get it work as expected?