@@ -16,6 +16,8 @@ if (ProgID = "ChromeHTML")
1616 Browser := " chrome.exe"
1717if (ProgID = " FirefoxURL" )
1818 Browser := " firefox.exe"
19+ if (ProgID = " BraveHTML" )
20+ Browser := " brave.exe"
1921
2022If ! FileExist (" HS_Settings.ini" )
2123 Gosub , GenerateSettings
@@ -26,8 +28,9 @@ IniRead, searchEngine, HS_Settings.ini, Search Engine, Default
2628IniRead , GUIHotkey, HS_Settings.ini, Settings, GUIHotkey
2729IniRead , hiHotkey, HS_Settings.ini, Settings, HighlightHotkey
2830IniRead , jump, HS_Settings.ini, Settings, jump
31+ IniRead , repo, HS_Settings.ini, Settings, Repository
2932
30- If ! FileExist (" HSR_Master.csv " ) {
33+ If ! FileExist (repo ) {
3134 GoSub , GenerateHSR
3235}
3336
@@ -233,7 +236,8 @@ BuildHSRArray:
233236 HSR_Array:=[]
234237 indexList=
235238 indexArray:=[]
236- FileRead , HSR_String, HSR_Master.csv
239+ ; IniRead, repo, HS_Settings.ini, Settings, Repository
240+ FileRead , HSR_String, %repo%
237241 Loop , Parse , HSR_String, `n, `r ; Build HSR_Array
238242 {
239243 r:=A_Index ; Row number
@@ -269,8 +273,8 @@ SaveHSR:
269273 HSR_String .= " `n"
270274 }
271275 ; MsgBox % HSR_String
272- FileDelete ,HSR_Master.csv
273- FileAppend ,%HSR_String%, HSR_Master.csv
276+ FileDelete ,%repo%
277+ FileAppend ,%HSR_String%, %repo%
274278return
275279
276280ClickOff :
@@ -414,6 +418,19 @@ ButtonSubmit:
414418 ; if (setMax=1)
415419 ; GuiControl, Choose, index, % "|" . lastIndex
416420 mouseKeep=0
421+ } else if (UsrIn ~ = " i)^import>.*" ) {
422+ if (UsrIn ~ = " i).*html$" ) {
423+ GoSub , ImportChrome
424+ } else if (UsrIn ~ = " i).*csv$" ) {
425+ GoSub , ImportCSV
426+ } else
427+ MsgBox , Unsupported format
428+ GoSub , DestroyGui
429+ GoSub , LoadGui
430+ } else if (UsrIn ~ = " i)^load>.*" ) {
431+ GoSub , LoadRepo
432+ GoSub , DestroyGui
433+ GoSub , LoadGui
417434 } else if (UsrIn ~ = " .*\+.*" ){
418435 GuiControl , - redraw , Link
419436 GoSub , AppendLinks
@@ -548,7 +565,7 @@ AppendLinks:
548565
549566 if (linkTxt[2 ] ! = "" && linkTxt[3 ] ! = "" ) { ; Add first link
550567 appendTxt:=" `n"" " . linkTxt[1 ] . " "" ," . " "" [" . linkTxt[2 ] . " ](" . linkTxt[3 ] . " )"" "
551- FileAppend , %appendTxt%, HSR_Master.csv
568+ FileAppend , %appendTxt%, %repo%
552569 ; return
553570 } else if (SubStr (UsrIn,- 1 ) == " ++" ) { ; Rename current category
554571 Loop % HSR_Array.MaxIndex ()
@@ -563,7 +580,7 @@ AppendLinks:
563580 }
564581 } else { ; Add category with blank first entry
565582 appendTxt:=" `n"" " . linkTxt[1 ] . " "" ," . " "" [ ]()"" "
566- FileAppend , %appendTxt%, HSR_Master.csv
583+ FileAppend , %appendTxt%, %repo%
567584 ; return
568585 }
569586 mouseKeep:=1
@@ -851,7 +868,7 @@ EditSettings:
851868 }
852869 Hotkey , %hiHotkey%, on
853870 MsgBox % " Hotkey 2 has been set to " . usrHotkey
854- } else if (search[2 ] ~ = " i)trans .{0,7 }" ) {
871+ } else if (search[2 ] ~ = " i)op .{0,5 }" ) {
855872 transVal := search[3 ]
856873 if transVal is integer
857874 {
@@ -865,6 +882,143 @@ EditSettings:
865882 }
866883return
867884
885+ ImportChrome :
886+ replace:=0
887+ search:=StrSplit (UsrIn," >" ,,2 )
888+ MsgBox , 3 , Import options, How would you like to import?`nYes: Append to current links`nNo: Replace all links with bookmarks
889+ IfMsgBox , No
890+ replace:=1
891+ IfMsgBox , Cancel
892+ return
893+ bkmkLines:=[]
894+ ; MsgBox % "Link: " . search[2]
895+ bkmkPath:=search[2 ]
896+ FileRead , bkmk, %bkmkPath%
897+ Loop , Parse , bkmk, `n, `r ; Build HSR_Array
898+ {
899+ ; MsgBox, % A_LoopField
900+ bkmkLines.push(A_LoopField )
901+ }
902+ ; MsgBox % bkmk
903+ fullArray := []
904+
905+ if (replace==1 )
906+ {
907+ fullArray[1 ,1 ]:=" Category Name"
908+ fullArray[1 ,2 ]:=" Links List"
909+ }
910+
911+ catIndex:=2
912+
913+ Loop % bkmkLines.maxIndex ()
914+ {
915+ numTabs:=0
916+ charPos:=6
917+ currentLine:=bkmkLines[A_Index ]
918+ Loop , Parse , currentLine
919+ {
920+ if (A_LoopField == A_Space ) {
921+ numTabs++
922+ charPos++
923+ } else
924+ break
925+ }
926+ head:=SubStr (currentLine,charPos,2 )
927+ ; MsgBox % head
928+ numTabs := round (numTabs/ 4 )
929+
930+ if (head == " H3" ) { ; New category
931+ RegExMatch (currentLine, " O)<H3 .*>(.*?)</H3>" , thisCat)
932+ fullArray[catIndex,1 ]:=thisCat[1 ]
933+ nxtTab:=numTabs+ 1
934+ i:=A_Index + 2
935+ subTabs:=numTabs+ 1
936+ while subTabs > numTabs ; && i != bkmkLines.maxIndex()
937+ {
938+ ; MsgBox % "Loop start`n" . subTabs . " > " . numTabs . "`n" . currentLine
939+ subLine:=bkmkLines[i]
940+ ; MsgBox % subLine
941+ subTabs:=0
942+ subCharPos:=6
943+ ; MsgBox % subLine
944+ Loop , Parse , subLine
945+ {
946+ if (A_LoopField == A_Space ) {
947+ subTabs++
948+ subCharPos++
949+ } else
950+ break
951+ }
952+ subTabs := round (subTabs/ 4 )
953+ ; MsgBox % subLine . " : " . subTabs
954+ subHead:=SubStr (subLine,subCharPos,2 )
955+ ; MsgBox % subTabs . " = " . nxtTab . "`n" . subLine . "`n" . currentLine
956+ if (subTabs == nxtTab) {
957+ ; MsgBox % subHead
958+ if (subHead==" H3" ) {
959+ ; MsgBox % subTabs . " : " . nxtTab
960+ RegExMatch (subLine, " O)<H3 .*>(.*?)</H3>" , subCat)
961+ ; MsgBox % thisCat[1] . " : " . numTabs . "`n" . subCat[1] . " : " . subTabs
962+ fullArray[catIndex,2 ] .= " [<" . subCat[1 ] . " >](*)"
963+ } else if (subHead == " A " ) {
964+ RegExMatch (subLine, " O)<A HREF="" (.*?)"" " , subLink)
965+ RegExMatch (subLine, " O)<A .*>(.*?)</A>" , subLabel)
966+ ; MsgBox % "Current label: " . thisLabel[1] . "`nCurrent link: " . thisLink[1]
967+ if (subLabel[1 ]! ="" ) {
968+ labelReplace := StrReplace (subLabel[1 ], " |" , " -" )
969+ } else {
970+ labelReplace := subLink[1 ]
971+ }
972+
973+ fullArray[catIndex,2 ] .= " [" . LabelReplace . " ](" . subLink[1 ] . " )"
974+ }
975+ }
976+ i++
977+ }
978+ catIndex++
979+ }
980+ }
981+
982+ if (replace==1 )
983+ HSR_ImportString:=""
984+ else
985+ HSR_ImportString:=" `n"
986+
987+ Loop , % fullArray.MaxIndex () ; concat string array
988+ {
989+ r:=A_Index
990+ Loop , % fullArray[A_Index ].MaxIndex ()
991+ {
992+ HSR_ImportString .= A_Index == fullArray[r].MaxIndex () ? " "" " . fullArray[r,A_Index ] . " "" " : " "" " . fullArray[r,A_Index ] . " "" ,"
993+ }
994+ if (A_Index ! =fullArray.MaxIndex ())
995+ HSR_ImportString .= " `n"
996+ }
997+ ; MsgBox % HSR_ImportString
998+ if (replace==1 )
999+ FileDelete ,%repo%
1000+ FileAppend ,%HSR_ImportString%, %repo%
1001+ HSRImportString:=""
1002+ bkmk:=""
1003+ bkmkLines:=[]
1004+ fullArray := []
1005+ return
1006+
1007+ ImportCSV :
1008+ replace:=0
1009+ search:=StrSplit (UsrIn," >" ,,2 )
1010+ newCSVPath:=search[2 ]
1011+ FileRead , newCSV, %newCSVPath%
1012+ newCSV:=" `n" . newCSV
1013+ FileAppend ,%newCSV%, %repo%
1014+ return
1015+
1016+ LoadRepo :
1017+ search:=StrSplit (UsrIn," >" ,,2 )
1018+ repo:=search[2 ]
1019+ IniWrite , %repo%, HS_Settings.ini, Settings, Repository
1020+ return
1021+
8681022SetTheme :
8691023 IniRead , themeSel, HS_Settings.ini, Settings, DkMd
8701024 IniRead , transSel, HS_Settings.ini, Settings, Trans
@@ -902,6 +1056,8 @@ CheckSettings:
9021056 newSettings:=" `nGUIHotkey=#Space`nHighlightHotkey=^#Space`nJump=1"
9031057 } else if (lastSettingArray[1 ]==" HighlightHotkey" ) {
9041058 newSettings:=" `nJump=1"
1059+ } else if (lastSettingArray[1 ]==" Jump" ) {
1060+ newSetting:=" `nRepository=HSR_Master.csv"
9051061 }
9061062 FileAppend , %newSettings%, HS_Settings.ini
9071063return
@@ -944,17 +1100,18 @@ MinMode=0
9441100GUIHotkey=# Space
9451101HighlightHotkey=^# Space
9461102Jump=1
1103+ Repository=HSR_Master.csv
9471104 ), HS_Settings.ini
9481105return
9491106
9501107GenerateHSR :
951- FileAppend ,
952- (
1108+ FileAppend ,
1109+ (
9531110" Category Label" ," Link List"
9541111" *Quick Access" ," [<Quick Start Guide>](*)"
9551112"Quick Start Guide","[NAVIGATION REFERENCE](https://github.com/JSSatchell/HyperSearch#navigation)[Press Space to search the category index on the left]()[Tab between control windows]()[Press Enter after typing Space to set focus to links]()[Use Enter or double click links to activate URL]()[ ]()[TEXT ENTRY REFERENCE](https://github.com/JSSatchell/HyperSearch#adding--removing-categories--links)[Edit Favorites - 'Favorite#>Label>URL'](https://github.com/JSSatchell/HyperSearch#update-favorites)[Add Index Category - 'Category Name+']()[Add link - '+Link Name+Link URL']()[Add at Position - '+Position#+Link Name+LinkURL']()[Remove Selected Link - 'Delete-']()[Remove at Position - 'Delete-Position#']()[Delete Category - 'Delete-Category']()[ ]()[SETTINGS](https://github.com/JSSatchell/HyperSearch#update-the-settings)[Min/Max Mode - 'Set>Min/Max']()[Dark/Light Mode - 'Set>Dark/Light']()[Transparency - 'Set>Transparency>Percentage']()[]()[CLICK HERE for full feature list & updates](https://github.com/JSSatchell/HyperSearch)"
9561113 ), HSR_Master.csv
957- return
1114+ return
9581115
9591116Help :
9601117 Run , % " https://github.com/JSSatchell/HyperSearch"
0 commit comments