On 03/03/13 10:01, Ariel Constenla-Haile wrote: > On Sun, Mar 03, 2013 at 08:57:49AM -0600, Larry Evans wrote: >> and the calc window opened. I then put macros security at medium, and then >> loaded the attached .ods file, and then created a macro containing the >> previously attached NumberFive.bsh. I was able to save it this time; >> however, >> when I tried to run it, I got an Error window with a pink octagon and red >> X and the message: >> Sourced file: inline evaluation of : ``import >> com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XcomponentContext; >> i...": Not an array >> So obviously it's not interpreting the file as java. I've again attached >> the file. What am I doing wrong? > > Are you running the macro from "Tools" - "Macros" - "Run Macro..." / "Tools" > - "Macros" - "Organize macros" - "BeanShell..." - "Run"? or are you > running the macro from the "editor"? >From the editor. > > > If from the editor, try putting debug(); at the top of the editor, to > see what's happening (I guess a null pointer exception), remove debug(); > before storing the file. Changed 1st line to:
debug(); then ran in editor and got error window with text: sourced file: inline evaluation of: ``debug(); import com.sun.star.uno.UnoRuntime; import ..." unknown error: null In the terminal window where ./scalc was typed, there was: -----------cut here------------ evansl@evansl-desktop:~/download/OpenOffice/r1372282/Apache_OpenOffice_incubating_3.4.1_Linux_x86-64_install-arc_en-US/openoffice.org3/program$ ./scalc& [1] 7051 evansl@evansl-desktop:~/download/OpenOffice/r1372282/Apache_OpenOffice_incubating_3.4.1_Linux_x86-64_install-arc_en-US/openoffice.org3/program$ ** (soffice:7061): WARNING **: Invalidate all children called // Debug: Trying to load class: com.sun.star.frame.XModel // Debug: getResolvedMethod cache MISS: class com.sun.star.script.framework.provider.ScriptContext - getInvocationContext // Debug: Searching for method: getInvocationContext() in 'com.sun.star.script.framework.provider.ScriptContext' // Debug: cacheResolvedMethod putting: class com.sun.star.script.framework.provider.ScriptContext public com.sun.star.document.XScriptInvocationContext com.sun.star.script.framework.provider.ScriptContext.getInvocationContext() // Debug: Invoking method (entry): public com.sun.star.document.XScriptInvocationContext com.sun.star.script.framework.provider.ScriptContext.getInvocationContext() with args: // Debug: Invoking method (after massaging values): public com.sun.star.document.XScriptInvocationContext com.sun.star.script.framework.provider.ScriptContext.getInvocationContext() with tmpArgs: // Debug: trying to resolve variable: UnoRuntime // Debug: trying class: UnoRuntime // Debug: Trying to load class: com.sun.star.uno.UnoRuntime // Debug: invokeMethod: trying static - UnoRuntime // Debug: invoke static Method // Debug: getResolvedMethod cache MISS: class com.sun.star.uno.UnoRuntime - queryInterface // Debug: Searching for method: queryInterface( java.lang.Class, null ) in 'com.sun.star.uno.UnoRuntime' // Debug: Looking for most specific method: queryInterface // Debug: cacheResolvedMethod putting: class com.sun.star.uno.UnoRuntime public static java.lang.Object com.sun.star.uno.UnoRuntime.queryInterface(java.lang.Class,java.lang.Object) // Debug: Invoking method (entry): public static java.lang.Object com.sun.star.uno.UnoRuntime.queryInterface(java.lang.Class,java.lang.Object) with args: // Debug: args[0] = interface com.sun.star.frame.XModel type = class java.lang.Class // Debug: args[1] = null type = class bsh.Primitive // Debug: Invoking method (after massaging values): public static java.lang.Object com.sun.star.uno.UnoRuntime.queryInterface(java.lang.Class,java.lang.Object) with tmpArgs: // Debug: tmpArgs[0] = interface com.sun.star.frame.XModel type = class java.lang.Class java.lang.NullPointerException at bsh.Reflect.invokeOnMethod(Unknown Source) at bsh.Reflect.invokeStaticMethod(Unknown Source) at bsh.Name.invokeMethod(Unknown Source) at bsh.BSHMethodInvocation.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHAssignment.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at com.sun.star.script.framework.provider.beanshell.ScriptSourceModel.execute(Unknown Source) at com.sun.star.script.framework.provider.beanshell.ScriptEditorForBeanShell.execute(Unknown Source) at com.sun.star.script.framework.provider.beanshell.ScriptEditorForBeanShell.actionPerformed(Unknown Source) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6389) at javax.swing.JComponent.processMouseEvent(JComponent.java:3268) at java.awt.Component.processEvent(Component.java:6154) at java.awt.Container.processEvent(Container.java:2045) at java.awt.Component.dispatchEventImpl(Component.java:4750) at java.awt.Container.dispatchEventImpl(Container.java:2103) at java.awt.Component.dispatchEvent(Component.java:4576) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4633) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4297) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4227) at java.awt.Container.dispatchEventImpl(Container.java:2089) at java.awt.Window.dispatchEventImpl(Window.java:2518) at java.awt.Component.dispatchEvent(Component.java:4576) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:672) at java.awt.EventQueue.access$400(EventQueue.java:96) at java.awt.EventQueue$2.run(EventQueue.java:631) at java.awt.EventQueue$2.run(EventQueue.java:629) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:116) at java.awt.EventQueue$3.run(EventQueue.java:645) at java.awt.EventQueue$3.run(EventQueue.java:643) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105) at java.awt.EventQueue.dispatchEvent(EventQueue.java:642) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177) evansl@evansl-desktop:~/download/OpenOffice/r1372282/Apache_OpenOffice_incubating_3.4.1_Linux_x86-64_install-arc_en-US/openoffice.org3/program$ -----------cut here------------ Thanks for the help Ariel, and any further help would certainly be appreciated. > > > This file as a macro that runs fine: > http://people.apache.org/~arielch/api/BeanShell.ods > > The ODS you attached on the other mail has code that work only with > Writer: Yes, sorry about that. I was just trying to save that one in OO3.2 and was having trouble just doing that. However, as seen by the latest NumberFive.bsh, The XTextDocument was changed to XSpreadsheetDocument. [snip] -regards, Larry --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@openoffice.apache.org For additional commands, e-mail: users-h...@openoffice.apache.org