Skip to content

Commit 6ff1f56

Browse files
committed
added multiline to csv version
1 parent 50792c6 commit 6ff1f56

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

CSV Text Expander/CSV Text Expander.ahk

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,44 @@ MsgBox, 1, AutoHotkey Text Expander, This text expander allows you to automatica
1111
IfMsgBox, Cancel
1212
ExitApp
1313
IfMsgBox, OK
14-
; loop through the csv file one line at a time
15-
Loop, read, %A_ScriptDir%\hotstrings.csv
14+
FileRead, CSV, %A_ScriptDir%\hotstrings.csv
15+
Loop, Parse, CSV, `r, `n
1616
{
1717
; save the line number to a variable
1818
LineNumber := A_Index -1
1919

2020
; skip the first row of content
2121
IfEqual, A_Index, 1, Continue
2222

23-
; parse each cell into variables
24-
Loop, parse, A_LoopReadLine, CSV
25-
{
26-
; if the cell number is odd, assign the current cell to the HotStringShortCut variable
27-
if ( Mod(A_Index, 2) != 0) {
28-
HotStringShortCut := A_LoopField ;else
29-
; MsgBox, 4, , %LineNumber%-%A_Index% is:`n%A_LoopField%`n%HotStringShortCut%`nContinue?
30-
31-
; if the cell number is even, assign the current cell to the HotStringExtended variable
32-
} else {
33-
HotStringExtended := A_LoopField
34-
; MsgBox, 4, , %LineNumber%-%A_Index% is:`n%A_LoopField%`n%HotStringExtended%`nContinue?
35-
}
36-
37-
; if the cell number is even, assign both variables to a hotkey
38-
if ( Mod(A_Index, 2) = 0) {
39-
; MsgBox, 4, , %HotStringShortCut% - %HotStringExtended%`n`nContinue?
40-
HotStringExtended := StrReplace(StrReplace(StrReplace(HotStringExtended, "!","{!}"),"`r","{enter}"),A_Space A_Space,"{space 2}")
41-
hotstring(":*:" HotStringShortCut, HotStringExtended)
42-
}
43-
44-
; %LineNumber% is the current row
45-
; %A_Index% is the current column
46-
; %A_LoopField% is the current field
47-
48-
; MsgBox, 4, , Field %LineNumber%-%A_Index% is:`n%A_LoopField%`n`nContinue?
49-
; IfMsgBox, No
50-
; return
23+
Loop, Parse, A_LoopField, CSV
24+
{
25+
; MsgBox, 4, , %A_Index% is:`n%A_LoopField%`nContinue?
26+
; if the cell number is odd, assign the current cell to the HotStringShortCut variable
27+
if ( Mod(A_Index, 2) != 0) {
28+
HotStringShortCut := A_LoopField ;else
29+
; MsgBox, 4, , %LineNumber%-%A_Index% is:`n%A_LoopField%`n%HotStringShortCut%`nContinue?
30+
31+
; if the cell number is even, assign the current cell to the HotStringExtended variable
32+
} else {
33+
HotStringExtended := A_LoopField
34+
; MsgBox, 4, , %LineNumber%-%A_Index% is:`n%A_LoopField%`n%HotStringExtended%`nContinue?
5135
}
36+
37+
; if the cell number is even, assign both variables to a hotkey
38+
if ( Mod(A_Index, 2) = 0) {
39+
; MsgBox, 4, , %HotStringShortCut% - %HotStringExtended%`n`nContinue?
40+
HotStringExtended := StrReplace(StrReplace(StrReplace(HotStringExtended, "!","{!}"),"`r","{enter}"),A_Space A_Space,"{space 2}")
41+
hotstring(":*:" HotStringShortCut, HotStringExtended)
42+
}
43+
44+
; %LineNumber% is the current row
45+
; %A_Index% is the current column
46+
; %A_LoopField% is the current field
47+
48+
; MsgBox, 4, , Field %LineNumber%-%A_Index% is:`n%A_LoopField%`n`nContinue?
49+
; IfMsgBox, No
50+
; return
51+
}
5252
}
5353

5454
:*:<now::
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)