-
Notifications
You must be signed in to change notification settings - Fork 72
/
Hyperlink.ahk
21 lines (17 loc) · 1010 Bytes
/
Hyperlink.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
; This script creates a new email and adds a hyperlink.
; Constants
olMailItem := 0
m := ComObjActive("Outlook.Application").CreateItem(olMailItem) ; Create a new mail item. Outlook must be running.
m.Display ; Display the mail item.
Insp := m.GetInspector ; Get the inspector that is displaying the mail item.
Doc := Insp.WordEditor ; Assumes Word is the default editor. 'Doc' now contains a Word Document object.
Sel := Doc.Windows(1).Selection ; Get the current selection.
; Insert a hyperlink at the current selection. The link will point to this script (A_ScriptFullPath).
Doc.Hyperlinks.Add( Sel.Range ; Anchor
, A_ScriptFullPath ; Address
, "" ; SubAddress
, "" ; ScreenTip
, "This is a link" ; TextToDisplay
, "") ; Target
; References
; Hyperlinks.Add Method (Word) - https://msdn.microsoft.com/en-us/library/office/ff837214.aspx