#235: Problems with adding objects to scriptable applications via scripting bridge --------------------------------+------------------------------------------- Reporter: i.scr...@… | Owner: lsansone...@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Keywords: ScriptingBridge Error --------------------------------+------------------------------------------- hi,
lately I've tried to get some exerience in scripting DEVONthink using the ScriptingBridge. This works overall very well. Only the "create a record with in" command crates headaches for me. The following code-snippet exemplifies the problem: {{{ #!/usr/local/bin/macruby framework "Cocoa" framework "Foundation" framework "ScriptingBridge" devon = SBApplication.applicationWithBundleIdentifier("com.devon- technologies.thinkpro2") theGroup = devon.createLocation '/root/scripts/myscript', :in => '/' theRecord =devon.classForScriptingClass("record").alloc.initWithProperties({'type'=>'text','plainText'=>"Hallo Welt!",'name' =>"helloworld"}) puts theRecord.description # Scripting Bridge does not actually create an object in the target application until you add the allocated and # initialized object to an appropriate element array (SBElementArray), such as records in my example. # thats's the way it should be done, but its not working puts devon.databases[0].records.insertObject(theRecord, :atIndex => 11) # or : puts devon.databases[0].records.addObject(theRecord) theRecord.createRecordWithIn resultRecord }}} While working with this code snippet I've found out that: 1. if i use: "puts theRecord" instead of "puts theRecord.description" the script runs out of time 2. the attempt to instantiate a scripting object within DEVONthink creates this error: {{{ /Users/stereocle/Documents/devonruby.rb:24:in `insertObject:atIndex:': NSGenericException: Apple event returned an error. Event = 'core'\'crel'{ 'kocl':'DTrc', 'insh':'insl'{ 'kobj':'obj '{ 'want':'DTrc', 'from':'obj '{ 'want':'DTkb', 'from':'null'(), 'form':'indx', 'seld':1 }, 'form':'indx', 'seld':1 }, 'kpos':'befo' }, 'prdt':{ 'DTpl':'utxt'("Hallo Welt"), 'pnam':'utxt'("helloworld"), 'DTty':'utxt'("text") } } (RuntimeError) Error info = { ErrorNumber = -10000; }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/235> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel