I have been using a VBScript to extract a list of any hyperlinks and their associated "Display Text" where they occur in MS Word docs. I have been asked to set this up for someone else but discovered that they do not MS Word as they use OpenOffice (.odt docs). I understand that it is quite possible to do this but I have not been able to do so so far. Does anyone know how to modify my VBScript so that it will work with OpenOffice? I have appended the script I use with Word (it ain't great but it does the business!). I have managed to open an "odt" file in OpenOffice but that is as far as it goes. I'm stumped and there does not appear to be much in the way of info as to how the hyperlinks extracted although I understand VBS is more or less compatible.
I would appreciate any help on this or a script if anyone has achieved this
Thank you
[code] For Word
'To be run at CMD Prompt: cscript ExtractHyperLinks.vbs >> HyperOut.txtSet objWord = CreateObject("Word.Application")
objWord.Visible = TrueDim Gap
Dim Item
Dim RefGap = " "
Item = "Item: "
Ref = "URL: "Set objDoc = objWord.Documents.Open("F:\sun-130113\Atlantis - Wiki.doc")
Set colHyperlinks = objDoc.Hyperlinks
For Each objHyperlink in colHyperlinks
Set objStdOut = WScript.StdOut
objStdOut.Write Item
objStdOut.Write objHyperlink.TextToDisplay
objStdOut.write Gap
objStdOut.Write Ref
objStdOut.Write objHyperlink.Address
objStdOut.WriteBlankLines(2)Next
[/code]
[Code] For OpenOffice
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
Dim args()
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter",_
"_blank", 0, args)Set objText= objDocument.getText
Set objCursor= objText.createTextCursor
Sub Run(ByVal sFile)
Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run Chr(34) & sFile & Chr(34), 1, false
Set shell = Nothing
End SubRun "F:\Sun-130113\MyFile.odt"
Set objODT = objswriter.documents.Open("F:\sun-130113\MyFile.odt")
Set colHyperlinks = objOdt.Hyperlinks
For Each objHyperlink in colHyperlinks
Set objStdOut = WScript.StdOut
objStdOut.Write Item
objStdOut.Write objHyperlink.TextToDisplay
objStdOut.write Gap
objStdOut.Write Ref
objStdOut.Write objHyperlink.Address
objStdOut.WriteBlankLines(2)Next
[/Code]

