Skip to content

Commit 995c317

Browse files
authored
Update HyperSearch.ahk
Added catch for file paths with quotations Added catch for new repo commands without explicit filenames
1 parent 5ed1406 commit 995c317

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

HyperSearch.ahk

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ ImportChrome(*)
981981
search:=StrSplit(editBar.value,">",,2)
982982
bkmkLines:=[]
983983
global HSR_Array
984-
bkmkPath:=search[2]
984+
bkmkPath:=Trim(search[2], '"')
985985
if !FileExist(bkmkPath) {
986986
Msgbox "File could not be read."
987987
return
@@ -1154,45 +1154,56 @@ ImportCSV(*)
11541154
global repo
11551155
replace:=0
11561156
search:=StrSplit(editBar.value,">",,2)
1157-
if (search[2]~="i).*csv$")
1158-
newCSVPath:=search[2]
1159-
else
1160-
newCSVPath:=search[2] ".csv"
1157+
newCSVPath:=Trim(search[2],'"')
1158+
if (newCSVPath~="i).*csv$"==0)
1159+
newCSVPath.=".csv"
11611160

11621161
if FileExist(newCSVPath) {
11631162
newCSV := FileRead(newCSVPath)
11641163
newCSV:="`n" . newCSV
11651164
FileAppend newCSV, repo
11661165
} else {
1167-
MsgBox "Specified file could not be found."
1166+
MsgBox "Specified file could not be found.`n" newCSVPath
11681167
}
11691168
}
11701169

1171-
LoadRepo(*)
1170+
LoadRepo(path*)
11721171
{
11731172
global repo
1174-
search:=StrSplit(editBar.value,">",,2)
1175-
if (search[2]~="i).*csv$")
1176-
repoIn:=search[2]
1177-
else
1178-
repoIn:=search[2] ".csv"
1173+
if (path.Has(1)) {
1174+
repoIn:=path[1]
1175+
} else {
1176+
search:=StrSplit(editBar.value,">",,2)
1177+
repoIn:=Trim(search[2], '"')
1178+
if (repoIn~="i).*csv$"==0)
1179+
repoIn.= ".csv"
1180+
}
11791181

11801182
if FileExist(repoIn) {
11811183
repo:=repoIn
11821184
IniWrite repo, "HS_Settings.ini", "Settings", "Repository"
11831185
} else {
1184-
MsgBox "Specified file could not be found."
1186+
MsgBox "Specified file could not be found.`n" repoIn
11851187
}
11861188
}
11871189

11881190
NewRepo(*)
11891191
{
11901192
global repo
11911193
search:=StrSplit(editBar.value,">",,2)
1192-
if (search[2]~="i).*csv$")
1194+
if(search[2]=="")
1195+
newRepo:="HSR_Master.csv"
1196+
else if (search[2]~="i).*csv$")
11931197
newRepo:=search[2]
11941198
else
11951199
newRepo:=search[2] ".csv"
1200+
1201+
if FileExist(newRepo) {
1202+
MsgBox newRepo " already exists. The file will be loaded."
1203+
LoadRepo(newRepo)
1204+
return
1205+
}
1206+
11961207
FileAppend "
11971208
(
11981209
" Quick Access","[<Quick Start Guide>](*)"

0 commit comments

Comments
 (0)