How to start Omnifocus with a specific Omnifocus document by apple script?

I would like to start Omnifocus by apple script. It should automatically open a specific Omnifocus document which is not the default Omnifocus document.

The default Omnifocus document are my private tasks, the other one are my work tasks.

My script looks like:

tell application “Terminal”
do shell script “/Applications/ /Users/james/Omnifocus/work.ofocus”
end tell

When I start the script I get an error:
Cannot open document, because lock file cannot be written (translated from german)

Could anybody help me what I’m doing wrong or how I can fix this?
Thanks in advance

I’m pretty unfamiliar with AppleScript, but as far as the shell script bit of this goes: could you use the open command instead of invoking the OmniFocus app binary directly? This might look something like:

do shell script "open /Users/james/Omnifocus/work.ofocus"

Since OmniFocus is the app registered to open .ofocus documents, the system should hand the non-default document off to OmniFocus – and it might do it in a more friendly way that lets OmniFocus write its lock file correctly.

If not, another AppleScript guru might step in to help, or you can write in to our support team and they’ll see what they can do to help out.

Perfect! This does the job for me.
Thank you very much :-)