[libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
Cor wrote And via the user interface (Tools Macro's .. ) Or is that answer too simple ? I was looking there. But I find the way of managing macros absolutely non-intuitive. So I have this document I know nothing about because I received it by email, sent by a customer. I open it and get the warning about one or more macros that are programmed to do I don't know what. To learn more about this macro or these macros, I need to know in which language it/they are scripted. How would I know? So I'm going try one language after the other. First is LibreOffice Basic. I get this ridiculously small dialog whose window can not made larger with kind of a file manger on the left and 3 icons that might be interpreted as folders. A click on one of them opens it and offers me sub-folder with sub-folders. To see anything in the right part of that window - which so far is entirely empty - I need to choose on (sub-)folder or its content on the left and get the name of a macro (I suppose). And then the button to delete it in the far right is not active. And I would have to do this with every scripting language and sub-category. Nope, it is not too simple. But the short answer to my question seems to be that it can not be done. I'm not even going to start to dive into dissecting documents and rebuilding them. Regards, Hans -- View this message in context: http://nabble.documentfoundation.org/Howto-find-all-macros-in-a-document-and-delete-or-deactivate-them-tp3493123p3496116.html Sent from the Users mailing list archive at Nabble.com. -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
[libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
drewjensen wrote: The problem, as I recall it from before, is that you can not remove the standard library from a document once you have added it, in fact the macro dial You can empty it, but since you can not remove it, even if there are no actual functions or procedures left in the library you still are told when you open the file that there are embedded macros (depending on your macro security settings). It's a bit of a pain actually. I'd rather call this a bug. Regards, Hans -- View this message in context: http://nabble.documentfoundation.org/Howto-find-all-macros-in-a-document-and-delete-or-deactivate-them-tp3493123p3496119.html Sent from the Users mailing list archive at Nabble.com. -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
[libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
Hi :) With any GnuLinux it is easy to install a virtual machine and open the document in there. If anything goes horribly wrong you can just delete the VM. Alternatively use a spare partition, or create one and install a basic OS to there instead of to a VM. Similarly if there is a problem then you always have the nuclear option of deleting the partition. One way to get rid of macros is save in another format such as Odt or Rtf but that may change the layout of the document. If you do trust the person that sent you the document then perhaps just scan it with an antivirus such as ClamAv and then open it to see what it does. Most malware infested documents are aimed at MS Office on Windows so LibreOffice on GnuLinux is likely to be much safer even ignoring the fact that you open the document as a normal user rather than an Admin/SuperUser so it's much more difficult for malware even if LO and GnuLinux was the intended target. If the document ask you to key-in your super-secret SuperUser password then just cancel that but it's incredibly unlikely to try elevating privileges on your system if you are using GnuLinux. Regards from Tom :) -- View this message in context: http://nabble.documentfoundation.org/Howto-find-all-macros-in-a-document-and-delete-or-deactivate-them-tp3493123p3496549.html Sent from the Users mailing list archive at Nabble.com. -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
Hi :) There is a release plan/schedule here http://wiki.documentfoundation.org/ReleasePlan It is very aggressive and i tend to find a good one and stick with it for ages. Regards from Tom :) --- On Thu, 10/11/11, Andrew Douglas Pitonyak and...@pitonyak.org wrote: From: Andrew Douglas Pitonyak and...@pitonyak.org Subject: Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them? To: users@global.libreoffice.org Date: Thursday, 10 November, 2011, 2:02 On 11/09/2011 07:02 PM, drew wrote: On Wed, 2011-11-09 at 17:55 -0500, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:45 PM, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:07 PM, drew wrote: On Wed, 2011-11-09 at 20:12 +, Alex Thurgood wrote: Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Hi Alex, I was thinking it took a bit more then that and so I just tried it and yes. You need to make three changes. After unzipping the file you remove two directories: = Basic = Dialogs Then you need to edit the file manifest.xml in the META-INF directory. - remove all lines that reference basic or dialog. [They look something like] manifest:file-entry manifest:media-type=text/xml manifest:full-path=Basic/Standard/script-lb.xml/ Then you re-zip and voila it works. If you leave out the last step the file will not open. HTH somehow, //drew Drew's method will work just fine if what you mean to do is to remove all macros contained in a document (as opposed to removing all references to macros from inside the document; in a button or an associated event, for example). See if you can make the document current and run this macro Sub RemoveAllContainedLibs Dim sNames Dim oLibs Dim i% oLibs = ThisComponent.BasicLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next oLibs = ThisComponent.DialogLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next End Sub -- Hi Andrew, Excellent - the only problem is, and it aint yours per so, is removing libraries from a document - at least with LibO 3.4.4 as that is what I tried it on - does not set the dirty flag for the documnet. So if you run the macro and close the document the change isn't saved...arrrgh. Yeah, I noticed that too. I considered changing the macro to set the document dirty (I think that I can do that), but, decided it was not worth the trouble to look up how to do it I upgraded to Fedora 16, installed LO 3.4.3, and then the next day they release 3.4.4 sigh. So that is the same version that I tested with as well. -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt Info: http://www.pitonyak.org/oo.php -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
[libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Alex -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
On Wed, 2011-11-09 at 20:12 +, Alex Thurgood wrote: Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Hi Alex, I was thinking it took a bit more then that and so I just tried it and yes. You need to make three changes. After unzipping the file you remove two directories: = Basic = Dialogs Then you need to edit the file manifest.xml in the META-INF directory. - remove all lines that reference basic or dialog. [They look something like] manifest:file-entry manifest:media-type=text/xml manifest:full-path=Basic/Standard/script-lb.xml/ Then you re-zip and voila it works. If you leave out the last step the file will not open. HTH somehow, //drew -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
On 11/09/2011 05:07 PM, drew wrote: On Wed, 2011-11-09 at 20:12 +, Alex Thurgood wrote: Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Hi Alex, I was thinking it took a bit more then that and so I just tried it and yes. You need to make three changes. After unzipping the file you remove two directories: = Basic = Dialogs Then you need to edit the file manifest.xml in the META-INF directory. - remove all lines that reference basic or dialog. [They look something like] manifest:file-entry manifest:media-type=text/xml manifest:full-path=Basic/Standard/script-lb.xml/ Then you re-zip and voila it works. If you leave out the last step the file will not open. HTH somehow, //drew Drew's method will work just fine if what you mean to do is to remove all macros contained in a document (as opposed to removing all references to macros from inside the document; in a button or an associated event, for example). -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt Info: http://www.pitonyak.org/oo.php -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
On 11/09/2011 05:45 PM, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:07 PM, drew wrote: On Wed, 2011-11-09 at 20:12 +, Alex Thurgood wrote: Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Hi Alex, I was thinking it took a bit more then that and so I just tried it and yes. You need to make three changes. After unzipping the file you remove two directories: = Basic = Dialogs Then you need to edit the file manifest.xml in the META-INF directory. - remove all lines that reference basic or dialog. [They look something like] manifest:file-entry manifest:media-type=text/xml manifest:full-path=Basic/Standard/script-lb.xml/ Then you re-zip and voila it works. If you leave out the last step the file will not open. HTH somehow, //drew Drew's method will work just fine if what you mean to do is to remove all macros contained in a document (as opposed to removing all references to macros from inside the document; in a button or an associated event, for example). See if you can make the document current and run this macro Sub RemoveAllContainedLibs Dim sNames Dim oLibs Dim i% oLibs = ThisComponent.BasicLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next oLibs = ThisComponent.DialogLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next End Sub -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt Info: http://www.pitonyak.org/oo.php -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
On Wed, 2011-11-09 at 17:55 -0500, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:45 PM, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:07 PM, drew wrote: On Wed, 2011-11-09 at 20:12 +, Alex Thurgood wrote: Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Hi Alex, I was thinking it took a bit more then that and so I just tried it and yes. You need to make three changes. After unzipping the file you remove two directories: = Basic = Dialogs Then you need to edit the file manifest.xml in the META-INF directory. - remove all lines that reference basic or dialog. [They look something like] manifest:file-entry manifest:media-type=text/xml manifest:full-path=Basic/Standard/script-lb.xml/ Then you re-zip and voila it works. If you leave out the last step the file will not open. HTH somehow, //drew Drew's method will work just fine if what you mean to do is to remove all macros contained in a document (as opposed to removing all references to macros from inside the document; in a button or an associated event, for example). See if you can make the document current and run this macro Sub RemoveAllContainedLibs Dim sNames Dim oLibs Dim i% oLibs = ThisComponent.BasicLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next oLibs = ThisComponent.DialogLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next End Sub -- Hi Andrew, Excellent - the only problem is, and it aint yours per so, is removing libraries from a document - at least with LibO 3.4.4 as that is what I tried it on - does not set the dirty flag for the documnet. So if you run the macro and close the document the change isn't saved...arrrgh. Best wishes, //drew -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
[libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
Am 10.11.2011 01:02, drew wrote: On Wed, 2011-11-09 at 17:55 -0500, Andrew Douglas Pitonyak wrote: sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next End Sub sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 if sNames(i)Standard then oLibs.removeLibrary(sNames(i)) ThisComponent.setModified(True) endif Next End Sub -- Hi Andrew, Excellent - the only problem is, and it aint yours per so, is removing libraries from a document - at least with LibO 3.4.4 as that is what I tried it on - does not set the dirty flag for the documnet. So if you run the macro and close the document the change isn't saved...arrrgh. Best wishes, //drew -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
On Thu, 2011-11-10 at 01:41 +0100, Andreas Säger wrote: Am 10.11.2011 01:02, drew wrote: On Wed, 2011-11-09 at 17:55 -0500, Andrew Douglas Pitonyak wrote: sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next End Sub sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 if sNames(i)Standard then oLibs.removeLibrary(sNames(i)) ThisComponent.setModified(True) endif Next End Sub -- Howdy Andreas, Cool - now back to something Andrew noted - what about places where the embedded macros might called from. Not sure how to find everywhere, but we can enhance that basic procedure to clear out any document event handlers. Sub RemoveAllContainedLibs Dim sNames Dim oLibs Dim i% Dim EmptyEventProps(1) as new com.sun.star.beans.PropertyValue oLibs = ThisComponent.BasicLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next oLibs = ThisComponent.DialogLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next ' ' clear all document event handlers For i = UBound(ThisComponent.Events.elementNames) To LBound(ThisComponent.Events.elementNames) Step -1 ThisComponent.Events.ReplaceByName(ThisComponent.Events.ElementNames(i), EmptyEventProps()) next ' ' force dirty flag on document ThisComponent.setModified(True) End Sub -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Re: Howto find all macros in a document and delete or deactivate them?
On 11/09/2011 07:02 PM, drew wrote: On Wed, 2011-11-09 at 17:55 -0500, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:45 PM, Andrew Douglas Pitonyak wrote: On 11/09/2011 05:07 PM, drew wrote: On Wed, 2011-11-09 at 20:12 +, Alex Thurgood wrote: Le 09/11/2011 10:22, hhm a écrit : Hi Hans, I'm looking for a way to find every macro that is attached to a document and delete or respectively deactivate them. How do I do that? With a script would probably be the easisest way, by unzipping the OD* files and parsing the unzipped contents to seach for the Basic directory, deleting it, then rezipping the file ? Hi Alex, I was thinking it took a bit more then that and so I just tried it and yes. You need to make three changes. After unzipping the file you remove two directories: = Basic = Dialogs Then you need to edit the file manifest.xml in the META-INF directory. - remove all lines that reference basic or dialog. [They look something like] manifest:file-entry manifest:media-type=text/xml manifest:full-path=Basic/Standard/script-lb.xml/ Then you re-zip and voila it works. If you leave out the last step the file will not open. HTH somehow, //drew Drew's method will work just fine if what you mean to do is to remove all macros contained in a document (as opposed to removing all references to macros from inside the document; in a button or an associated event, for example). See if you can make the document current and run this macro Sub RemoveAllContainedLibs Dim sNames Dim oLibs Dim i% oLibs = ThisComponent.BasicLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next oLibs = ThisComponent.DialogLibraries sNames = oLibs.getElementNames() For i = UBound(sNames) To LBound(sNames) Step -1 oLibs.removeLibrary(sNames(i)) Next End Sub -- Hi Andrew, Excellent - the only problem is, and it aint yours per so, is removing libraries from a document - at least with LibO 3.4.4 as that is what I tried it on - does not set the dirty flag for the documnet. So if you run the macro and close the document the change isn't saved...arrrgh. Yeah, I noticed that too. I considered changing the macro to set the document dirty (I think that I can do that), but, decided it was not worth the trouble to look up how to do it I upgraded to Fedora 16, installed LO 3.4.3, and then the next day they release 3.4.4 sigh. So that is the same version that I tested with as well. -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt Info: http://www.pitonyak.org/oo.php -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted