View Single Post
That works fine - very elegant !

If no Omnifocus window is open when your script is launched, an NSReceiverEvaluationScriptError is raised.

Without being able to see your code I suspect that you could avoid that by including a test for a window at the start, and creating a new window if needed. e.g.
    set oDoc to default document
    tell oDoc
        if number of document window is 0 then
	    make new document window with properties {bounds:{0, 0, 1000, 500}}
        end if
    end tell