[Solved] Enabling macros in Calc

Discuss setup / installation issues - Add a spell checker, Language pack?

[Solved] Enabling macros in Calc

Postby brennanmaxwell » Tue Nov 25, 2008 10:35 pm

Hello everyone!

I am installing OpenOffice 3 on approx 800 computers running windows XP pro. I would like to enable macros in calc, by default they are turned off. Does anyone know of a way to enable them with a script or some other automated way?

Thanks in advance!
Last edited by brennanmaxwell on Mon Dec 01, 2008 10:21 pm, edited 1 time in total.
OOo 3.0.X on Ms Windows XP
brennanmaxwell
 
Posts: 4
Joined: Tue Nov 25, 2008 10:28 pm

Re: Enabling macros in Calc

Postby bobban » Wed Nov 26, 2008 8:31 am

Hi brennanmaxwell and welcome to the forums

I have a script that can do this for you. I just need you to tell me what security setting OO uses by default (I think it is High from memory?), and what level you would like.

You will need to execute the script once per computer.
OOo 3.1.1 on Ms Windows XP
User avatar
bobban
Volunteer
 
Posts: 535
Joined: Sat Nov 01, 2008 3:12 pm
Location: Australia

Re: Enabling macros in Calc

Postby bobban » Wed Nov 26, 2008 3:33 pm

Here is that script. I changed it so that it just overwrites whatever the current level is to Medium.

You can change that and have it write to any level of security, or even require a certain current level of security to make a change.

Only works on Windows, and you must rename the file to: "Change OOo MacroSec.wsf"

Let me know if it works or not because I just knocked this up. :ugeek:
Attachments
Change OOo MacroSec(v1.2).odt
(12.26 KiB) Downloaded 824 times
Last edited by bobban on Fri Nov 28, 2008 12:02 pm, edited 2 times in total.
OOo 3.1.1 on Ms Windows XP
User avatar
bobban
Volunteer
 
Posts: 535
Joined: Sat Nov 01, 2008 3:12 pm
Location: Australia

Re: Enabling macros in Calc

Postby brennanmaxwell » Thu Nov 27, 2008 6:20 pm

Sorry I was away from my computer yesterday. I will give it a try

thanks!
OOo 3.0.X on Ms Windows XP
brennanmaxwell
 
Posts: 4
Joined: Tue Nov 25, 2008 10:28 pm

Re: Enabling macros in Calc

Postby brennanmaxwell » Thu Nov 27, 2008 9:51 pm

I tried it and it did not work. I am assuming that you just use cscript to run it? I also noticed that it is changing the comon.xcu file that in the user profile, is this correct?

thanks
OOo 3.0.X on Ms Windows XP
brennanmaxwell
 
Posts: 4
Joined: Tue Nov 25, 2008 10:28 pm

Re: Enabling macros in Calc

Postby Villeroy » Thu Nov 27, 2008 10:38 pm

So you found the Common.xcu and that file is part of OOo's XML registry. That registry has it's system-tree in the install directory, merged with a user-tree in the user's profile. The relevant part seems to be:
Code: Select all   Expand viewCollapse view
<node oor:name="Security">
  <node oor:name="Scripting">
   <prop oor:name="SecureURL" oor:type="oor:string-list">
    <value>$(work)/</value>
   </prop>
  </node>
</node>

Please refer to the OpenOffice.org Administration Guide
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17311
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Enabling macros in Calc

Postby bobban » Fri Nov 28, 2008 4:20 am

Villeroy wrote:That registry has it's system-tree in the install directory, merged with a user-tree in the user's profile.


Your very correct Villeroy. I didn't realize that config settings are merged between the install dir and the user data back that makes sense. Interestingly the value for macro security is in the install directory version, but has been given no value, which is surprising (so unless I am missing it somewhere else it looks that the default is hard coded).

Btw, I believe the relevant value is:

Code: Select all   Expand viewCollapse view
<node oor:name="Security">
  <node oor:name="Scripting">
   <prop oor:name="MacroSecurityLevel" oor:type="xs:int">
    <value>1</value>
   </prop>
  </node>
</node>


Not sure what "SecureURL" is tbh..

brennanmaxwell wrote:I tried it and it did not work. I am assuming that you just use cscript to run it? I also noticed that it is changing the comon.xcu file that in the user profile, is this correct?


Correct. The reason it's not working is I had made the false assumption that this entry would exist on your computers as it did on mine. It doesn't because this entry is only written when a change is made to security level through the options dialog. So, I have modified that script to write this entry in if not found (I have updated the original attachment I made).

Give that a test run and see how it goes. You might also want to consider other options such as disabling the registration screen etc.

 Edit: On further investigation of the website Villeroy mentioned, it seems there is an alternate way to go about this using extensions. I will have a quick look into this and if warranted will create the appropriate extension for this, but I think the result will be the same (although this would make it platform non-specific actually so yeh, might be good). 
OOo 3.1.1 on Ms Windows XP
User avatar
bobban
Volunteer
 
Posts: 535
Joined: Sat Nov 01, 2008 3:12 pm
Location: Australia

Re: Enabling macros in Calc

Postby bobban » Fri Nov 28, 2008 12:00 pm

I haven't had time to investigate the extension option further but I have updated the windows script (updated original attachment, now v1.2).

It will now:
- change macro security silently
- block user wizard (for name details etc)
- block registration dialog

All options can be toggles on/off, and you can see how with instructions at top of file.

bobban wrote:It doesn't because this entry is only written when a change is made to security level through the options dialog. So, I have modified that script to write this entry in if not found


It was worse than I thought. The whole user profile is not written until OO starts. The script makes the required directories now.

Let me know if there is further problems please.

I will translate to an extension soon. Btw, the extension mentioned on this page for skipping registration doesn't work for me (only does user wizard).
OOo 3.1.1 on Ms Windows XP
User avatar
bobban
Volunteer
 
Posts: 535
Joined: Sat Nov 01, 2008 3:12 pm
Location: Australia

Re: Enabling macros in Calc

Postby Villeroy » Fri Nov 28, 2008 12:52 pm

. Interestingly the value for macro security is in the install directory version, but has been given no value, which is surprising (so unless I am missing it somewhere else it looks that the default is hard coded).

This is because macros in documents are disabled by default. The trusted directories affect macro-documents moved to the respective directorie(s).
I played around with the trusted directories:
Code: Select all   Expand viewCollapse view
<value>$(user)/temp $(work)/ file:///home/claudia/Desktop $(temp)/Macro</value>

$(user)/temp is the is the temporary directory in my user profile
$(work) is the directory I set up as my default directory for OOo documents.
The absolute URL is my wife's desktop.
$(temp)/Macro is system's /tmp/Macro/
Using $(variables) makes sense because certain directories differ for each user.
I believe that you can set up trusted directories for macros in documents in the installation to be deployed. Global macros, not embedded in documents, can be deployed as well. I think <install_root>/openoffice.org/basis3.0/presets/basic/ is the candidate that gets deployed across all newly created profiles and <install_root>/openoffice.org/basis3.0/presets/Scripts/<language> is the same for non-basic macros.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17311
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Enabling macros in Calc

Postby bobban » Fri Nov 28, 2008 1:05 pm

This is because macros in documents are disabled by default. The trusted directories affect macro-documents moved to the respective directorie(s).
I played around with the trusted directories:


Yes, this is why I was expecting to see this behavior represented as a value in the install directories version of the config files (ie. security = 3 for very high), rather than just blank and leaving the code to decide. Anyways, no big deal.

Trusted directories would another useful admin option, I'm glad you pointed that out. Maybe you want to keep all user at high security, and let them just have a special directory you want them to run document macros from. Distributing macros across the network too...another good idea. :)
OOo 3.1.1 on Ms Windows XP
User avatar
bobban
Volunteer
 
Posts: 535
Joined: Sat Nov 01, 2008 3:12 pm
Location: Australia

Re: Enabling macros in Calc

Postby brennanmaxwell » Mon Dec 01, 2008 10:20 pm

That worked!

You rock bobban! I guess I owe you a beer!

:lol:

thanks again
OOo 3.0.X on Ms Windows XP
brennanmaxwell
 
Posts: 4
Joined: Tue Nov 25, 2008 10:28 pm

Re: [Solved] Enabling macros in Calc

Postby bobban » Tue Dec 02, 2008 12:56 am

Glad to hear it, and looking forward to my beer! :D
OOo 3.1.1 on Ms Windows XP
User avatar
bobban
Volunteer
 
Posts: 535
Joined: Sat Nov 01, 2008 3:12 pm
Location: Australia


Return to Install, Setup and Troubleshooting

Who is online

Users browsing this forum: No registered users and 14 guests