Batch Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 3
Goto page: 1, 2, 3  >
BG.exe v2.8 Utility
Author Message
Reply with quote
Post BG.exe v2.8 Utility 


Documentation.txt
Quote:

BG v2.8 (ansi)

BG.EXE is a tool for print text color in cmd.exe. It accepts regular expressions for print ascii characters. It also have useful functions.

::::: Parameters :::::

Kbd
::Wait until you press any key, and returns the ascii code.
::If an extended key was pressed, returns the second code plus 255. Example. If you pressed the up arrow (224, 72) returns 327 (72+255).

_Kbd
::If any key was pressed, returns the ascii code, else return 0.
::If the key pressed is extended, it returns the second code plus 255. Example. If you pressed the up arrow (224, 72) returns 327 (72+255).

Mouse
::Wait until you press primary button into console area.
::When you press a valid button of mouse print:
:: rowNumber colNumber

Time
::Print eight numbers, separated by a space, that corresponds to the current:
::Year Month Day DayOfWeek Hour Minute Second Milliseconds
::
::Year value is from 1601 to 30827
::Month value is from 1 to 12
::Day value is from 1 to 31
::DayOfWeek value is from 0 to 6. 0 is Sunday, 1 is Monday, ..., 6 is Saturday
::Hour value is from 0 to 23
::Minute value is from 0 to 59
::Second value is from 0 to 59
::Milliseconds value is from 0 to 999

Cursor 0 | 1 | 25 | 50 | 100
::hide or show cursor of keyboard or change the size.
::0 hide
::1 show
::25 small size
::50 medium size
::100 large size

Font 0 | 1| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
::change the size of font

Maximize
::maximize the console window.

Sleep milliseconds
::do a wait or sleep in milliseconds.

Locate row column
::locate the position of cursor in row and column specified, zero index based.

Play fileName.wav [number]
::play a wav file synchronously, if you specify the number, the sound is played it number times.

Print text
::print text without new line to end. The text is interpreted how regular expression.
::please see the regular expressions in down.

Print color text ...
::print text in color without new line to end. You can repeat arguments.
::the text recognize the next Regular Expressions:
\n print a newline
\\ print \
\Number A hexadecimal ascii number code from 00 to FF else the character printed is undefined.
Example: \1 is face character
Example: \41 is A
Note 2: You can repeat arguments.
Example: BG.exe Print A "Text in color A" B "Text in color B"

Sprite row column [color text ...]
::Begin printing of colored text in the row and col (zero index based). The column is fixed.
::The regular expression: \n is for jump to the next row and the fixed column.
::The regular expression: \0 is for not print any character (transparent).
::Example Code:
Color 07
Set "spi=A \20\20\DB\20\20\20\20\20\DB\20\20\n"
Set "spi=%spi%\20\20\20\DB\20\20\20\DB\20\20\20\n"
Set "spi=%spi%\20\20\DB\DB\DB\DB\DB\DB\DB\20\20\n"
Set "spi=%spi%\20\DB\DB E \DB A \DB\DB\DB E \DB A \DB\DB\20\n"
Set "spi=%spi%\DB\DB\DB\DB\DB\DB\DB\DB\DB\DB\DB\n"
Set "spi=%spi%\DB\20\DB\DB\DB\DB\DB\DB\DB\20\DB\n"
Set "spi=%spi%\DB\20\DB\20\20\20\20\20\DB\20\DB\n"
Set "spi=%spi%\20\20\20\DB\DB\20\DB\DB\20\20\20"
BG.exe Sprite 2 2 %spi%
Pause >Nul

::::: Colours :::::
[background]foreground

colours values is a one hexadecimal (0123456789ABCDEF) digit for each concept.

0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White




You can download bg tool at: http://code.google.com/p/bg-tool/

Sokobox.cmd
//batch game of puzzles
Link: Sokobox




Last edited by carlos on Sat 24 Aug 2013 - 06:26; edited 45 times in total
Post Publicité 
PublicitéSupprimer les publicités ?


Reply with quote
Post BG.exe v2.8 Utility 
Great, as always. Okay
But what changes with the one we used before?





______________________________________________________
Reply with quote
Post BG.exe v2.8 Utility 
Hi
So cool thinks for sharing Okay




Visit poster’s website
Reply with quote
Post BG.exe v2.8 Utility 
respectly to changes I changed lightly the code of hexnuts.cmd but coming soon i will public a new version of bg. I realized that is not necessary get dinamic memory in the function of replace the regular expression of text.



Reply with quote
Post BG.exe v2.8 Utility 
Clear.
I public the new version of bg.exe: 1.1
It now is more speedy than the older, because i avoid a avoidable dynamically memory petition and with this also a avoidable travel on an avoidable array.
This executable version is more small than older.

version 1.1: 4392 bytes
version 1.0: 4406 bytes




Last edited by carlos on Tue 1 Nov 2011 - 16:47; edited 1 time in total
Reply with quote
Post BG.exe v2.8 Utility 
Thanks a lot Carlos Okay




______________________________________________________
Faites paraitre votre batch sur BatchClipboard
Visit poster’s website
Reply with quote
Post BG.exe v2.8 Utility 
Thanks.
I improved the code again. Now the executable is more faster and smaller than older.

version 1.2: 3880 bytes
version 1.1: 4392 bytes
version 1.0: 4406 bytes




Last edited by carlos on Tue 1 Nov 2011 - 16:39; edited 1 time in total
Reply with quote
Post BG.exe v2.8 Utility 
Finally, I improved the code again (now version 1.3), particullarly the mouse function and a other minor changes. The size of the new executable is equal to previous, but is better than it.

version 1.3: 3880 bytes
version 1.2: 3880 bytes
version 1.1: 4392 bytes
version 1.0: 4406 bytes




Reply with quote
Post BG.exe v2.8 Utility 
I rewrited the function print_regular_str and now the utility is more speed.
I think that this (v1.4) is the final version.

version 1.4: 3880 bytes
version 1.3: 3880 bytes
version 1.2: 3880 bytes
version 1.1: 4392 bytes
version 1.0: 4406 bytes




Reply with quote
Post BG.exe v2.8 Utility 
thanks a lot Carlos, Great Job !




______________________________________________________
Faites paraitre votre batch sur BatchClipboard
Visit poster’s website
Reply with quote
Post BG.exe v2.8 Utility 
Thanks Laddy for thanks.

Because I found a litttle bug in bg v1.4 I updated the software. Also I publish the new version of hexnuts (1.3.0). In this new bg (v1.5) also the executable is more small because I do some improvements to the code.

version 1.5: 3863 bytes
version 1.4: 3880 bytes




Reply with quote
Post BG.exe v2.8 Utility 
Thanks is good =)




______________________________________________________
Un petit 'like' ? Pour ma page ? PLZZZZZ Bannir
Liste de mes DDL
Reply with quote
Post BG.exe v2.8 Utility 
Thanks.
Updated again.

In new version 1.6, the code is more clear and executable is smaller than olds:

version 1.6: 3803 bytes

and a function "Print" was added for print using regular expression, but without specifing color.




Last edited by carlos on Tue 10 Apr 2012 - 06:38; edited 2 times in total
Reply with quote
Post BG.exe v2.8 Utility 
Hello !

nice job Carlos Okay

I was wondering which C compiler you use ...
Because using gcc i can't get smaller executable than approximately 5 kio
Maybe it's gcc initialization routine fault, which seems not be optimised Embarassed

Anyway could you tell me how to get small executables ?

thanks





______________________________________________________
--
> Que pensez vous de l'ajout du repertoire point dans $PATH ?
Ma version de troll 18.0.32 beta 3 vient de me faire un core dump.
-+- SE in Guide du Linuxien Pervers : Bien développer son troll -+-

[Dos9]
Visit poster’s website Skype
Reply with quote
Post BG.exe v2.8 Utility 
Darkbatcher wrote:
Hello !

nice job Carlos Okay

I was wondering which C compiler you use ...
Because using gcc i can't get smaller executable than approximately 5 kio
Maybe it's gcc initialization routine fault, which seems not be optimised Embarassed

Anyway could you tell me how to get small executables ?

thanks


Thanks.

For small executables, this is "my" method:

-Programming in c, optimizing the code.
-Compile the code with Tiny C Compiler: http://bellard.org/tcc/
-Optionally, you can try a PE Rebuilder tool.

For optimizing the code for small executable. I learning this:

-Choose the function that generate less bytes: For example, is more small and speedy use puts("text") instead printf("text\n").
-Try replace calls to small functions, writing probably code. Example: use if (mychar >= '0' && mychar <= '9') instead of is_digit(mychar).
-Writing the code with the best optimization mode avoiding all unnecesary writes. I optimizing bg many times, and I found that my old code could be written better. For example, write : unsigned int i = 0; while (text[i] != '\0') {++i} instead: unsigned int i; unsigned int max=strlen(text); for (i=0; i < max; ++i) {}. Using first you avoid the variable max, and call to function strlen. All this generate less bytes and even small executable. Also you win speed.




Display posts from previous:
Reply to topic Page 1 of 3
Goto page: 1, 2, 3  >
  



Index | Getting a forum | Free support forum | Free forums directory | Report a violation | Conditions générales d'utilisation
Copyright 2013 - Batch - tout droits réservées - par Sh0ot PageRank Actuel