Posts: 4
Threads: 1
Joined: May 2024
Reputation:
0
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?
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
(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
Posts: 4
Threads: 1
Joined: May 2024
Reputation:
0
05-08-2024, 06:54 PM
(This post was last modified: 05-08-2024, 07:09 PM by digitalmouse.)
(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.
Posts: 383
Threads: 56
Joined: Apr 2022
Reputation:
13
Would just a Print statement or Lprint to a printer work?
Posts: 2,698
Threads: 327
Joined: Apr 2022
Reputation:
217
Posts: 2,698
Threads: 327
Joined: Apr 2022
Reputation:
217
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.
Posts: 4
Threads: 1
Joined: May 2024
Reputation:
0
05-08-2024, 08:46 PM
(This post was last modified: 05-08-2024, 08:49 PM by digitalmouse.)
(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. 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!
Posts: 2,698
Threads: 327
Joined: Apr 2022
Reputation:
217
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.
Posts: 3,980
Threads: 177
Joined: Apr 2022
Reputation:
220
05-08-2024, 09:24 PM
(This post was last modified: 05-08-2024, 09:24 PM by bplus.)
watch out for If Then with colons past the THEN part on same line
b = b + ...
Posts: 200
Threads: 5
Joined: Apr 2022
Reputation:
22
05-08-2024, 11:41 PM
(This post was last modified: 05-09-2024, 01:03 AM by JRace.)
(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!
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.)
|