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

assigning macros for multiple users

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


Joined: 15 Aug 2004
Posts: 7

PostPosted: Sun Aug 15, 2004 4:43 pm    Post subject: assigning macros for multiple users Reply with quote

Hello Everyone,

I just started to use Open Office. Now I got some problems with the macros.
I created a macro which creates automatically a backup when I close the program. now the problem is that many users on different workstations will use that spreadsheet. I just realized that they all have to assign the macro to the "Close Application" Event.
Is there another way to do this? Because I can't go to every user to assign this macro.

I also got a similar problem with assigning Keyboard Shortcuts to macros. Is there a way to put the shortcut in the macro?

Thanks a lot for the help.
Tom
Back to top
View user's profile Send private message
Iannz
OOo Advocate
OOo Advocate


Joined: 14 Feb 2004
Posts: 494
Location: Christchurch, New Zealand

PostPosted: Sun Aug 15, 2004 7:01 pm    Post subject: Reply with quote

Macros can be:
* In the document (recommend for your case)
* In a library and the libraries can be shared or personal. To check out the location of the libraries Tool > Options > OpenOffice.org > Paths >BASIC

Similarly key shortcuts can be saved with a file. The following is copied from my document on migrating from MO to OOo available from the URL in the signature.

Storing configurations in a template
This section is about how to store changes to menus, keyboard shortcuts, status bar and toolbars to a template (or document).
1) Create and save the template that is to have the configurations saved into it. Having a back-up of the template without the configuration changes is probably a good idea
2) Make the desired changes to the configuration. (See 3.1 Toolbars, 3.2 Customizing Menus and 3.3 Keyboard Shortcuts above). Note any changes that you don't want as standard, as these will have to be undone
3) Tools > Configure
4) For each type of customization which is to be stored in the template (i.e, for each tab of the dialog that you want to change), click Save and choose the desired template (I.e, the one created and saved in step 1)
5) It is OK to overwrite the file the warning message that is displayed is inappropriate and can be ignored
6) Undo the changes that are not wanted as standard (as were noted in step 2)
_________________
Cheers, Ian

http://wiki.services.openoffice.org/wiki/Extensions_development_basic a wiki about writing OpenOffice.org extensions.
Back to top
View user's profile Send private message
budgiepet
General User
General User


Joined: 15 Aug 2004
Posts: 7

PostPosted: Sun Aug 15, 2004 8:13 pm    Post subject: Reply with quote

Hello Ian,

Thanks a lot for the very fast answer.
But it didn't work.

I did as you wrote(I just saved the whole macro to the file) and when I want to open it again the taskbar(File, Edit, Tools,...) disappeared and when I want to work in the document it just closed and it want to send an error report.

Thanks for your help and greetings to NZ.
Tom
Back to top
View user's profile Send private message
Iannz
OOo Advocate
OOo Advocate


Joined: 14 Feb 2004
Posts: 494
Location: Christchurch, New Zealand

PostPosted: Sun Aug 15, 2004 9:17 pm    Post subject: Reply with quote

I don't know what you mean by saving the whole macro to the file. Did you create a library and module(s) in the file and copy the macro into it?

Did you follow the above instructions on saving configuration changes to a file?

I don't know why OOo crashed on you - it is a comparatively rare occurence. In case others have found a similar situation and can help please let us know what version of OOo you are running and on what operating system.

I tried it on OOo1.1.2 running on Linux (Mandrake10) and it worked. I have previously tried it on earlier versions, but can't remember the first version. I think that there was a problem in quite early versions. If you have an early version it would pay to upgrade to 1.1.2.

Have another try, because I know that this does work.
_________________
Cheers, Ian

http://wiki.services.openoffice.org/wiki/Extensions_development_basic a wiki about writing OpenOffice.org extensions.
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


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

PostPosted: Mon Aug 16, 2004 9:51 am    Post subject: Reply with quote

If you are willing to hand edit the ".xlb" files, then you can do this....

1. Create a global macro. (The macro is only for you, because it is in your "user" folder.)

Look at the user/basic folder.
If OOo is on Windows, then the "user" folder is often a folder named "user" directly under your OOoInstallation folder, usually in Program Files.
If OOo is on Linux, then the "user" folder is often a folder named "user" under a folder named OpenOffice.org1.1.2 in your home directory.

In the user/basic folder, find the library folder and the module files. If your module was named "MyModule" and is under "MyLibrary", then the folder name is user/basic/MyLibrary, and the file is named MyModule.xba.

Copy the MyModule.xba from the user/basic folder to the share/basic folder, under a similar MyLibrary folder.

The share folder is always directly under the OOoInstall folder.

You also need a script.xlb file in the share/basic/MyLibrary folder. This file needs to be hand edited to indicate that your module is present. You need to hand edit the script.xlb in the user/basic/MyLibrary folder so that it no longer indicates the MyModule is present.

If you are unfamiliar with this, then definitely make backups of your "user" and "share" folders before proceeding.

Once you get it, you can install global libraries such that they are visible to all users of OOo, because they are installed into the "share" folder instead of the "user" folder.

Hope that all makes sense.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
budgiepet
General User
General User


Joined: 15 Aug 2004
Posts: 7

PostPosted: Mon Aug 16, 2004 4:23 pm    Post subject: Reply with quote

Hello Ian,

Thanks for the message again.
I think I made the mistake to save the macros to the file (Tools-->Configuration, under Menu, then I just clicked on the macros and saved it, and when I reopened the file again, the whole OOo doesn't work anymore, by the way I am using OOo 1.1.2 and Win98)
This time I saved the Keyboardshortcuts under Keyboard and I hope that will work, but I still have to test it on another computer but at least OOo is working when I reopen the file.

But my problem is still with my automatically backup-macro, I can't save that (there is no save button?) Is there a way to put it into the macro? (I did that with VBA in Excel).
My macro looks like that:
Sub Main
oTextDoc = ThisComponent
cDocumentTitle = oTextDoc.getDocumentInfo().Title

If Len( cDocumentTitle ) = 0 Then
MsgBox( "You need to set the document title first. Pick File -> Properties -> Description -> Title." )
Exit Sub
EndIf

cBackupFolder = "c:\backup"

cDocumentTitle = cDocumentTitle + "-" + TimeStamp()

' Save a backup as SXC
cURL = ConvertToURL( cBackupFolder + "\" + cDocumentTitle + ".sxc" )
oTextDoc.storeToUrl( cURL, Array() )

End Sub

Thanks for your help.

To Danny, thanks for your proposal, but the way I understood it, it will only work on the computer where OOo is installed(also with different users but only where the library is), is that right?
I want to use the file on different computers in a network. Thanks anyways.

Tom
Back to top
View user's profile Send private message
Iannz
OOo Advocate
OOo Advocate


Joined: 14 Feb 2004
Posts: 494
Location: Christchurch, New Zealand

PostPosted: Mon Aug 16, 2004 5:05 pm    Post subject: Reply with quote

budgiepet wrote:
But my problem is still with my automatically backup-macro, I can't save that (there is no save button?) Is there a way to put it into the macro? (I did that with VBA in Excel).

To have the macro in the spreadsheet document (I think that is what you are asking):
Tools > Macros > Macro...
Make sure that the current file is selected
Click new
Give the module a name or accept Module1
Copy and paste your macro code into the module sheet within the spreadsheet document. You can use the drop down in the top left of the IDE to change which library you are currently viewing.
_________________
Cheers, Ian

http://wiki.services.openoffice.org/wiki/Extensions_development_basic a wiki about writing OpenOffice.org extensions.
Back to top
View user's profile Send private message
budgiepet
General User
General User


Joined: 15 Aug 2004
Posts: 7

PostPosted: Mon Aug 16, 2004 7:03 pm    Post subject: Reply with quote

Hey Ian,

sorry thats not what I meant, my problem is that I dont know how to write into the macro that it will run when I close the file?
Up to now I assign the macro to close document, but that won't work when I open the document on another workstation? (Tools-->Configuration-->Events, then I select my maco and assign it to close document)

Thanks for the help,
Tom
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


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

PostPosted: Tue Aug 17, 2004 1:49 pm    Post subject: Reply with quote

budgiepet wrote:

To Danny, thanks for your proposal, but the way I understood it, it will only work on the computer where OOo is installed(also with different users but only where the library is), is that right?
I want to use the file on different computers in a network. Thanks anyways.


I do not know if the approach I describe works for multiple network users who share the same set of files that make up the OOo installation.

If all users perceive the same pathname to the OOo installation, then I see no reason why it would not work.

That is, if all users, see the OOo folder as...

/opt/OpenOffice.org1.1.3

then I don't see any reason why the approach I describe could not work. But I have not tried it. The approach definitely works for multiple user accounts on the same computer, who always see the same install path to the office. So if multiple computers all mount the OOo folder to the same mount point, then I don't see why it could not work.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
budgiepet
General User
General User


Joined: 15 Aug 2004
Posts: 7

PostPosted: Tue Aug 17, 2004 4:05 pm    Post subject: Reply with quote

DannyB wrote:

I do not know if the approach I describe works for multiple network users who share the same set of files that make up the OOo installation.


Hi Danny,
Thanks for the answer.
As I understood it with your method every user needs to install OOo on the network or there has to be at least a folder which they all have to share, is that right? (Sorry for being so dumb)
The problem is that I can't go around to every computer and change that folder and the users can't to that themselves.

Is it possible to write it in a macro?
Under Excel my macro was like this:
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.SaveCopyAs "C:\Backup\" & Format(Date, "dd_mm_yyyy_") & ActiveWorkbook.Name
End Sub

And if its possible I would like to have a similar macro for OOo.

Thanks Tom
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


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

PostPosted: Wed Aug 18, 2004 5:27 am    Post subject: Reply with quote

Maybe we aren't talking about the same thing when we say "installing OOo on the network".

What do you mean by installing OOo on the network?

I am thinking of having OOo installed on a server, doing the network install. Then publish the OOo install folder (Samba or NFS). Other users mount that folder at a common mount point, such as
/opt/OpenOffice.org1.1.2
Each other user runs the soffice executable. The first time they do this, of course, they will be directed to the workstation setup.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
budgiepet
General User
General User


Joined: 15 Aug 2004
Posts: 7

PostPosted: Sat Aug 21, 2004 8:49 pm    Post subject: Reply with quote

Hello Danny,
no I meant the same thing, sorry for my awful description.
That isn't really possible, because it would mean that everyone who allready installed OOo has to install it again and besides that there are quite a lot of people who are using a laptop which isn't constantly on the network.
Now back to my other question, is it possible to put that directly in the macro?

Thanks for the help,
Tom
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Sat Aug 21, 2004 9:29 pm    Post subject: Reply with quote

After reading through, I am little confused of what you said budgiepet, but maybe it's me misunderstanding the situation.
To summarize the foundation:
- the users in your network have OOo properly installed on their machines
- you have one single spreadsheet document that many users are working on?
- you want to make backups of this document even if it has not been saved by the user.

If that's the case I think a template should do it.
However did you take a look at the pkgchk tool? That way you could zip your macro upload it on a network disk. All users could download it and then everyone then just runs pgkchk for the zip file to install the macro on their local machines. After that they would just have to assign it to the correct event(s) in the GUI.
I have written about that topic in AndrewPitonyak's macro documentation freely available under: http://www.pitonyak.org .

I hope that helps
Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
budgiepet
General User
General User


Joined: 15 Aug 2004
Posts: 7

PostPosted: Sat Aug 21, 2004 10:00 pm    Post subject: Reply with quote

Hello Christian,

thanks a lot for your help.
Your summary is correct, sorry for the confusing explanation.
Another dumb question:
How does it work with the template?

i don't want to do zip the macro, I mean the macro is saved with file that is not the problem. The problem is that either every user has to assign it, or I have to go to every user to assign it and both ways are much to complicated.
Is there another one?

Thanks again for your help and the patience,
Tom
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Sun Aug 22, 2004 8:16 pm    Post subject: Reply with quote

I think I can give you the answer in the next 2 weeks, cause we're currently also fiddling around with the event configurations automatically setting them for client pcs in the network.
I'll let you know here (maybe until then someone else explains it to you Smile).
Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
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