OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Why "Error saving script" error?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
CXXLJEVANS
General User
General User


Joined: 17 Mar 2011
Posts: 18

PostPosted: Tue Apr 17, 2012 1:05 pm    Post subject: Why "Error saving script" error? Reply with quote

I created a new spreadsheet document, then created a macro,
Macro1, which the program defined with some default value
which had, on line 45:

xTextRange.setString("Hello World(in BeanShell)");

Then tried to run the macro and the error I got was on line
43 which was:

xText = xTextDoc.getText();

Which was understandable since the doc type was a spreadsheet
not a text document.

So, from seeing XSpreadsheet on:

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Working_With_Spreadsheet_Documents

I guessed that everywhere there was Text, there should be Spreadsheet.
So, after changing:

import com.sun.star.text.XTextDocument;

to:

import com.sun.star.text.XSpreadsheetDocument;

and:

xTextDoc =
(XTextDocument)UnoRuntime.queryinterface
(XTextDocument.class,...

to:

xTextDoc =
(XTextDocument)UnoRuntime.queryinterface
(XSpreadsheet Document.class,...

I tried to save the script; however, this caused and error
window to appear with title "Error" and content:

(X) Error saving script:

[OK]

which gave me no hint as to what I was doing wrong.

So, how can I save the script with my modifications?

My OOo version(from the About under Help) is:

OpenOffice.org 3.2.0
OOO320m12(Build:9483)

My os is linux:

~/prog_dev/OpenOffice/writer $ uname -a
Linux evansl-desktop 2.6.32-38-generic #83-Ubuntu SMP Wed Jan 4 11:12:07
UTC 2012 x86_64 GNU/Linux

I did search for:

Error saving script

on the forum:

http://www.oooforum.org/forum/search.phtml

and got several hits; however, none had to do with saving scripts.

TIA for any help.

-regards,
Larry
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Wed Apr 18, 2012 1:21 am    Post subject: Reply with quote

Hi,
What you are doing : create a macro in BeanShell.

What is your problem : cannot save your macro.
There is no relation with any instructions you may have set in the macro.

Do not create your macro in "OpenOffice.org macros". In some OS it may be write protected.
Create the macro in "My Macros" or in your document.

You should learn the API before attempting to write anything in BeanShell (or JavaScript). This is much more difficult than with Basic. And even with Basic, learning the API is not easy.
_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
CXXLJEVANS
General User
General User


Joined: 17 Mar 2011
Posts: 18

PostPosted: Wed Apr 18, 2012 4:23 am    Post subject: Reply with quote

B Marcelly wrote:
Hi,
What you are doing : create a macro in BeanShell.

What is your problem : cannot save your macro.
There is no relation with any instructions you may have set in the macro.

Do not create your macro in "OpenOffice.org macros". In some OS it may be write protected.
Create the macro in "My Macros" or in your document.

You should learn the API before attempting to write anything in BeanShell (or JavaScript). This is much more difficult than with Basic. And even with Basic, learning the API is not easy.


Thanks very much. Just as you said, creating the macro under "My Macros"
avoided the problem.

However, I did not put the initial macro under "OpenOffice.org macros".
Instead, the initial macro was put in:

Code:

  simple_script.ods
    Library1
      Macro1.js


I would think, since the simple_script.ods is writeable by me (since I created it),
the simple_script.ods->Library1->Macro1.js would be writeable also.

Why can't the script be saved under simple_script.ods?

-regards,
Larry
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group