I'm finding it a bit difficult to get nice spacing with arial or calibri fonts. Lucida Console works perfectly, but I was hoping to discover a few other ttf windows fonts that wouldn't spread out so much over the screen and would not give unexpected results with extended ASCII characters.
I figure other members might have some favorites. Any suggestions?
$CONSOLE:ONLY
CLS
DIM SHARED AS STRING phrase, message, code
REDIM SHARED AS INTEGER sCode(0)
phrase = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
SplitCode
SELECT CASE LCASE$(COMMAND$(1))
CASE "encode"
en$ = EnCode
PRINT "EnCode<", en$
_CLIPBOARD$ = en$
PRINT
PRINT "encoded message has been copied to clipboard"
SYSTEM
CASE "decode"
de$ = DeCode
PRINT "DeCode>", de$
_CLIPBOARD$ = de$
SYSTEM
END SELECT
FUNCTION DeCode$
DIM AS STRING t, h, e
DIM AS INTEGER c
c = 1
h = UCASE$(COMMAND$(3))
FOR i = 1 TO LEN(h)
FOR x = 1 TO LEN(phrase)
IF MID$(h, i, 1) = MID$(phrase, x, 1) THEN
e = e + MID$(phrase, x - sCode(c), 1)
EXIT FOR
END IF
NEXT x
IF c = 4 THEN c = 1 ELSE c = c + 1
NEXT i
DeCode = dehex(e)
END FUNCTION
FUNCTION EnCode$
DIM AS STRING t, h, e
DIM AS INTEGER c
c = 1
h = toHex(COMMAND$(3))
FOR i = 1 TO LEN(h)
FOR x = 1 TO LEN(phrase)
IF MID$(h, i, 1) = MID$(phrase, x, 1) THEN
e = e + MID$(phrase, x + sCode(c), 1)
EXIT FOR
END IF
NEXT x
IF c = 4 THEN c = 1 ELSE c = c + 1
NEXT i
EnCode = e
END FUNCTION
SUB SplitCode
REDIM sCode(LEN(COMMAND$(2))) AS INTEGER
FOR i = i TO LEN(COMMAND$(2))
sCode(i) = VAL(MID$(COMMAND$(2), i, 1))
NEXT
END SUB
FUNCTION dehex$ (m AS STRING)
DIM s AS STRING
FOR i = 1 TO LEN(m) STEP 2
s = s + CHR$(VAL("&h" + MID$(m, i, 2)))
dehex = s
NEXT
END FUNCTION
FUNCTION toHex$ (m AS STRING)
DIM s AS STRING
FOR i = 1 TO LEN(m)
s = s + HEX$(ASC(MID$(m, i, 1)))
toHex = s
NEXT
END FUNCTION
When opening a file for editing, the "Open file" option shows all files in the directory. Can this be filtered to show only the editable ones (".bas")?
Would it be possible (or practical) to place an Attach File icon at the top of the thread page, maybe next to the Code icon? I know (now) that this is provided at the very bottom, but this is so far down the page that it's hard to find... at least for me, anyway.
Here's a small prog I wrote that finds all words that can be formed from a selected word, using each letter only once. You can select a minimum and maximum word size, up to 13 letters. It uses the wordlists in a folder that are attached as a .zip file.
Code: (Select All)
Screen 9
_FullScreen
Common Shared base$, blngth, dictfile$, dummy$, dictwrd$, l, found, totfound, foundwords$(), unique$, min, max
Dim foundwords$(100)
min = 3
Color 14: Locate 6, 35: Print "Word-Find": Color 15
Print Tab(26); "Copyright Phil Taylor (2022)": Print
Print Tab(5); "This programme will find all English words up to 13 letters in length"
Print Tab(5); "that appear in the Collins (2019) dictionary, that can be formed from "
Print Tab(5); "the letters of a word or group of letters, with each letter only being"
Print Tab(5); "used once."
Print: Print Tab(10); "(You can specify minimum and maximum word-lengths to find)."
Print: Color 14: Print Tab(30); "Press a key to start": Color 15
While InKey$ <> "": Wend
While InKey$ = "": Wend
Print Tab(15);: Input "Minimum size of words (ENTER for default of 2)"; min$
If Val(min$) < 2 Then min = 2 Else min = Val(min$)
Print Tab(30); "Minimum set at "; min
Print
Print Tab(15);: Input "Maximum size of words (ENTER for default of 13)"; max$
If Val(max$) < 2 Then max = 13 Else max = Val(max$)
Print Tab(30); "Maximum set at"; max
Sleep 1
Start:
Cls
While InKey$ <> "": Wend
Locate 10, 20: Color 14: Input "What is the Base-Word (or group)"; base$: Color 15
If base$ < "A" Then base$ = "ANYTHING" ' just a word for demo purposes
base$ = UCase$(base$)
blngth = Len(base$)
Cls
Color 14: Print "Base-word is "; base$
Print "Minimum length:"; min; " Maximum length:"; max
: Color 15: Print
base$ = UCase$(base$)
sorted$ = Left$(base$, 1)
FindUnique
For bletrnum = 1 To blngth ' for each letter in base$
fileletr$ = Mid$(base$, bletrnum, 1)
po = InStr(unique$, fileletr$)
If po = 0 Then GoTo skip
Mid$(unique$, po, 1) = " "
dictfile$ = "wordlists/" + fileletr$
Close
Open dictfile$ For Input As #1
GetAWord:
While Not EOF(1)
Input #1, dictwrd$
l = Len(dictwrd$): If l < min Or l > max Then GoTo GetAWord
WORDCHECK
Wend
skip:
Next
Color 14: Print Tab(35); "Finished!"
Print Tab(29); "Total words found:"; totfound
Sleep
GoTo Start
Sub WORDCHECK
fail = 0
dummy$ = base$
For a = 1 To l
dictletr$ = Mid$(dictwrd$, a, 1)
po = InStr(dummy$, dictletr$)
If po = 0 Then
fail = 1 ' letter is not in dummy$ so abandon word
Else
Mid$(dummy$, po, 1) = " "
End If
Next
If fail = 1 Then Exit Sub
found = found + 1: totfound = totfound + 1
foundwords$(found) = dictwrd$
If Pos(0) > 77 Then Print
Print dictwrd$; Space$(13 - l);
If found = 100 Then
While InKey$ <> "": Wend
Color 14
Print
Print Tab(27); "Press a key for next group"
While InKey$ = "": Wend
found = 0
Cls
Color 14: Print "Base-word is "; base$: Print
Print "Minimum length:"; min; " Maximum length:"; max
Color 15
End If
End Sub
Sub FindUnique
unique$ = ""
For a = 1 To blngth
l$ = Mid$(base$, a, 1)
po = InStr(unique$, l$)
If po = 0 Then unique$ = unique$ + l$
Next
End Sub
The problem with NOT is a hidden error for me. In any case, I personally have no comprehensible explanation for the results. Better for the one result. Why is an incorrect result returned at only one point?
PS: I've now tried everything I could think of again, the wrong result under No. 3 remains.
A command which everyone thinks they know flawlessly, and yet, they probably don't.
What is it? REM is a command that allows people to place remarks inside a program so that it helps clarify what's going on and makes it much easier to come back to the program at a future time and understand just what the BLEEP the programmer was thinking when he coded everything originially.
How to use it? Just add REM to where you want to place a comment, and then type out your comment!
And with the basic description of this most basic command out of the way, let's touch back upon the opening sentence which begins this post, where I claimed: most folks don't know everything about REM, like they think they do. WTH is up with that?? "What are people misunderstanding", you ask?
Most people think that REM and ' (the single quote) are interchangeable and completely the same. In fact, most people think that ' (the single quote) is nothing more than a shortcut to reduce typing out the whole word REM.
This isn't true!!
REM is a *COMMAND*.
' (the single quote) is part of a *COMMENT*.
With REM, REM is an actual command which basically says, "Hey, everything past this point is a comment!"
With ' (the single quote), ' is PART of the comment itself, and is basically excluded from your code.
A subtle difference, but one which can have drastic effects upon a program. Let's take the following code for example:
Code: (Select All)
IF foo THEN REM foo is a make-believe variable for my example!
Code: (Select All)
IF foo THEN 'foo is a make-believe variable for my example!
Now, at first glance, those two statements look *exactly* alike. They're not.
The first code box contains a single-line IF statement, whereas the second code box contains the start of a multi-line IF statement. You're going to have to put an END IF in the second code box, or else run into all sorts of errors in your code.
WHY??
Because you ended the first IF statement with a command. Sure, it's a command which says, "A comment is coming next," but it's still a command. Think of it just like you would: IF foo THEN PRINT. That command (REM, in this case) is enough to close up that IF statement and make it a valid single-line statement.
On the other hand, the second segment of code is basically just IF foo THEN.... Then WHAT?? You're not telling that IF statement what to do on that line, so it's got to be a multi-line IF statement.
REM is a *COMMAND*, just like GOTO, PRINT, and all the other commands in the language. It's just a command which says, "Comments to the right!"
' (the single quote) is an actual part of a comment, and is basically ignored when used as one inside your programs. It's not a command, and that's the biggest difference -- and it's a significant one -- between the two.
#236, #237, #238, #239, #245 - Several improvements made to the dialog functionality introduced in 3.4.0 - @mkilgore
Single and double quotes can now be used in any string provided to a dialog.
On Windows, the popup from _NotifyPopup will now be associated with the program using the command.
On Windows, _InputBox$ no longer spawns a separate process to display the dialog.
Previously some strings passed to the dialog functions were not properly escaped before being passed to the underlying dialog provider, those issues have been fixed.
Can meta commands such as option base 0 or 1 or option _explicit be set to only affect the main program and not the included libraries? If not, be a cool addition to the IDE instead of being forced to be using the defaults.