Different results of running the same AppleScript
The problem may be quite simply that your compiled applescript is not privileged to access DEVONthink-Pro's menus - but ScriptEditor is ...

Have a look into: &nbsp; System-Preferences-app / Security &amp; Privacy / Privacy
... and select "Accessibility" in the list on your left.

Now you can add your compiled app to the "privileged list" on the right side.