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

Running Macro from Command in Linux

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





PostPosted: Wed Mar 31, 2004 2:29 am    Post subject: Running Macro from Command in Linux Reply with quote

Dear Members,

I have a written a macro in the Standard.Module1.Main ,and I want to call that macro from command prompt .I logged in into the system as root and I added the macro code in standard.Module1.Main , when I run the soffice with the macro name as root it is running , but if I login into my system by any user other than root , the macro is not running .

I could see Openoffice is opening and closing with out running the macro , but if I login into the system with root , the macro is running . Can anyone give me an idea so that macro will executed to all the users .

Regards,

Ramesh.M
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Mar 31, 2004 7:00 am    Post subject: Reply with quote

Did you add the macro under "soffice"?

I'm assuming that you want to have a macro stored into the Office and not stored in a document. If you store the macro in a document, then that document must be open, and you must use a different URL from the command line to run the macro.

I am also assuming that you are familiar with how to write a "macro://" url to run a macro from the command line.

Here is what I believe your problem is. The "root" user is just another user. One difference is that root's home directory is different than other users, but this is not an important difference. In each user's home directory is a subdirectory named "~\OpenOffice.org1.1.1\".

OOo stores its configuration (and I am using that term in a very loose and large sense here) data in two layers.
1. Shared
2. User

The Shared layer is in your OOo installation path as... OOo\share
The User layer, on Linux, is in your home directory as ~\OpenOffice.org1.1.1.

When you store a macro under "soffice" it is still being stored in the User layer of the configuration. Therefore, what got changed was the /root/OpenOffice.org1.1.1 folder, but not the /home/danny/OpenOffice1.1.1 folder. Therefore, when "danny" logs in, he would not see the macro under soffice that you stored as root. Does that make sense?

The macro you stored is very likely to be here...

/root/OpenOffice.org1.1.1/user/basic/Standard/Module1.xba

but not here....

/home/danny/OpenOffice.org1.1.1/user/basic/Standard/Module1.xba

Therefore when "root" logs in, he can see the macro under "soffice" Standard, Module1. But when "danny" logs in, he cannot see it.

You could make the macro a permanent part of OOo by putting it into the Share layer rather than the User layer. Look in this folder....

/opt/OpenOffice.org1.1.1/share/basic

See a similar organization? You could create a new folder here. Add some ".xba" files, and then edit the "script.xlb" file, and you might now have a macro visible to all users. I would highly recommend making a backup of the entire /opt/OpenOffice.org1.1.1/share folder first.

I am assuming of course, that you install OOo into the /opt/OpenOffice.org1.1.1 as does SuSE and the civilized world, not like those savages wearing red headwear who install under /usr/local. :-)
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Ramesh
Guest





PostPosted: Thu Apr 01, 2004 12:06 am    Post subject: Reply with quote

Dear Danny,


Thank you for your suggestions , for helping me to go in the right direction .

Did you add the Macro under soffice ?
yes I added all the macros under soffice=>Standard .

As you said since I added all the macros under root user , I could see all my macros in
/root/OpenOffice.org1.1.0/user/basic/Standard/

and once I copied these macros and the script.xlb in the user where my macros were not working :

/team/OpenOffice.org1.1.o/user/basic/Standard .

The macro began to run now .

So I proceeded with the next step . Copied all these macros and the script.xlb in the
/opt/OpenOffice.org1.1.0/share/basic/Standard (folder which I created as you said) and copied all the files in this path .

Then I logged into the system as another user ,where in the local path I dont have any macros in it .

then I tried to run the macro from command prompt like this :

soffice macro:///Standard.Module1.Main

its just opening the OpenOffice and closing without running the Macros .
I dont want to copy these files into each and individual users Danny,I want those macros to be global .

I need your suggestions and advice.

And one more issue . I created a macro in a document called Hello.sxw and I saved in the user area . I want to call the macro in that document from command prompt . I issued the command like this :

soffice macro:///Hello.Standard.Module1.Main

Its not showing any result ,what might be the reason , waiting for your reply....

Ramesh.M
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Thu Apr 01, 2004 8:03 am    Post subject: Reply with quote

I would highly recommend that you deploy the macros using the pkgchk tool.

You can use the "shared" option to the pkgchk tool. The tool is located in your OOo\program folder.

Make sure that no copy of OOo is running when you run this tool.

Read about how to deploy Basic libraries here.
http://api.openoffice.org/docs/DevelopersGuide/BasicAndDialogs/BasicAndDialogs.htm#1+7+Library+File+Structure
http://api.openoffice.org/docs/DevelopersGuide/BasicAndDialogs/BasicAndDialogs.htm#1+8+Library+Deployment
These are part of the Developer's Guide...
http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.htm

I think your problem may be that you are copying the xba files, but not editing the script.xlb file to reflect the presence of the new xba files.
_________________
Want to make OOo Drawings like the colored flower design to the left?
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