Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
control characters in Change dialog box
#1
Greetings, Programs!

Is there a table or list published somewhere (forum, wiki, etc.) that shows the 'control codes', characters, or tokens needed to use characters typically invisible - such as carriage returns, linefeeds, or tabs, for example - in the 'Change...' dialog box in the IDE?
Reply
#2
(05-08-2024, 06:33 PM)digitalmouse Wrote: Greetings, Programs!

Is there a table or list published somewhere (forum, wiki, etc.) that shows the 'control codes', characters, or tokens needed to use characters typically invisible - such as carriage returns, linefeeds, or tabs, for example - in the 'Change...' dialog box in the IDE?
Look here: Control Characters
Reply
#3
(05-08-2024, 06:45 PM)Kernelpanic Wrote:
(05-08-2024, 06:33 PM)digitalmouse Wrote: Greetings, Programs!

Is there a table or list published somewhere (forum, wiki, etc.) that shows the 'control codes', characters, or tokens needed to use characters typically invisible - such as carriage returns, linefeeds, or tabs, for example - in the 'Change...' dialog box in the IDE?
Look here: Control Characters
ahh!  right in the wiki and somehow i missed it.  thanks!

addendum: very useful in general, but does not seem to apply to the 'Change...' dialog box.

CTRL + M (or CHR$(13) -> Carriage Return) does not work as expected, ie., replacing a matched character ':' with a Carriage Return.
Reply
#4
Would just a Print statement or Lprint to a printer work?
Reply
#5
https://qb64phoenix.com/qb64wiki/index.php/CONTROLCHR <-- that's what you're looking for.
Reply
#6
Note that only *some* of the control characters are possible to be used in the IDE, as some are used for formatting and such. 

CHR$(13), for instance, is a CRLF character and denotes the end of a line in the IDE.  It can't be BOTH a musical note (I think 13 is the musical note?) and a CRLF character.  TAB counts as a tabbed space, so it can't represent the diamond symbol.  There may be a few others reserved, but I'm not 100% certain what they are off the top of my head.

To use these characters inside the IDE, it's generally advised to use CHR$(value) for whichever of the ASCII control codes you want to deal with.

To manuually insert them (if they work and aren't reserved and perform some IDE function), you can try to use ALT-num_code to type them into the IDE.  For example, to add the female sex symbol (CHR$(12)), hold down ALT, and with it held, press 1 then press 2.  ALT - 1 - 2...   Release ALT and the symbol should appear.

NOTE:  Just because the IDE may accept the character, doesn't mean you're out of the woods with issues yet.  Saving/Loading may convert some control characters (like tab to spaces) that the IDE would otherwise handle just fine.

It's really not a good idea to use ASCII codes from 0 to 31 directly inside the IDE.  It's much better to use CHR$(num) instead.  You were warned here first.  Smile
Reply
#7
(05-08-2024, 08:28 PM)SMcNeill Wrote: Note that only *some* of the control characters are possible to be used in the IDE, as some are used for formatting and such. 

CHR$(13), for instance, is a CRLF character and denotes the end of a line in the IDE.  It can't be BOTH a musical note (I think 13 is the musical note?) and a CRLF character.  TAB counts as a tabbed space, so it can't represent the diamond symbol.  There may be a few others reserved, but I'm not 100% certain what they are off the top of my head.

To use these characters inside the IDE, it's generally advised to use CHR$(value) for whichever of the ASCII control codes you want to deal with.

To manuually insert them (if they work and aren't reserved and perform some IDE function), you can try to use ALT-num_code to type them into the IDE.  For example, to add the female sex symbol (CHR$(12)), hold down ALT, and with it held, press 1 then press 2.  ALT - 1 - 2...   Release ALT and the symbol should appear.

NOTE:  Just because the IDE may accept the character, doesn't mean you're out of the woods with issues yet.  Saving/Loading may convert some control characters (like tab to spaces) that the IDE would otherwise handle just fine.

It's really not a good idea to use ASCII codes from 0 to 31 directly inside the IDE.  It's much better to use CHR$(num) instead.  You were warned here first.  Smile
Thanks for the info.

The point was to take a compressed 5-line game "5 line engine' published in the games section of the forum that is strung together with : separators and 'decompress' it by globally doing a search-n-replace of the : with a Carriage Return character in 'Change...' dialog box.  So that I don't have to manually replace 50+ matches by hand. Computers should do that, not me! Big Grin
Reply
#8
Code: (Select All)
Open "program_name.bas" For Binary As #1
Open "expanded_program_name.bas" For Output As #2
Do Until EOF(1)
    Line Input #1, temp$
    While InStr(temp$, ":")
        o$ = Left$(temp$, InStr(temp$, ":") - 1)
        Print #2, o$
        temp$ = Mid$(temp$, InStr(temp$, ":") + 1)
    Wend
    Print #2, temp$
Loop
close

Wouldn't a simple translator like this work the best?  Read the file, convert the : into CRLF.

As long as there's no : in quotes, it should work without any issues.  Otherwise, you'll have to expand it to do some logic checking to see if it's in quote or not.
Reply
#9
watch out for If Then with colons past the THEN part on same line
b = b + ...
Reply
#10
(05-08-2024, 08:46 PM)digitalmouse Wrote: The point was to take a compressed 5-line game "5 line engine' published in the games section of the forum that is strung together with : separators and 'decompress' it by globally doing a search-n-replace of the : with a Carriage Return character in 'Change...' dialog box.  So that I don't have to manually replace 50+ matches by hand.  Computers should do that, not me! Big Grin

Unless you're dead-set on coaxing the PE IDE to do it, Notepad++ & SciTE/Sc1 (and probably many other editors) can make such changes.

(Of course, Steve's programmatic method might be more fun.)


screenshot of Notepad++ set to replace colon with cr/lf:
   


(BTW, although Notepad++ is my daily driver, Sc1 (available from Scintilla's SciTE download page) makes a great backup editor.  In a nutshell, it is a SciTE installation (all 120 or so files) packed into a single .EXE.  It seems to be impossible to reconfigure in that state, but it comes in handy sometimes.)
Reply




Users browsing this thread: 4 Guest(s)