openoffice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Evans <cppljev...@suddenlink.net>
Subject Re: calc BeanShell script save gives "error saving script" window.
Date Sun, 03 Mar 2013 18:09:25 GMT
On 03/03/13 10:33, Larry Evans wrote:
> On 03/03/13 10:01, Ariel Constenla-Haile wrote:
> [snip]
>> This file as a macro that runs fine:
>> http://people.apache.org/~arielch/api/BeanShell.ods 
> After downloading that file, I opened it and got an "OpenOffice.org
> Error" with text:
>
>   Message: Sourced file: inline evaluation of:
> ``/*****************************************
> * * * Licensed ..." unknown error: null
>
> Any help is appreciated in resolving this problem ;)
>
> -Larry
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@openoffice.apache.org
> For additional commands, e-mail: users-help@openoffice.apache.org
>
>
The terminal window output was:

evansl@evansl-desktop:~/download/OpenOffice/r1372282/Apache_OpenOffice_incubating_3.4.1_Linux_x86-64_install-arc_en-US/openoffice.org3/program$
./scalc BeanShell.ods&
[2] 7427
evansl@evansl-desktop:~/download/OpenOffice/r1372282/Apache_OpenOffice_incubating_3.4.1_Linux_x86-64_install-arc_en-US/openoffice.org3/program$
// Debug: trying to resolve variable: bsh
// Debug: trying class: bsh
// Debug: Trying to load class: java.lang.bsh
// Debug: Trying to load class: java.io.bsh
// Debug: Trying to load class: java.util.bsh
// Debug: Trying to load class: java.net.bsh
// Debug: Trying to load class: java.awt.bsh
// Debug: Trying to load class: java.awt.event.bsh
// Debug: Trying to load class: javax.swing.bsh
// Debug: Trying to load class: javax.swing.event.bsh
// Debug: Trying to load class: bsh
// Debug: getClass(): bsh not    found in NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: not a class, trying var prefix bsh
// Debug: Looking for most specific constructor: class bsh.XThis
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: Looking for most specific constructor: class bsh.XThis
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: Time to initialize interpreter: 22
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: eval(String):
/**************************************************************
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 *************************************************************/
/*
    Import standard OpenOffice.org API classes. For more information on
    these classes and the OpenOffice.org API, see the OpenOffice.org
    Developers Guide at:

    http://api.openoffice.org/
*/

import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XModel;

/*
    Import XScriptContext class. An instance of this class is available
    to all BeanShell scripts in the global variable "XSCRIPTCONTEXT". This
    variable can be used to access the document for which this script
    was invoked.

    Methods available are:

        XSCRIPTCONTEXT.getDocument() returns XModel
        XSCRIPTCONTEXT.getInvocationContext() returns
XScriptInvocationContext or NULL
        XSCRIPTCONTEXT.getDesktop() returns XDesktop
        XSCRIPTCONTEXT.getComponentContext() returns XComponentContext

    For more information on using this class see the scripting
    developer guides at:

       
http://api.openoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml
*/
       
// Hello World in BeanShell
import com.sun.star.lang.XServiceInfo;

oDoc =
UnoRuntime.queryInterface(XModel.class,XSCRIPTCONTEXT.getInvocationContext());
if ( oDoc == null )
  oDoc = XSCRIPTCONTEXT.getDocument();

xServiceInfo =
UnoRuntime.queryInterface(com.sun.star.lang.XServiceInfo.class, oDoc);
if ( xServiceInfo == null ||
!xServiceInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument")) {
    System.err.println("Document isn't a spreadsheet document");
    return 0;
}

xController = oDoc.getCurrentController();
xSheetView =
UnoRuntime.queryInterface(com.sun.star.sheet.XSpreadsheetView.class,
xController);
xActiveSheet = xSheetView.getActiveSheet();
xActiveSheet.getCellByPosition(0,0).setValue(123.456789);

// BeanShell OpenOffice.org scripts should always return 0
return 0;

// Debug: eval: nameSpace = NameSpace: global (bsh.NameSpace@3f56e5ed)
// Debug: trying to resolve variable: bsh
// Debug: trying class: bsh
// Debug: Trying to load class: java.lang.bsh
// Debug: Trying to load class: java.io.bsh
// Debug: Trying to load class: java.util.bsh
// Debug: Trying to load class: java.net.bsh
// Debug: Trying to load class: java.awt.bsh
// Debug: Trying to load class: java.awt.event.bsh
// Debug: Trying to load class: javax.swing.bsh
// Debug: Trying to load class: javax.swing.event.bsh
// Debug: Trying to load class: bsh
// Debug: getClass(): bsh not    found in NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: not a class, trying var prefix bsh
// Debug: Looking for most specific constructor: class bsh.XThis
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: Looking for most specific constructor: class bsh.XThis
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: trying to resolve variable: bsh
// Debug: resolved variable: bsh in namespace: NameSpace: global
(bsh.NameSpace@3f56e5ed)
// Debug: found This reference evaluating LHS
// Debug: Time to initialize interpreter: 37
// 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.ScriptImpl.invoke(Unknown
Source)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-help@openoffice.apache.org


Mime
View raw message