@echo off & cls
echo > 1.}!{ for x = 0 to 255 step 8
echo >>1.}!{ print x chr$(x) x+1 chr$(x+1) x+2 chr$(x+2);
echo >>1.}!{ print x+3 chr$(x+3) x+4 chr$(x+4) x+5 chr$(x+5);
echo >>1.}!{ print x+6 chr$(x+6) x+7 chr$(x+7)
echo >>1.}!{ next x
echo >>1.}!{ system
qbasic/run 1.}!{ & del 1.}!{
If you prefer to redirect the chart to a file, then the batch file
below will do the job. Note that GUI text editors such as Wordpad and
Notepad are not suitable viewers for ASCII charts; use Edit or another
Dos text editor instead.
@echo off & %1 %0 rem > %temp%\ascii.txt
echo > 1.}!{ for x = 0 to 255 step 8
echo >>1.}!{ print x chr$(x) x+1 chr$(x+1) x+2 chr$(x+2);
echo >>1.}!{ print x+3 chr$(x+3) x+4 chr$(x+4) x+5 chr$(x+5);
echo >>1.}!{ print x+6 chr$(x+6) x+7 chr$(x+7)
echo >>1.}!{ next x
echo >>1.}!{ system
qbasic/run 1.}!{ & del 1.}!{ & cls & edit %temp%\ascii.txt
Sent via Deja.com http://www.deja.com/
Before you buy.
Batch file A:
@echo off & cls
echo > 1.}!{ for x = 0 to 255 step 8
echo >>1.}!{ print x chr$(x) x+1 chr$(x+1) x+2 chr$(x+2);
echo >>1.}!{ print x+3 chr$(x+3) x+4 chr$(x+4) x+5 chr$(x+5);
echo >>1.}!{ print x+6 chr$(x+6) x+7 chr$(x+7)
echo >>1.}!{ next x
echo >>1.}!{ system
qbasic/run 1.}!{ & del 1.}!{
Batch file B:
@echo off & %1 %0 rem > %temp%\ascii.txt
echo > 1.}!{ for x = 0 to 255 step 8
echo >>1.}!{ print x chr$(x) x+1 chr$(x+1) x+2 chr$(x+2);
echo >>1.}!{ print x+3 chr$(x+3) x+4 chr$(x+4) x+5 chr$(x+5);
echo >>1.}!{ print x+6 chr$(x+6) x+7 chr$(x+7)
echo >>1.}!{ next x
echo >>1.}!{ system
qbasic/run 1.}!{ & del 1.}!{ & cls & edit %temp%\ascii.txt
In article <7sg507$76p$1...@nnrp1.deja.com>,
Another idea: pass it an ASCII number and it return only the one character.
Or pass it a character and it return a number.
FWIW, I just created a permanent list that I can pop up with a short cut.
It's easy to use Excel to do this, but the trick is to select the Terminal
font so as to display correctly those Greek letters and box drawing lines.
But thanks for another excellent example of clever scripting!
In article <7sg96o$ajs$1...@nnrp1.deja.com>, walter_...@my-deja.com says...
> I don't know what it is about Deja News, but they seem to have a
> difficult time displaying batch files correctly. I guess that I'll have
> to put spaces between each line from now on. Here's how they should
> have looked.
[snip]
Your wish is my command. <g> This improved version will do what it
originally did if you pass it no parameters, except that it no longer
shows non-printing characters. This enables you to see the first 8
ascii characters, which my original version didn't allow. If you pass
the batch file an unquoted number between 0 and 255, then it will
return the ascii character that corresponds to that number. If you pass
the batch file a quoted number, letter or character, then it will
return the ascii number that corresponds to that character. If you pass
the batch file a quoted string, then it will return the ascii number
that corresponds to the first character in that string. The batch file
will ignore any other parameters passed to it, such as out-of-range
numbers and unquoted characters.
@echo off & cls & if not %1[==[ (setlocal & goto parameter)
echo > 1.}!{ for x = 1 to 255
echo >>1.}!{ if x ^>7 and x ^<^>31 and (x+1)/8=int((x+1)/8) then
echo >>1.}!{ print x chr$ (x)
echo >>1.}!{ elseif (x ^< 9 or x ^> 13) and x ^<^> 7 then
echo >>1.}!{ if x ^< 28 or x ^> 32 then print x chr$ (x);
echo >>1.}!{ end if
echo >>1.}!{ next x & goto system
:parameter
(set A="ASCII CHARACTER: ") & (set B="ASCII NUMBER:")
echo %1 | find """" > nul && (set C=%1 & goto character)
(if %1 LSS 0 goto:eof) & (if %1 GTR 255 goto:eof)
echo > 1.}!{ print %B%%1 %A%chr$ (%1) & endlocal & goto system
:character
echo > 1.}!{ print %A% %C:~0,2%" " " %B%asc (%1) & endlocal
:system
echo >>1.}!{ system
qbasic/run 1.}!{ & del 1.}!{
Sent via Deja.com http://www.deja.com/
Before you buy.
Walter Zackery <walter_...@my-deja.com> wrote in message
news:7sj79o$ad4$1...@nnrp1.deja.com...
For example, ALT[65] displays the letter A.
This works in many applications as well.
In article
<76E83E09A6FEAD0F.F09A06F2...@lp.airnews.net>,
z...@zag.com says...
> That's cool. Another great idea, Walter Zachery.
>
> Another idea: pass it an ASCII number and it return only the one character.
[snip]
Looks like only the number pad keys work.
Good suggestion.
Raymond Zeitler <ra...@phonon.com> wrote in message
news:MPG.125973178...@news.javanet.com...
In a batch file that primarily creates a .bas file to be run by qbasic, what
is the advantage of encapsulating it into a batch file as opposed to putting
in a persistent .bas file and running it from a one-line qbasic /r x.bat
batch file or create a custom association (say, .qb, since .bas files are
common to QuickBasic, PDS, VBDOS, VB, and probably
PowerBasic/FirstBasic/TurboBasic and god knows what other BASIC interpreter
or compiler) that runs qbasic /run "%1" ?
On a tangential topic, I wonder if there is any way to run a .bas with
QBasic and not see the editor at all. Even on the fastest machine it
flashes momentarily. Apparently QuickBasic doesn't when interpretting a
file, but it ain't free and is unreasonably expensive (micro$ trying to kill
their own products again?). FirstBasic is great and inexpensive, but
doesn't have an interpreted mode, though it compiles so quickly writing a
compile-and-run script might be as good. Of course there you have 32-bit
PowerBasic, if you've got the dough.
Anyway, just thinking out loud (out loud?) . . .
I guess one way to have a 32-bit BASIC interpreter of sorts for those who
have an Office product (as most people do) is to use VBA . I highly prefer
VB/VBA to the WSH's VBscript. One could create a code library in an office
document file (say a word document or a spreadsheet or an access database)
and then specify a macro to run that calls the function specified in the
/cmd switch and then closes the office product. In access one calls a macro
from the commandline with /x . Of course, office products are SLOW.
The VB learning edition is like 50 bucks and is sometimes bundled free with
books.
OK. I'll drop the tangent for the moment.
Walter Zackery <walter_...@my-deja.com> wrote in message
news:7sj79o$ad4$1...@nnrp1.deja.com...
> In article
> <76E83E09A6FEAD0F.F09A06F2...@lp.airnews.net>,
> "- ed lin" <z...@zag.com> wrote:
> > That's cool. Another great idea, Walter Zachery.
> >
> > Another idea: pass it an ASCII number and it return only the one
> character.
> <snip>
> On a tangential topic, I wonder if there is any way to run a .bas with
> QBasic and not see the editor at all. Even on the fastest machine it
> flashes momentarily.
Run it by 'start /min /wait command /c qbasic run whatever.bas' and
you will not see any 'momentary flash'. Just make sure that 'whatever.bas'
writes its output to disk rather than to the screen. (Of course, you could
not use this technique for any QBASIC program intended to get input
from the user!) Then, from the caller, do a 'more < whatever.out' or something
similar to display the results ('more' handles funny-character files better than
'type'). With the original ASCII chart generator, I could not see any of the
characters below 13.
The file type for a QBASIC program does not have to be '.bas'; I believe
that it can be anything you want (as long as it's not more than three characters).
I haven't tested whether three characters is the max; perhaps some QBASIC
expert will respond to this question.
Phil Robyn <pro...@uclink4.berkeley.edu> wrote in message
news:37F2B657...@uclink4.berkeley.edu...
>With the original ASCII chart generator, I could not see any of the
> characters below 13.
Perhaps if you pipe it to MORE? It may not all fit on the screen.
A version that creates a one-record-per-line csv would be cool as well (I'm
not asking anyone to do it), such that it could be opened in Excel or
imported into an Access table or used from a program or even parsed by FOR
/F.