Post by xxgeek on Nov 16, 2022 6:01:53 GMT
Latest version is 1005
Posted approx 9:35 (Eastern) Nov 18 2022
Changed Window to open mid screen instead of top left.
' Changed to start in Search Page
' edited to search Help Files instead of help index list - providing an increased list of help
'- added "Best Guesses" to top of the results list
' added search of Freeform Help and Tutorial pages to search listings - providing even more relevant listings
' added font resizer buttons; + - and default font size(middle button) - Helps when Listings go off screen
' added more real estate to the listboxes by using all the space in the window. ( Keeping window slim)
' added sorting to search results list
' use your scroll wheel to scroll the listboxes
' Hid the "GO" button as default button
'Type your search word(s) and then
' Hit Enter]
Latest Version = 1006
Posted approx 7:00 am Nov 19 2022
' NEW version # = 1006 - Nov 18 2022 approx 6;45 am (Eastern)
' Added XOR NOT AND OR and more to possible results. They were not in results using original code
' Removed the 2 character limit on search words. It was depriving the user of relevant help
' Now words like IF, ON, AS, OR can return results).
' The "Best Guess" list has increased from a max of 16 t0 a max of 97 - to accomodate any 2 character searches.
' Added - if the title = search word then it is first in the list of "Best Guesses"
' Fixed a couple of pages 'wrong in JB Help' to open to correct page when searched.
' filtered or fixed some more bad links I found
Latest Version = v1.0
' Posted - Dec 5 2022 approx 12:20am (Eastern)
' Try some 1 , 2 , 3 and 4 letter searches - Surprizing!! (and or not xor as in on if do _v ........whatever)
' changed list top header to report # of "TITLES"
' changed "Best Guesses to ""#" Top Picks - to reflect actual results source
' Put the scroll bar back, but slimmed down a bit. (1, 2, and 3 character search results are quite long)
' added at top of list a line stating if there was a 'Match" when there is a 'Match' for the search word
' added 2 more categories, JB Examples, and JB Functions. (pages come from JB examples, and JB Functions)
' JB Functions and JB Examples open their page of Code in Just Basic IDE when clicked.
' added 'markers' to the list of results for each category to distinguish easily between code help and html help
' H= Help, F= Freeform, T= Tutorial, CE= Code Example, CF= Code Function (The "C' indicates Code - for future use)
' The 2 Code categories have 2 characters instead of 1 to distinguish them easily when viewing the list
Latest Version = v1.1
' New version # = v1.1 Dec 6 2022 approx 9:00pm (Eastern)
' Changed opening of JB examples and Functions files, to open a copy (tempFile.bas) to prevent users editing
' the original file and corrupting the JB files.
' Changed the way the userhomepath is retrieved, using a file verification loop, instead of a pause, after CMD is run.
' fixed a minor issue with the number of reported "Other Pages" In some cases it was reporting an extra page.
' Implimented a change suggested by tsh73 - files uAppPath$, "*.bas", info$() -
' instead of filtering results of files uAppPath$, info$() with the following "if" and "or" lines
' if right$(fileToOpen$, 4) = ".rtf" or right$(fileToOpen$, 4) = ".fre"_
' or right$(fileToOpen$, 4) = ".txt" then name$ = "" = less code, less time for the search.
' New version # = v1.5 Dec 9 approx 5:15am (Eastern) - edits made by xxgeek
' When clicking on a "white" empty listing, or one of the headers a notice "File not found" was appearing - fixed
' was crashing at times and giving false results due to improper search result count - fixed
' added some more pages to search in Tutorial - some are code pages
' added CT (Code Tutorial) to markers for Tutorial Coded pages (.bas files) - they open in JB IDE too (as all coded pages do).
' added Wordpad to the mix. Tutorial text pages open in Wordpad, Tutorial Help pages open in users default browser
' Some searches of Tutorial were giving results like T_1, T_2, T-3 etc - fixed.
' Searches for words like "can" were giving results of a match for "scan" etc - fixed
' Edited the way the search results, and the headers like "Other Files" and "Remaining Titles" appear.
' No more 0's in results display - user doesn't care about what isn't there, only what is there
' Added a link to the Just Basic forums at bottom of search results.
' shortened some code for efficiency
' changed clearing of search word between searches to highlighting, instead of clearing to allow adding
' - new categories via checkboxes without re-typing search word
' MAJOR change = copying the JB appdata dir contents to DefaultDir$ so the JB Examples code
' - work, having all their supporting files available, and to ensure the user doesn't edit the originals.
' Also added a "folder copy" function to facilitate the above folder copy.
' BEWARE - STERN WARNING - MAKE SURE you put this file in a folder of it's own.
' All known bugs, issues, suggestions and ideas have been dealt with.
Well, this ended up being quite a chore. The help files, freeform help and tutorial pages are written slightly different in each category, and then variations in each category as well. Had to look through most html pages to see what lines I needed to read in order to filter out pages that do not include the search word(s)
Then, in making some other changes, ran into some JB quirks/rules and had to pretty much rewrite the whole thing to get done what I wanted to do.
Made quite a few minor cosmetic and operational/ease of use changes. Hope you guys like them.
Main thing is it works and grabs more help for the user.
Note: When it opens, You're in the search page with the focus on the textbox for your search word(s). Just Start typing your search word(s). When you have the word typed hit [Enter]
More info at top of code.
Tried many search words while testing, and it does very well.
Try it with the original code side by side and see the difference yourself.
It's pretty fast too considering it has to scan many files, do some filtering, sort the list etc.
It checks 12 lines of 339 pages every scan. Almost instantly here on my i7 8 core 16gb Lenovo. (Got my main rig with me again - was 8 months with a notebook 13" screen) If I had 2 of them I would have made glasses with them to see better.
Feedback is welcome. Requests are always considered.
Posted approx 9:35 (Eastern) Nov 18 2022
Changed Window to open mid screen instead of top left.
' Changed to start in Search Page
' edited to search Help Files instead of help index list - providing an increased list of help
'- added "Best Guesses" to top of the results list
' added search of Freeform Help and Tutorial pages to search listings - providing even more relevant listings
' added font resizer buttons; + - and default font size(middle button) - Helps when Listings go off screen
' added more real estate to the listboxes by using all the space in the window. ( Keeping window slim)
' added sorting to search results list
' use your scroll wheel to scroll the listboxes
' Hid the "GO" button as default button
'Type your search word(s) and then
' Hit Enter]
Latest Version = 1006
Posted approx 7:00 am Nov 19 2022
' NEW version # = 1006 - Nov 18 2022 approx 6;45 am (Eastern)
' Added XOR NOT AND OR and more to possible results. They were not in results using original code
' Removed the 2 character limit on search words. It was depriving the user of relevant help
' Now words like IF, ON, AS, OR can return results).
' The "Best Guess" list has increased from a max of 16 t0 a max of 97 - to accomodate any 2 character searches.
' Added - if the title = search word then it is first in the list of "Best Guesses"
' Fixed a couple of pages 'wrong in JB Help' to open to correct page when searched.
' filtered or fixed some more bad links I found
Latest Version = v1.0
' Posted - Dec 5 2022 approx 12:20am (Eastern)
' Try some 1 , 2 , 3 and 4 letter searches - Surprizing!! (and or not xor as in on if do _v ........whatever)
' changed list top header to report # of "TITLES"
' changed "Best Guesses to ""#" Top Picks - to reflect actual results source
' Put the scroll bar back, but slimmed down a bit. (1, 2, and 3 character search results are quite long)
' added at top of list a line stating if there was a 'Match" when there is a 'Match' for the search word
' added 2 more categories, JB Examples, and JB Functions. (pages come from JB examples, and JB Functions)
' JB Functions and JB Examples open their page of Code in Just Basic IDE when clicked.
' added 'markers' to the list of results for each category to distinguish easily between code help and html help
' H= Help, F= Freeform, T= Tutorial, CE= Code Example, CF= Code Function (The "C' indicates Code - for future use)
' The 2 Code categories have 2 characters instead of 1 to distinguish them easily when viewing the list
Latest Version = v1.1
' New version # = v1.1 Dec 6 2022 approx 9:00pm (Eastern)
' Changed opening of JB examples and Functions files, to open a copy (tempFile.bas) to prevent users editing
' the original file and corrupting the JB files.
' Changed the way the userhomepath is retrieved, using a file verification loop, instead of a pause, after CMD is run.
' fixed a minor issue with the number of reported "Other Pages" In some cases it was reporting an extra page.
' Implimented a change suggested by tsh73 - files uAppPath$, "*.bas", info$() -
' instead of filtering results of files uAppPath$, info$() with the following "if" and "or" lines
' if right$(fileToOpen$, 4) = ".rtf" or right$(fileToOpen$, 4) = ".fre"_
' or right$(fileToOpen$, 4) = ".txt" then name$ = "" = less code, less time for the search.
' New version # = v1.5 Dec 9 approx 5:15am (Eastern) - edits made by xxgeek
' When clicking on a "white" empty listing, or one of the headers a notice "File not found" was appearing - fixed
' was crashing at times and giving false results due to improper search result count - fixed
' added some more pages to search in Tutorial - some are code pages
' added CT (Code Tutorial) to markers for Tutorial Coded pages (.bas files) - they open in JB IDE too (as all coded pages do).
' added Wordpad to the mix. Tutorial text pages open in Wordpad, Tutorial Help pages open in users default browser
' Some searches of Tutorial were giving results like T_1, T_2, T-3 etc - fixed.
' Searches for words like "can" were giving results of a match for "scan" etc - fixed
' Edited the way the search results, and the headers like "Other Files" and "Remaining Titles" appear.
' No more 0's in results display - user doesn't care about what isn't there, only what is there
' Added a link to the Just Basic forums at bottom of search results.
' shortened some code for efficiency
' changed clearing of search word between searches to highlighting, instead of clearing to allow adding
' - new categories via checkboxes without re-typing search word
' MAJOR change = copying the JB appdata dir contents to DefaultDir$ so the JB Examples code
' - work, having all their supporting files available, and to ensure the user doesn't edit the originals.
' Also added a "folder copy" function to facilitate the above folder copy.
' BEWARE - STERN WARNING - MAKE SURE you put this file in a folder of it's own.
' All known bugs, issues, suggestions and ideas have been dealt with.
Well, this ended up being quite a chore. The help files, freeform help and tutorial pages are written slightly different in each category, and then variations in each category as well. Had to look through most html pages to see what lines I needed to read in order to filter out pages that do not include the search word(s)
Then, in making some other changes, ran into some JB quirks/rules and had to pretty much rewrite the whole thing to get done what I wanted to do.
Made quite a few minor cosmetic and operational/ease of use changes. Hope you guys like them.
Main thing is it works and grabs more help for the user.
Note: When it opens, You're in the search page with the focus on the textbox for your search word(s). Just Start typing your search word(s). When you have the word typed hit [Enter]
More info at top of code.
Tried many search words while testing, and it does very well.
Try it with the original code side by side and see the difference yourself.
It's pretty fast too considering it has to scan many files, do some filtering, sort the list etc.
It checks 12 lines of 339 pages every scan. Almost instantly here on my i7 8 core 16gb Lenovo. (Got my main rig with me again - was 8 months with a notebook 13" screen) If I had 2 of them I would have made glasses with them to see better.
Feedback is welcome. Requests are always considered.
' another help file viewer
' (C) 2020 by cundo - find this code and discussion at justbasiccom.proboards.com
' Author(s) accept NO Resposiblity or Liability for this software the damage it may cause,
' or any distress anyone using this software may experience
' It is up to the user to be aware of the limits and function off the software, and to read the warnings, and help file(s)
' Use this software at your own risk
' The software code is free to use for any purpose
' Copyrights apply, and are owned by cundo. (A member of the Just Basic forums)
' New version # = 1.003 Nov 14 2022 - edits made by xxgeek
' Changed Window to open mid screen instead of top left.
' Changed to start in Search Page, instead of the "Contents" page
' edited to search Help Files instead of help index list - providing an increased list of help
'- added "Best Guesses" to top of the results list
' added search of Freeform Help and Tutorial pages to search listings - providing even more relevant listings
' added font resizer buttons; + - and default font size(middle button) - Helps when Listings go off screen
' added more real estate to the listboxes by using all the space in the window. ( Keeping window slim)
' added sorting to search results list
' use your scroll wheel to scroll the listboxes
' Hid the "GO" button as default button
'Type your search word(s) and then
' Hit Enter]
' NEW version # = 1006 - Nov 18 2022 approx 6:45 am (Eastern) - edits made by xxgeek
' added XOR NOT AND, and OR to possible results - previously not available due to character limit
' Removed the 2 character limit on search words. It was depriving the user of relevant help (Now words like IF, ON, AS, OR can return results).
' and the "Best Guess" list has increased from a max of 16 t0 a max of 97 - to accomodate any 2 character searches.
' Now if the title = search word then it is first in the list of "Best Guesses"
' Fixed a couple of pages 'wrong in JB Help' to open to correct page when searched.
' filtered or fixed some more bad links I found
' NEW version # = v1.0 - Dec 5 2022 approx 12:30am (Eastern) - edits made by xxgeek
' Try some 1 , 2 , 3 and 4 letter searches - Surprizing!! (and or not xor as in on if do _v ........whatever)
' changed list top header to report # of "TITLES"
' changed "Best Guesses to ""#" Top Picks - to reflect actual results source
' Put the scroll bar back, but slimmed down a bit. (1, 2, and 3 character search results are quite long)
' added at top of list a line stating if there was a 'Match" when there is a 'Match' for the search word
' added 2 more categories, JB Examples, and JB Functions. (pages come from JB examples, and JB Functions)
' JB Functions and JB Examples open their page of Code in Just Basic IDE when clicked.
' added 'markers' to the list of results for each category to distinguish easily between code help and html help
' H= Help, F= Freeform, T= Tutorial, CE= Code Example, CF= Code Function (The "C' indicates Code - for future use)
' The 2 Code categories have 2 characters instead of 1 to distinguish them easily when viewing the list
'changed "AppData" dir from "AppData\Roaming" to "Application Data" - should work in all Windows versions now - please report any problems
'
' New version # = v1.1 Dec 6 approx 9:00pm (Eastern) - edits made by xxgeek
' Changed opening of JB examples and Functions files, to open a copy (tempFile.bas) to prevent users editing
' the original file and corrupting the JB files.
' Changed the way the userhomepath is retrieved, using a file verification loop, instead of a pause, after CMD is run.
' fixed a minor issue with the number of reported "Other Pages" In some cases it was reporting an extra page.
' Implimented a change suggested by tsh73 - files uAppPath$, "*.bas", info$() -
' instead of filtering results of files uAppPath$, info$() with the following "if" and "or" lines
' if right$(fileToOpen$, 4) = ".rtf" or right$(fileToOpen$, 4) = ".fre"_
' or right$(fileToOpen$, 4) = ".txt" then name$ = "" = less code, less time for the search.
'
' New version # = v1.5 Dec 9 approx 5:25am (Eastern) - edits made by xxgeek
' When clicking on a "white" empty listing, or one of the headers a notice "File not found" was appearing - fixed
' was crashing at times and givingg false results due to improper search result count - fixed
' added some more pages to search in Tutorial - some are code pages
' added CT (Code Tutorial) to markers for Tutorial Coded pages (.bas files) - they open in JB IDE too (as all coded pages do).
' added Wordpad to the mix. Tutorial text pages open in Wordpad, Tutorial Help pages open in users default browser
' Some searches of Tutorial were giving results like T_1, T_2, T-3 etc - fixed.
' Searches for words like "can" were giving results of a match for "scan" etc - fixed
' Edited the way the search results, and the headers like "Other Files" and "Remaining Titles" appear.
' No more 0's in results display - user doesn't care about what isn't there, only what is there
' Added a link to the Just Basic forums at bottom of search results.
' shortened some code for efficiency
' changed clearing of search word between searches to highlighting, instead of clearing to allow adding
' - new categories via checkboxes without re-typing search word
' MAJOR change = copying the JB appdata dir contents to DefaultDir$ so the JB Examples code
' - work, having all their supporting files available, and to ensure the user doesn't edit the originals.
' Also added a "folder copy" function to facilitate the above folder copy.
' BEWARE - STERN WARNING - MAKE SURE you put this file in a folder of it's own, or YOU will be responsible for the mess it creates
' All known bugs, issues, suggestions and ideas have been dealt with.
TITLE$ = "JB Help Search v.1.5 - by cundo"
'get the users home path
call getUserPath
if VAL(Version$)<2 then notice "Just BASIC 2.0 required" : end
WindowWidth = 228 : WindowHeight = 560
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
dim ar$(500), searchList$(500), info$(0,0), oneOf$(2500)
global jbPath$, helpFilePath$,tutorialPath$, freeformPath$, fontsize, q$, upath$, temp$
jbPath$ = "c:\Program Files (x86)\Just Basic v2.0"
jbexe$ = jbPath$;"\jbasic.exe"
helpFilePath$ = jbPath$;"\jb2help\JustBASIC_2_web"
helpFileMenu$ = "amber_menu.htm"
freeformPath$ = helpFilePath$;"\html\fformhelp"
uAppPath$ = upath$;"\Application Data\Just Basic v2.0"
tutorialPath$ = jbPath$ ;"\jbtutorial"
homeWork$ = uAppPath$;"\TUTORIAL"
q$ = chr$(34)
' if not exist, copy the users 'justbasic2.ini' file to DefaultDir$ (the dir this file is running from)
' This is done to prevent the "World of Just Basic" window, with all the Links from opening
' when a Code file( Example or Function) is opened in JB the IDE
if fileExists(uAppPath$, "justbasic2.ini") then
if fileExists(DefaultDir$, "justbasic2.ini") = 0 then
open uAppPath$;"\justbasic2.ini" for input as #1
open DefaultDir$;"\justbasic2.ini" for output as #2
#2 input$(#1, lof(#1)) : close #1 : close #2
end if
else
notice "Can't find the justbasic2.ini file = minor problem - continue on" : goto [checkpoint]
end if
[checkpoint]
'Check for jb help files existence - end program if false
if fileExists(helpFilePath$, helpFileMenu$)=0 then notice "Program Terminated";chr$(13) ; "Couldn't find the help files" : end
open helpFilePath$; "\"; helpFileMenu$ for input as #1
txt$ = input$(#1, lof(#1))
close #1
'Load the "Contents" menu list array
lowerTxt$= lower$(txt$)
while 1
scan
startAt = c+1
a = instr(lowerTxt$, "href",startAt)
b = instr(lowerTxt$, ">",a+1)
c = instr(lowerTxt$, "</a>",b+1)
if a=0 or b=0 or c= 0 then exit while
hrefA= instr(lowerTxt$,chr$(34),a+1)
hrefB= instr(lowerTxt$,chr$(34),hrefA+1)
idx = idx +1
ar$(idx)= trim$(mid$(txt$,b+1,c-b-1));chr$(0);_
trim$(mid$(txt$,hrefA+1,hrefB-hrefA-1))
wend
nomainwin
'Create the form - open the window - set some fonts
listbox #main.listbox1, ar$(, [mainList], 0, 35, 229, 420
textbox #main.tb 0, 35, 218, 20
listbox #main.listbox2, searchList$(, [openFile], 0, 55, 229, 400
checkbox #main.fform, "FreeForm", [freeForm], [nofreeForm], 1, 465, 70, 10
checkbox #main.tutorial, "Tutorial", [tutorial], [noTutorial], 70, 465, 65, 10
checkbox #main.jbhelp, "JB-Help", [jbHelp], [nojbHelp], 145, 480, 60, 10
checkbox #main.jbexamples, "Examples", [jbexamples], [nojbexamples], 1, 480, 70, 10
checkbox #main.jbfunctions, "Functions", [jbfunctions], [nojbfunctions], 70, 480, 70, 10
checkbox #main.codebank, "CodeBank", [codebank], [nocodebank], 130, 465, 85, 10
button #main.contents, "&Contents", [contents], UL, 4, 3, 85, 30
button #main.search, "&Search", [search], UL, 93, 3, 75, 30
button #main.help, "&Help", [help], UL, 173, 3, 45, 30
button #main.incFont, "&+", [incFont], UL, 80, 505, 20, 20
button #main.defFont, "&| ", [defFont], UL, 100, 505, 20, 20
button #main.decFont, "&-", [decFont], UL, 120, 505, 20, 20
button #main.default, "", [startSearching], UL, 0, 0, 0, 0
open TITLE$ for dialog_nf as #main
#main "trapclose [quit]"
#main "font Arial 10"
#main.jbhelp "font Arial 8"
#main.tutorial "font Arial 8"
#main.fform "font Arial 8"
#main.jbexamples "font Arial 8"
#main.jbfunctions "font Arial 8"
#main.listbox1 "singleclickselect"
#main.listbox2 "singleclickselect"
#main.codebank "disable"
#main.listbox1 "hide" : #main.tb "!hide"
fontsize = 8
content = 1
jbHelp = 1 : #main.jbhelp, "set"
'Copy the folder from appdata to defaultdir (So the support files are present and the .bas files work when opened in JB)
if fileExists(DefaultDir$;"\bmp", "BAR.BMP") = 0 then
cursor hourglass
a = CopyFolder(uAppPath$, DefaultDir$)
cursor normal
end if
goto [search]
wait
'set and reset checkboxes for search categories
[freeForm] freeForm = 1 : if contents <> 1 then [search] else wait
[nofreeForm] freeForm = 0 : if contents <> 1 then [search] else wait
[jbHelp] jbHelp = 1 : if contents <> 1 then [search] else wait
[nojbHelp] jbHelp = 0 : if contents <> 1 then [search] else wait
[tutorial] tutorial = 1 : if contents <> 1 then [search] else wait
[noTutorial] tutorial = 0 : if contents <> 1 then [search] else wait
[jbexamples] jbexamples = 1 : if contents <> 1 then [search] else wait
[nojbexamples] jbexamples = 0 : if contents <> 1 then [search] else wait
[jbfunctions] jbfunctions = 1 : if contents <> 1 then [search] else wait
[nojbfunctions] jbfunctions = 0 : if contents <> 1 then [search] else wait
[codebank] codebank = 1 : if contents <> 1 then [search] else wait
[nocodebank] codebank = 0 : if contents <> 1 then [search] else wait
'resize window font - sets all Listbox fonts equal
[incFont]
fontsize = fontsize + 1 : #main.listbox1 "font Arial ";fontsize : #main.listbox2 "font Arial ";fontsize
if content <>1 then [search] else #main.search, "!setfocus" : wait
[decFont]
fontsize = fontsize - 1 : #main.listbox1 "font Arial ";fontsize : #main.listbox2 "font Arial ";fontsize
if content <>1 then [search] else #main.search, "!setfocus" : wait
[defFont]
fontsize = 8 : #main.listbox1 "font Arial ";fontsize : #main.listbox2 "font Arial ";fontsize
if content <>1 then [search] else #main.search, "!setfocus" : wait
[quit]
close #main
end
' an item was selected from "Contents" menu
[helpList]
#main.listbox1 "selection? h$"
goto [openFile]
'"Contents" button was pressed
[contents]
#main.listbox1 "show" : #main.listbox2 "hide" : #main.tb "!hide"
#main.search "!setfocus" : content = 1
wait
'The [Help] - help button for this program was pressed
[help]
notice "Help";CHR$(13);_
"From the Contents list, single click an";_
" item and the web browser will display the topic.";_
CHR$(13);CHR$(13);_
"From the Search list (empty at start), type";_
" your search word (no character minimum), and hit [Enter]";_
CHR$(13);CHR$(13);"Use the checkboxes to add categories to the search results";_
CHR$(13);CHR$(13);_
"Use Your Mouse Wheel to Scroll Search Results.";_
CHR$(13);CHR$(13);"Search results are marked to indicate the category they represent";_
CHR$(13);CHR$(13);_
"H = Help , T = Tutorial , F = Freeform , CF = Code Functions , CE = Code Examples, CT = Code Tutorial";_
CHR$(13);CHR$(13);_
"H T & F open html help pages in user's default browser";_
CHR$(13);CHR$(13);_
"CE , CF and CT open bas files (Code Examples, Code Functions, or Code from the Tutorial) in Just Basic's IDE";_
CHR$(13);CHR$(13);_
"Tutorial text pages (other than the html pages) open in Wordpad.";_
CHR$(13);CHR$(13);_
"How to append this program to the Just BASIC Run menu for easy access.";_
CHR$(13);_
"1) Tokenize this program's code: Run menu > Make *.tkn File.";_
" Use any name for the file,";_
" remember where this file is, and how it is named.";_
CHR$(13);_
"2) Select the menu Setup > External Programs";_
CHR$(13);_
"3) Click on the New button, choose a name of your liking to create a new item.";_
" This is the name that will appear under the JB's Run menu. So choose a descriptive name.";_
CHR$(13);_
"4) Select the created item.";CHR$(13);_
"5) Click on the Browse menu, and look for your previously created tkn file on step 1.";_
CHR$(13);_
"6) Just BASIC will tell you should restart the Editor."
if content = 1 then #main.search, "!setfocus" : wait
'The [Search] button was pressed, or after searching/changing font size etc, the program was directed back here.
[search]
redim searchList$(2500)
redim oneOf$(2500)
searchFor$ = ""
content = 0
done = 0
#main.listbox1 "hide" : #main.listbox2 "show" : #main.tb "!show"
#main.listbox2 "select 0" : #main.tb "!setfocus"
#main.tb "!contents? searchFor$"
wait
[startSearching]
#main.tb "!contents? searchFor$"
searchFor$=trim$(searchFor$)
if searchFor$ = "" then notice "No Search Word Detected" : goto [search]
#main.tb "!selectall"
cursor hourglass
'search jb help files
if jbHelp = 1 then
count = 3
files helpFilePath$;"\html", info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
fileToOpen$ = info$(i, 0)
open helpFilePath$;"\html\"; fileToOpen$ for input as #2
contents$ = input$(#2, lof(#2)) : close #2
if instr(lower$(contents$), lower$(searchFor$)) then
x = 1
if lower$(searchFor$) = "and" then oneOf$(count) = "H_AND" : count = count + 1
if lower$(searchFor$) = "not" then oneOf$(count) = "H_NOT" : count = count + 1
if lower$(searchFor$) = "xor" then oneOf$(count) = "H_XOR" : count = count + 1
if lower$(searchFor$) = "or" then oneOf$(count) = "H_OR" : count = count + 1
listName$ = helpFilePath$;"\html\"; fileToOpen$
open listName$ for input as #1 : isOpen = 1
while not(eof(#1))
scan
line input #1, name$
if x = 5 and lower$(left$(name$, 7)) = lower$("<TITLE>") then
name3$ = mid$(name$, 8, len(name$)-15) : if right$(name3$, 4) = "Etc." then name3$ = left$(name3$, len(name3$) - 1)
oneOf$(count) = "H_";name3$ : count = count + 1
end if'
if x = 8 and left$(lower$(name$), 7) = lower$("<TITLE>") then
name5$ = mid$(name$, 8, len(name$)-15)
oneOf$(count) = "H_";name5$ : count = count + 1
end if
if x = 12 and left$(name$ , 5) = "<P><A" then
name8$ = word$(name$, 2, "</A><B>") : name8$ = left$(name8$, len(name8$)-8)
oneOf$(count) = "H_";name8$ : count = count + 1
end if
if x = 14 and left$(name$ , 3) = "<P>" then
name7$ = mid$(name$, 4, len(name$)-7)
oneOf$(count) = "H_";name7$ : count = count + 1
end if
if x = 15 and right$(name$, 8) = "</B></P>" then
name11$ =word$(name$, 2, "B>") : name11$ = left$(name11$, len(name11$)-2)
oneOf$(count) = "H_";name11$ : count = count + 1
exit while
end if
if x = 15 then exit while
x = x + 1
wend
if isOpen = 1 then close #1 : isOpen = 0
end if
next i
end if
'Search the Freeform help files
if freeForm = 1 then
files freeformPath$, info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
fileToOpen$ = info$(i, 0)
open freeformPath$;"\"; fileToOpen$ for input as #2
contents$ = input$(#2, lof(#2)) : close #2
if instr(lower$(contents$), lower$(searchFor$)) then
listName$ = freeformPath$;"\"; fileToOpen$
open listName$ for input as #1 : isOpen = 1
for x = 1 to 8
line input #1, name$
if x = 7 and left$(lower$(name$), 7) = lower$("<TITLE>") then
name4$ = mid$(name$, 8, len(name$)-15)
oneOf$(count) = "F_";name4$ : count = count + 1
end if
if x = 8 and left$(lower$(name$), 7) = lower$("<TITLE>") then
name5$ = mid$(name$, 8, len(name$)-15)
oneOf$(count) = "F_";name5$ : count = count + 1
end if
next x
if isOpen = 1 then close #1 : isOpen = 0
end if
next i
end if
'search the Tutorial Help files
if tutorial = 1 then
files tutorialPath$, info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
x = 1
fileToOpen$ = info$(i, 0)
open tutorialPath$;"\";fileToOpen$ for input as #2
contents$ = input$(#2, lof(#2)) : close #2
if instr(lower$(contents$), lower$(searchFor$)) then
listName$ = tutorialPath$;"\"; fileToOpen$
open listName$ for input as #1
while not(eof(#1))
scan
line input #1, name$ : name$ = trim$(name$)
if x = 18 and left$(name$, 6) = "<p><b>"then
name12$ = mid$(name$, 7, len(name$)-14)
oneOf$(count) = "T_";name12$ : count = count + 1
end if
if x = 19 and left$(name$, 6) = "<p><b>"then
name6$ = upper$(left$(fileToOpen$, len(fileToOpen$)-5))
oneOf$(count) = "T_";name6$ : count = count + 1
end if
if x = 20 and left$(name$, 6) = "<p><b>"then
name15$ = upper$(left$(fileToOpen$, len(fileToOpen$)-5))
oneOf$(count) = "T_";name15$ : count = count + 1
exit while
end if
if x = 20 then exit while
x = x + 1
wend
close #1
end if
next i
files DefaultDir$;"\TUTORIAL", info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
x = 1
fileToOpen$ = info$(i, 0)
open DefaultDir$;"\TUTORIAL";"\";fileToOpen$ for input as #2
contents$ = input$(#2, lof(#2)) : close #2
if instr(lower$(contents$), lower$(searchFor$)) then
if right$(fileToOpen$, 4) = ".BAS" then
name14$ = left$(fileToOpen$, len(fileToOpen$) - 4)
oneOf$(count) = "CT_";name14$ : count = count + 1
end if
if right$(fileToOpen$, 4) = ".TXT" then
name15$ = left$(fileToOpen$, len(fileToOpen$) - 4)
oneOf$(count) = "T_";name15$ : count = count + 1
x = x + 1
'end if
end if
end if
next i
end if
'Search the JB Examples Files
if jbexamples = 1 then
files DefaultDir$, "*.bas", info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
fileToOpen$ = info$(i, 0)
open DefaultDir$;"\";fileToOpen$ for input as #2
contents$ = input$(#2, lof(#2)) : close #2
if instr(lower$(contents$), lower$(searchFor$)) then
name$ = upper$(fileToOpen$)
name$ = left$(name$, len(name$)-4)
oneOf$(count) = "CE_";name$ : count = count + 1
end if
next i
end if
'search the jb functions files
if jbfunctions = 1 then
files DefaultDir$;"\FFFunctions", info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
fileToOpen$ = info$(i, 0)
open DefaultDir$;"\FFFunctions\";fileToOpen$ for input as #2
contents$ = input$(#2, lof(#2)) : close #2
if instr(lower$(contents$), lower$(searchFor$)) then
name$ = upper$(fileToOpen$)
name$ = left$(name$, len(name$)-4)
oneOf$(count) = "CF_";name$ : count = count + 1
end if
next i
end if
'if no search results found
if count - 3 = 0 then
searchList$(1) = " "
searchList$(2) = " "
searchList$(3) = " Nothing found for: "
searchList$(4) = " ";upper$(searchFor$)
searchList$(5) = " "
searchList$(6) = " Try adding other Categories"
searchList$(7) = " "
searchList$(8) = " To the Search Engine"
searchList$(9) = " "
searchList$(10) = " Using the CheckBoxes "
#main.listbox2 "reload"
cursor normal
goto [doneSearching]
end if
'sort the list of possible results
sort oneOf$(), 3, count
dim b$(count+1)
happened$="|"
K = 0
'filter out the false Titles (Due to differences in html help pages source code - Title not on same line in all files)
for i = 0 to count
name$ = oneOf$(i)
if right$(name$, 1) = ">" or right$(name$, 6) = "window" or left$(name$, 5) = "H_ame" or right$(name$, 8) = "position"_
or left$(name$, 5) = "H_GCO" or right$(name$, 1) = ":" or left$(name$, 3) = "H_<" _
or left$(name$, 3) = "H_"+chr$(39) or right$(name$, 1) = "." or right$(name$, 1) = " " or right$(name$, 8) = "[branch]"_
or right$(name$, 3) = "] )" or right$(name$, 3) = "] ]" or right$(name$, 6) = "items)" or name$ = "H_WHILE...WEND"_
or right$(name$, 5) = "size)" or right$(name$, 1) = ";" or right$(name$, 5) = "LEN=n" or right$(name$, 7) = "number)" _
or right$(name$, 7) = "#handle" or right$(name$, 4) = "varN" or right$(name$, 4) = "...)" or right$(name$, 2) = "];" _
or right$(name$, 1) = "v" or right$(name$, 8) = "fontSpec" or right$(name$, 7) = "expr2 )" or right$(name$, 2) = "))"_
or right$(name$, 12) = "variableName" or right$(name$, 4) = "num2"or right$(name$, 5) = ".bmp"+chr$(34)_
or right$(name$, 2) = chr$(34)+")" or right$(name$, 4) = "var"+chr$(36) or right$(name$, 4) = ",n])"_
or right$(name$, 4) = "expr" or right$(name$, 4) = "num2" or right$(name$, 9) = chr$(34)+"refresh"+chr$(34)_
or right$(name$, 3) = "g])" or right$(name$, 6) = "Label]" or right$(name$, 8) = "#handle)" or right$(name$, 9) = "String$ )"_
or right$(name$, 11) = "Expression)" or right$(name$, 10) = "expression" or right$(name$, 9) = "[number])"_
or right$(name$, 7) = "struct)" or right$(name$, 7) = "comment" or right$(name$, 12) = "recordNumber"_
or right$(name$, 5) = "size)" or right$(name$, 6) = "follow" or right$(name$, 6) = "mode ]" or right$(name$, 8) = "number )"_
or right$(name$, 8) = "[column]" or right$(name$, 10) = "#handle, n" or right$(name$, 2) = " 1" or right$((left$(name$, 7)), 5) = chr$(34)+"Font"_
or right$(name$, 9) = "{LEN = n}" or right$(name$, 5) = "Expr2" or right$(name$, 6) = "length"_
or right$(name$, 10) = "#newHandle" or right$(name$, 12) = "columns rows" or right$(name$, 5) = "Expr$"_
or left$(name$, 4) = "var =" or right$(name$, 6) = "xpr2 )" or left$(name$, 3) = "H_(" or right$(name$, 6) = chr$(34)+"name"+chr$(34) _
or right$(name$, 4) = "#h )" or right$(name$, 9) = "#handle )" or right$(name$, 1) = "€" or right$(name$, 1) = "."_
or name$ = "H_DO LOOP" or name$ = "H_FOR...NEXT" or name$ = "H_IF...THEN" or name$ = "H_Winstring" or right$(name$, 8) = "value"+chr$(34)+" )"_
or right$(name$,1) = "?" or right$(name$,3) = "c$)" or right$(name$,8) = "Keywords" or name$ ="H_BOOLEAN"_
or left$(name$, 3) = "H_&" or right$(name$, 7) = "TRACE n" or left$(name$, 11) = "H_Uninstall" or name$ = "H_"_
or name$ = "H_StartupDir" or name$ = "H_EVAL" or name$ = "H_EVAL$" or right$(name$, 4) = "face"_
or name$ = "H_REPLSTR" or name$ = "H_UPPER$(s)" or name$ = "H_LOWER$(s$)" then
oneOf$(i) = ""
end if
'remove any duplicates from search list (Thanks to tsh73)
if instr(oneOf$(i), "Liberty") then oneOf$(i) = replace$(name$, "Liberty", "Just")
if lower$(nameLast$) = lower$(name$) then oneOf$(i) = ""
if instr(happened$, "|";oneOf$(i);"|")=0 then
happened$=happened$;oneOf$(i);"|"
K=K+1: b$(K)=oneOf$(i)
end if
nameLast$ = name$
next i
'Create final list of search results
for x = 0 to K
if lower$(word$(b$(x), 2, "_")) = lower$(searchFor$) then match$ = b$(x)
if instr(lower$(b$(x)), lower$(searchFor$)) _
and lower$(mid$(b$(x), 3, len(searchFor$))) = lower$(searchFor$)_
or lower$(mid$(b$(x), 4, len(searchFor$))) = lower$(searchFor$) then_
searchList$(u+3) = b$(x) : u = u+1
next x
for t = 0 to K
if instr(lower$(b$(t)), lower$(searchFor$)) then
if lower$(mid$(b$(t), 3, len(searchFor$))) <> lower$(searchFor$)_
and lower$(mid$(b$(t), 4, len(searchFor$))) <> lower$(searchFor$) then
searchList$(u+v+10) = b$(t) : v = v+1
end if
end if
next t
for a = 0 to K
if not(instr(lower$(b$(a)), lower$(searchFor$))) then_
searchList$(u+v+w+17) = b$(a) : w = w+1
next a
'manage the headers
if u+v <> 0 then searchList$(0) = u+v;" Titles Containing ";q$;upper$(searchFor$);q$
if u+v = 0 then searchList$(0) = " No Titles Found for ";q$;upper$(searchFor$);q$';" Found"
searchList$(1) = " "
if v <> 0 then searchList$(2) = " ";u;" Top Picks For ";q$;upper$(searchFor$);q$
searchList$(u+5) =" "
if v <> 0 then searchList$(u+6) = " ";v;" Remaining Titles "'
if v <> 0 then searchList$(u+7) =" "
if v <> 0 then searchList$(v+u+13) = " "
if w-2 <> 0 then searchList$(v+u+14) = " ";w-2;" Other Pages "
if u+v = 0 then searchList$(v+u+14) = " ";w-2;" Pages Containing ";upper$(searchFor$)
searchList$(v+u+15) = " "
searchList$(v+u+w+29) = " "
searchList$(v+u+w+30) = " If you need more information "
searchList$(v+u+w+31) = " on "
searchList$(v+u+w+32) = " Just Basic v2.0 Coding "
searchList$(v+u+w+33) = " Please Visit"
searchList$(v+u+w+34) = " The Just Basic Forums "
searchList$(v+u+w+35) = " @ "
searchList$(v+u+w+36) = "https://justbasiccom.proboards.com/"
searchList$(v+u+w+37) = " "
searchList$(v+u+w+38) = " "
'if there is a match with the search result
if match$ <> "" then searchList$(1) = " 1 Match "
#main.listbox2 "reload"
'finished displaying results - reset variables - cursor back to normal
[doneSearching]
u = 0 : v = 0 : w = 0 : match$ = ""
cursor normal
goto [search]
'One of the Help Search results was Selected - Open the Help File in user's default browser
[openFile]
if jbHelp = 1 then
#main.listbox2 "selection? selectionH$"
selectionH$ = right$(selectionH$, len(selectionH$) - 2)
if selectionH$ = "XOR" or selectionH$ = "AND" or selectionH$ = "NOT" or selectionH$ = "OR" then
run "explorer.exe ";helpFilePath$;"\html\libe0azy.htm"
goto [search]
end if
files helpFilePath$;"\html", info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
fileToOpen$ = info$(i, 0)
open helpFilePath$;"\html\";fileToOpen$ for input as #3
contents$ = input$(#3, lof(#3)) : close #3
if instr(lower$(contents$), lower$("<title>";selectionH$;"</TITLE>")) then
if fileToOpen$ = "idecode451.html" then fileToOpen$ = "libe0ze8.htm"
run "explorer.exe ";helpFilePath$;"\html\";fileToOpen$ : done = 1
if done = 1 then exit for
else
if done = 1 then goto [search]
if instr(lower$(contents$), lower$("</A><B>";selectionH$;"</B></P>")) then
run "explorer.exe ";helpFilePath$;"\html\";fileToOpen$ : done = 1
if done = 1 then exit for
end if
end if
next i
if done = 1 then done = 0 : goto [search]
end if
'if a tutorial file was selected
if tutorial = 1 then
#main.listbox2 "selection? selectionT$"
selectionT$ = right$(selectionT$, len(selectionT$) - 2)
if selectionT$ = "Let's Write a Program - HILO.BAS" then selectionT$ = "lets_write_hilo"
if fileExists(tutorialPath$, selectionT$;".html") then
run "explorer.exe ";tutorialPath$;"\";selectionT$;".html" : goto [search]
else
if fileExists(DefaultDir$;"\TUTORIAL\", selectionT$;".txt") then
run "C:\Program Files\Windows NT\Accessories\wordpad.exe ";DefaultDir$;"\TUTORIAL\";selectionT$;".txt" : goto [search]
else
selectionT$ = right$(selectionT$, len(selectionT$) -1)
if fileExists(DefaultDir$;"\TUTORIAL\", selectionT$;".bas") then
run jbexe$;" ";DefaultDir$;"\TUTORIAL\";selectionT$;".bas": goto [search]
end if
end if
end if
end if
'if a freeform help file was selected
if freeForm = 1 then
#main.listbox2 "selection? selectionF$"
selectionF$ = right$(selectionF$, len(selectionF$) - 2)
files freeformPath$, info$()
numFiles = val(info$(0,0 ))
for i = 1 to numFiles
x = 1
fileToOpen$ = info$(i, 0)
open freeformPath$;"\";fileToOpen$ for input as #3
contents$ = input$(#3, lof(#3)) : close #3
if instr(lower$(contents$), lower$("<title>";selectionF$;"</title>")) then
run "explorer.exe ";freeformPath$;"\";fileToOpen$ : done = 1
end if
if done = 1 then exit for
next i
if done = 1 then done = 0 : goto [search]
end if
'if a Code Example file was selected
if jbexamples = 1 then
#main.listbox2 "selection? selectionCE$"
selectionCE$ = right$(selectionCE$, len(selectionCE$) - 3)
if fileExists(DefaultDir$, selectionCE$;".bas") then
run jbexe$;" ";DefaultDir$;"\";selectionCE$;".bas" : goto [search]
end if
end if
'if a Code Function file was selected
if jbfunctions = 1 then
#main.listbox2 "selection? selectionCF$"
selectionCF$ = right$(selectionCF$, len(selectionCF$) - 3)
if fileExists(DefaultDir$;"\FFFunctions", selectionCF$;".txt") <> 0 then
run jbexe$;" ";DefaultDir$;"\";FFFunctions;"\";selectionCF$;".txt" : goto [search]
end if
end if
#main.listbox2 "selection? selection$"
if selection$ = "https://justbasiccom.proboards.com/" then run "explorer ";selection$ : goto [search]
'an item in the "Contents" menu was selected - open the help file
[mainList]
#main.listbox1 "selection? h$"
fileToOpen$= word$( h$,2,chr$(0))
fileToOpen$=replace$( fileToOpen$ , "/", "\" )
if fileExists(helpFilePath$, fileToOpen$) <> 0 then run "explorer.exe ";helpFilePath$; "\"; fileToOpen$
if content = 1 then
content = 0
#main.search "!setfocus"
wait
end if
wait
'get users homepath = aka %userprofile% = "c:\users\xxxxx" (5 characters long normally Win 10)
sub getUserPath
run "cmd.exe /c echo %userprofile% >UserHomePath.txt", HIDE
do
scan
loop until fileExists(DefaultDir$, "UserHomePath.txt")
open "UserHomePath.txt" for input as #1
upath$ = input$(#1, lof(#1))
close #1
if upath$ = "" then notice "Sorry, can't find user path " : end
kill DefaultDir$;"\UserHomePath.txt"
end sub
'create a pause subroutine
sub pause mil
t=time$("ms")+mil
while time$("ms")<t
scan
wend
end sub
'Verify file existence function
function fileExists(path$, filename$)
dim fileExistsInfo$(0,0)
files path$, filename$, fileExistsInfo$()
fileExists = val(fileExistsInfo$(0, 0)) 'non zero is true
end function
'Replace a word in a string function
function replace$( text$ , this$, tothis$ )
while 1
if instr(text$, this$) then
f = instr(text$, this$)
lenght=len(this$)
text$ = mid$(text$,1,f-1);_
tothis$;mid$(text$,f+lenght)
else
exit while
end if
wend
replace$=text$
end function
' Copy Folder Function - Can't pin down the author = Probably Stephan Pendal or Mark Parkinson
' Possibly originally written by McKurt for liberty Basic - edited by the others (including myself xxgeek)
' Found here - http://libertybasic.fr/forum/search.php?token=9a4c973fae57752e
function CopyFolder(StartFolder$, EndFolder$)
dim Info$(1,1)
call SearchFolders StartFolder$, EndFolder$
end function
sub SearchFolders Folder$, Folder2$
files Folder$, Info$(
numSubFolders = val(Info$(0,1))
numFiles = val(Info$(0,0))
for count = 1 to numSubFolders
if FoundFolders$ = "" then
CopyFolders$ = Folder2$; "\" ; Info$(numFiles + count,1)
FoundFolders$ = Info$(0,2); Info$(0,3); Info$(numFiles + count,1)
else
FoundFolders$ = FoundFolders$; ";" ; Info$(0,2); Info$(0,3); Info$(numFiles + count,1)
CopyFolders$ = CopyFolders$; ";" ; Folder2$ ; "\" ; Info$(numFiles + count,1)
end if
next
for count = 1 to numFiles
if FoundFiles$ = "" then
CopyFiles$ = Folder2$; "\" ; Info$(count,0)
FoundFiles$ = Info$(0,2); Info$(0,3); Info$(count,0)
else
FoundFiles$ = FoundFiles$; ";" ; Info$(0,2); Info$(0,3); Info$(count,0)
CopyFiles$ = CopyFiles$; ";" ; Folder2$ ; "\" ; Info$(count,0)
end if
next
leftFolders = numSubFolders
while leftFolders > 0
call SearchFolders word$(FoundFolders$, leftFolders, ";" ), word$(CopyFolders$, leftFolders, ";" )
leftFolders = leftFolders - 1
wend
call CreateDir Folder2$
call CopyFile FoundFiles$, CopyFiles$, numFiles
end sub
sub CreateDir dPath$
[loop]
result=instr(dPath$, "\" ,result+1)
if result<>0 then
temp$=left$(dPath$,result)
r=mkdir(temp$)
goto [loop]
end if
r=mkdir(dPath$)
end sub
sub CopyFile sFiles$, dFiles$, numF
while numF > 0
FileS$ = word$(sFiles$, numF, ";" )
FileD$ = word$(dFiles$, numF, ";" )
call copy FileS$, FileD$
numF = numF - 1
wend
end sub
sub copy filepath$, newFilepath$
open filepath$ for input as #source
open newFilepath$ for output as #dest
#dest input$(#source, lof(#source))
close #source : close #dest
end sub