also i need to know how to make limitation for characters in line or space.
for example:
Money: 50 | HP: 100 | Some text.
when money rising to 10,000 the HP getting out of the screen. i want to make limitation number of character.
Thnx


Moderator: DosItHelp
I've seen batbox do this, and I can pretty much guarantee that misol101 will come in here and tell you to use cmdgfx. That said, if you're looking for actual buttons like
Use substrings (https://www.dostips.com/DtTipsStringOpe ... LeftString) to crop the text on the end.
Code: Select all
@PowerShell -Command^
"[Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')|Out-Null;"^
"[System.Windows.Forms.MessageBox]::Show('Money: 50 | HP: 100 | Some text')">Nul]
Code: Select all
@PowerShell -Command^
"[Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')|Out-Null;"^
"[System.Windows.Forms.MessageBox]::Show(\"Money: 50`nHP: 100`nSome text\")">Nul
Code: Select all
@Start "Inventory" /Wait Cmd /Q /C "Mode 16,7&Color 5E&Echo(&Echo Money: 50&Echo HP: 100&Echo(&Echo SomeText&Echo(&Timeout 5 >Nul"
Code: Select all
@echo off &setlocal
:: print the buttons (I used ASCII characters to make sure everybody sees the same independing on locale settings)
echo(
echo @@@@@@@
echo @@ A @@
echo @@@@@@@ @@@@@@@
echo @@ C @@
echo @@@@@@@ @@@@@@@
echo @@ B @@
echo @@@@@@@
echo(
echo click on a button
echo(
:: label where to jump in order to run conin again
:loop
:: conin.exe - Read Console Input
:: timeout: %errorlevel% = 0
:: type: %errorlevel%>>29 (0=keyboard, 1=left click, 2=right click, 3=mouse move)
:: key: %errorlevel% (either character code or (for extended keys) 256 + key code)
:: mouse: row = (%errorlevel%>>14)&0x3FFF, column = %errorlevel%&0x3FFF
:: the utility times out after the passed number of milliseconds, it will wait infinite if you don't pass an argument
conin.exe
:: calculate the values according to the explanation above
set /a "key=%errorlevel%, type=key>>29, y=(key>>14)&0x3FFF, x=key&0x3FFF"
:: if the input type was not 1 (left mouse click) then run conin again
if %type% neq 1 goto loop
:: else call a subroutine to check if a button was clicked; each passed group of values represents a button and consists of:
:: "top_left_corner_horizontal_offset,top_left_corner_vertical_offset,bottom_right_corner_horizontal_offset,bottom_right_corner_vertical_offset"
:: note that the coordinates are zero-based (that is, the top left corner of the window has coordinates 0,0 and is the origin of the button coordinates)
:: the subroutine returns 0 if the click was outside of any button rectangles (run conin again in that case),
:: otherwise it returns the index of the matched group (1 for the first group, 2 for the second group, etc.)
call :check "1,1,7,3" "6,5,12,7" "17,3,23,6" && goto loop
:: assign the returned index to a variable
set "n=%errorlevel%"
echo button #%n% clicked
pause
exit /b
:check
setlocal EnableDelayedExpansion
set "idx=1"
:: enumerate all passed value groups and check if the x and y coordinates of the mouse click fits into one of the rectangles
for %%i in (%*) do (
for /f "tokens=1-4 delims=, " %%j in (%%i) do (
if %x% geq %%j if %y% geq %%k if %x% leq %%l if %y% leq %%m for %%n in (!idx!) do (endlocal&exit /b %%n)
)
set /a "idx+=1"
)
endlocal
exit /b 0