Last active
April 26, 2021 15:46
-
-
Save JoeGlines/4645522cb171cc326563b2996dd0a9f3 to your computer and use it in GitHub Desktop.
Search and replace links in MS Word
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;******************************************************* | |
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY | |
; Right now you can get a coupon code here: https://the-Automator.com/Learn | |
;******************************************************* | |
OldString:="src=old" | |
NewString:="src=new" | |
;******************************************************* | |
;~ doc.ActiveDocument.Hyperlinks.Add(oWord.Selection.Range, Address,"","",TextToDisplay) ;what I started from | |
doc:=ComObjActive("Word.Application") ;Connect to open Word file | |
loop, % doc.ActiveDocument.Hyperlinks.count { | |
oldLink:=doc.ActiveDocument.Hyperlinks[a_index].Address ; the original address | |
doc.ActiveDocument.Hyperlinks[a_index].Address :=StrReplace(oldLink,OldString,NewString) | |
} | |
MsgBox % "performed " doc.ActiveDocument.Hyperlinks.count " replacements" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment