eyegeegeewhy Posted May 28, 2008 Share Posted May 28, 2008 #include <Word.au3> $oWordApp = _WordCreate () $oDoc = _WordDocGetCollection ($oWordApp, 0) _WordDocAddLink ($oDoc, "", "www.AutoIt3.com", "", "AutoIt" & @CRLF, "Link to AutoIt") $oLinks = _WordDocLinkGetCollection ($oDoc) MsgBox(0, "Link Count", @extended) The above is taken from the help file. I am wanting to list every url in a word doc. I can see that this finds them and the script say how many it finds. But how do i list them. They dont appear to be in an array? I guess they are in the object $oLinks. Ive tried for $Links in $oLinks MsgBox(0, "URL", $Links) Next Can some kind soul point me in the right direction? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 #include <Word.au3> $oWordApp = _WordCreate () $oDoc = _WordDocGetCollection ($oWordApp, 0) _WordDocAddLink ($oDoc, "", "www.AutoIt3.com", "", "AutoIt" & @CRLF, "Link to AutoIt") $oLinks = _WordDocLinkGetCollection ($oDoc) MsgBox(0, "Link Count", @extended) The above is taken from the help file. I am wanting to list every url in a word doc. I can see that this finds them and the script say how many it finds. But how do i list them. They dont appear to be in an array? I guess they are in the object $oLinks. Ive tried for $Links in $oLinks MsgBox(0, "URL", $Links) Next Can some kind soul point me in the right direction? The $oLink you pull from the collection $oLinks is a .Hyperlink object of the document. You have to use the appropriate object properties for a Hyperlink object: #include <Word.au3> $oWordApp = _WordCreate () $oDoc = _WordDocGetCollection ($oWordApp, 0) _WordDocAddLink ($oDoc, "", "www.AutoIt3.com", "", "AutoIt" & @CRLF, "Link to AutoIt") $oLinks = _WordDocLinkGetCollection ($oDoc) $sMsg = "Link Count = " & @extended & @CRLF For $oLink In $oLinks $sMsg &= "TextToDisplay: " & $oLink.TextToDisplay & " Address: " & $oLink.Address & @CRLF Next MsgBox(64, "Links", $sMsg) The reference is on MSDN. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now