You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#NoEnv; Recommended for performance and compatibility with future AutoHotkey releases.
2
+
#SingleInstance, Force
3
+
#Warn; Enable warnings to assist with detecting common errors.
4
+
SendModeInput ; Recommended for new scripts due to its superior speed and reliability.
5
+
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
6
+
SetTitleMatchMode, 2
7
+
; VERSION 100
8
+
9
+
; This app works but is incomplete. still needs referential file location instead of typing it into the file.
10
+
11
+
; initialize the XL variable
12
+
XL :=
13
+
14
+
; fetch the correct file path
15
+
tgtFilePath := A_ScriptDir"\hotstrings.xlsx"
16
+
17
+
18
+
MsgBox, 1, AutoHotkey Text Expander, This text expander app allows you to automatically convert short phrases into long blocks of text.`n`nFor example, typing <now will automatically expand into the current date and time. All shortcuts used in this app are prefixed with the < symbol.`n`nNew shortcuts can be added in the hotstrings.xlsx file included with this app.
19
+
IfMsgBox, Cancel
20
+
Return
21
+
IfMsgBox, OK
22
+
try {
23
+
; Check if excel is active
24
+
XL := ComObjectActive("Excel.Application")
25
+
} catch {
26
+
; If Excel is not active, create an instance
27
+
XL := ComObjCreate("Excel.Application")
28
+
}
29
+
; MsgBox, % IsObject(XL) ; Is excel an object?
30
+
try {
31
+
; Check if the workbook exists
32
+
XL.Workbooks.Open(tgtFilePath)
33
+
} catch {
34
+
; Quit the application
35
+
if(XL.Workbooks.Count = 1){
36
+
XL.Quit
37
+
}
38
+
; Alert the user that the file was not found
39
+
MsgBox, The necessary workbook was not found. Please create a hotstrings.xlsx file to continue.
40
+
ExitApp
41
+
Sleep, 2000
42
+
}
43
+
44
+
; Make Excel Visible
45
+
XL.Visible := 0
46
+
47
+
; select the sheet name containing the templates
48
+
tgtSheet := XL.Worksheets("Templates")
49
+
50
+
; Sort the data by column C so it can loop over all of the hotstrings without empty cells
0 commit comments