I'm trying to automate stuff with OmniFocus with the scripting bridge.
It's working, but I'm have problems with creating new projects:
#!ruby
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
omnifocus = SBApplication.applicationWithBundleIdentifier_("co m.omnigroup.OmniFocus")
p = { "name" => "Foo" }
Project = omnifocus.classForScriptingClass_("project")
proj = Project.alloc();
proj.initWithProperties_(p);
# this causes a bus error
# proj.get();
# this also causes a bus error
omnifocus.documents()[0].projects().insertObject_atIndex_(proj,0)
I get this error
travis-2:~ mark$ ruby testscript
ruby: unknown type name "item".
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_wrapper.rb:50: [BUG] Bus Error
ruby 1.8.6 (2007-09-24) [universal-darwin9.0]
Abort trap
What am I doing wrong?
It's working, but I'm have problems with creating new projects:
#!ruby
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
omnifocus = SBApplication.applicationWithBundleIdentifier_("co m.omnigroup.OmniFocus")
p = { "name" => "Foo" }
Project = omnifocus.classForScriptingClass_("project")
proj = Project.alloc();
proj.initWithProperties_(p);
# this causes a bus error
# proj.get();
# this also causes a bus error
omnifocus.documents()[0].projects().insertObject_atIndex_(proj,0)
I get this error
travis-2:~ mark$ ruby testscript
ruby: unknown type name "item".
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_wrapper.rb:50: [BUG] Bus Error
ruby 1.8.6 (2007-09-24) [universal-darwin9.0]
Abort trap
What am I doing wrong?