Skip to content

Commit

Permalink
fix error caused with missing registry key
Browse files Browse the repository at this point in the history
  • Loading branch information
bhughes339 committed Sep 24, 2019
1 parent cfc7ac2 commit 240540f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions keywords_editor.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -417,25 +417,27 @@ escapeNewlines(fText) {


fetchDefaultTemplates() {
fullText := ""
try {
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", templateUrl, true)
whr.Send()
whr.WaitForResponse()
fullText := whr.ResponseText

if (fullText) {
}
if (fullText) {
try {
RegDelete, %registryKey%
}

needleText := "O)<template name=""([^""]+?)"">(.+?)</template>"
RegExMatch(fullText, needleText, match)
while (match) {
tempKey := match.Value(1)
tempText := RegExReplace(Edit_Convert2Unix(match.Value(2)), "Ds)^\s*(.*)\s*$", "$1")
tempText := escapeNewlines(tempText)
RegWrite, REG_SZ, %registryKey%, %tempKey%, %tempText%
RegExMatch(fullText, needleText, match, (match.Pos() + match.Len()))
}
needleText := "O)<template name=""([^""]+?)"">(.+?)</template>"
RegExMatch(fullText, needleText, match)
while (match) {
tempKey := match.Value(1)
tempText := RegExReplace(Edit_Convert2Unix(match.Value(2)), "Ds)^\s*(.*)\s*$", "$1")
tempText := escapeNewlines(tempText)
RegWrite, REG_SZ, %registryKey%, %tempKey%, %tempText%
RegExMatch(fullText, needleText, match, (match.Pos() + match.Len()))
}
}
Loop, Reg, %registryKey%
Expand Down

0 comments on commit 240540f

Please sign in to comment.