Batch Index du Forum
S’enregistrerRechercherFAQMembresGroupesConnexion
Répondre au sujet Page 5 sur 5
Aller à la page: <  1, 2, 3, 4, 5
[Final][Rolling] Darkbox - TSnake41
Auteur Message
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Revue du message précédent :

You can't have those values without the "launcher", because darkbox -i need a pipe in the STDIN constantly active with cmd.exe.

Else, you may use an another method less optimized, like that :
Code:

@Echo off
if defined __ goto :mouse
set __=.
call %0 %* | darkbox
set __=
pause>NUL
goto :eof

:mouse
echo -sh 0
set old_X=0
set old_Y=0

:loop
for /f "tokens=1,2,3" %%A in ('darkbox_i -y') do (
    set X=%%A
    set Y=%%B
    set C=%%C
)

if %C% EQU 0 set C=F

echo -gra %old_X% %old_Y% 32
echo -gcarw %X% %Y% 0x%C%0 32 0

set old_X=%X%
set old_Y=%Y%
goto :loop


There is the file "Mouse_s.bat" inside the Test folder in the archive pack, with this method, you'll call once time the input engine, but it very less optimized because if you repeat this action a lot of time (like in a goto loop), the start-up's and the close up's input engine time will be added (as load DLL), and Windows detest open and close quickly programmes.
So I don't very recommand to use this method, the best is to use the "launcher"

Bye Wink

EDIT :
You can also put this (I think it's more as like you want) :
Code:

@Echo off
setlocal enabledelayedexpansion
if defined __ goto :it
set __=.
call %0 %* | darkbox
set __=
goto :eof
 
:it
darkbox -i | set /p i=
for /f "tokens=1-4" %%A in ("%i%") do (
echo;Type Input : %%A
echo;%%B %%C %%D
)> CON
goto it


It still less optimized that the first method


Visiter le site web du posteur Skype
Message Publicité 
PublicitéSupprimer les publicités ?


Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Xenoxis a écrit:
You can't have those values without the "launcher", because darkbox -i need a pipe in the STDIN constantly active with cmd.exe.

Else, you may use an another method less optimized, like that :
Code:



@Echo off
if defined __ goto :mouse
set __=.
call %0 %* | darkbox
set __=
pause>NUL
goto :eof

:mouse
echo -sh 0
set old_X=0
set old_Y=0

:loop
for /f "tokens=1,2,3" %%A in ('darkbox_i -y') do (
    set X=%%A
    set Y=%%B
    set C=%%C
)

if %C% EQU 0 set C=F

echo -gra %old_X% %old_Y% 32
echo -gcarw %X% %Y% 0x%C%0 32 0

set old_X=%X%
set old_Y=%Y%
goto :loop




There is the file "Mouse_s.bat" inside the Test folder in the archive pack, with this method, you'll call once time the input engine, but it very less optimized because if you repeat this action a lot of time (like in a goto loop), the start-up's and the close up's input engine time will be added (as load DLL), and Windows detest open and close quickly programmes.
So I don't very recommand to use this method, the best is to use the "launcher"

Bye Wink

EDIT :
You can also put this (I think it's more as like you want) :
Code:



@Echo off
setlocal enabledelayedexpansion
if defined __ goto :it
set __=.
call %0 %* | darkbox
set __=
goto :eof
 
:it
darkbox -i | set /p i=
for /f "tokens=1-4" %%A in ("%i%") do (
echo;Type Input : %%A
echo;%%B %%C %%D
)> CON
goto it





It still less optimized that the first method




Thanks a lot for your time Xenoxis,


I think I tried all mouse and keyboard examples inside the dist-package, but they're not exactly the solution I'm looking for.
As fas as I can understand from your answer is that I have to run my WHOLE PROJECT inside the launcher.
As far as I understand, there's no way to get the values from the "launcher" to the regular "main" program.

I understood this right or wrong?

Is there any hope that a (DARKBOX_i -i) or (DARKBOX_i -m_) will see the light one day?
The launcher is a great tool, but then I've to restart my project, now it's a pure graphical srcreen.
I'm using insertBMP which I'm not able to make it work in the laucher.
 I tried to show a picture of it, but I don't know how to insert a printscreen in this forum.
Hans



Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Yeah you understood right.

Your unexpected result it's because you use shouldn't not quit the launcher.

I will edit my post later to show you an alternative launcher Okay




______________________________________________________
Coucou, tu veux voir mon Site Web ?? Mort de Rire
Visiter le site web du posteur Skype
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Xenoxis a écrit:
Yeah you understood right.

Your unexpected result it's because you use shouldn't not quit the launcher.

I will edit my post later to show you an alternative launcher Okay


Merci pour ton aide,

My problem is easy, I try to create a graphical batch interface with filters and pictures to launch old games with DOSBOX, scumm and Windows.
Therfore I need the interface between windows and my batch file, if not, I cannot launch the external programs.

All filters (Dosbox/Windows/Flash - Language - Colors etc) are mouse driven, now I want to finish the Text-filter and therefore I need
the keyboard.

It looks pretty nice and it works OK, just the text-filter is not OK.

Je te remerci pour toute aide.

Hans



Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Oh it look very nice ! Good Job ! Okay

And now I think I understand a little bit more what you expect. You want to click on the box's filter and wait for a user's string.
So I recommand to you to use darkbox_i.exe, inside your main loop, you should use it for mouse input, defined the hitbox of the box filter, and when you click on it, it will go
to an another label witch wait for an input, and when you have press ENTER, it back to main loop.

I don't have time to make to you an example, but I know you'll understand and do a correct code Wink




______________________________________________________
Coucou, tu veux voir mon Site Web ?? Mort de Rire
Visiter le site web du posteur Skype
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Xenoxis a écrit:
Oh it look very nice ! Good Job ! Okay

And now I think I understand a little bit more what you expect. You want to click on the box's filter and wait for a user's string.
So I recommand to you to use darkbox_i.exe, inside your main loop, you should use it for mouse input, defined the hitbox of the box filter, and when you click on it, it will go
to an another label witch wait for an input, and when you have press ENTER, it back to main loop.

I don't have time to make to you an example, but I know you'll understand and do a correct code Wink


Thanks, yes I think it's pretty nice, it's fully interactive with icons and picture updates by mouse-click.
it's amazing what you can do in a batch file!!! Shocked Shocked Mr. Green

Yeah, that's exactly what I'm doing now, only now I do it with batbox.
My (small) problem is that, as you understood well, now I have to block the mouse-input.
I have to wait for a keystroke like "ENTERT" to re-activate the mouse.
 I would like that you can enter the key-filter in an on-the-fly mode. This would be possible if I could use a loop with "darkbox_i /m_" in serial with "darkbox_i /k_".
The problem is that "batbox /m" exists but is blocking all key-strokes.

So I contacted Darkbatcher, who indicated me the darkbox solution.

I was very happy Razz to find the "darkbox /i", but I cannot get back the values inside my main program, also it's not working for me. Evil or Very Mad

I don't know if TSnake41 can change a bit his program; either add "darkbox_i /i" or "darkbox_i /m_"
Perhaps it can be done with cbatbox.
Would be nice if somebody could tell me if there's some hope in the near future.

Anyway, thanks for your time and your patience.

Hans



Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
As I understand, you would like to add text-input in your program.
The problem is very hard to resolve because darkbox -i replaces 'set /p' behavior that gives you raw input.

However, we can parse this raw input to a text line like regular 'set /p'.

For example (proof of concept) :
Code:
@Echo off
setlocal enabledelayedexpansion
if defined __ goto :main
set __=.
darkbox -ik | call %0 %* | darkbox
set __=
goto :eof

:main
<nul set /p =-d "Type something : "
call :readline
echo !str!>test.txt
goto :eof

:readline
set "__b= "
:_rl_loop
set /p __i=
for /f "tokens=1,2" %%A in ("!__i!") do (
  if %%A==m goto :_rl_loop
  if %%B==13 goto :_rl_end
  if %%B==10 goto :_rl_end
  echo -a %%B
  set "__b=!__b! %%B"
)
goto :_rl_loop
:_rl_end
call :db_tostring %__b%
goto :eof

:db_tostring
set "__b=%*"
set __c=0
for %%A in (%__b%) do set /a __c+=1
for /f "delims=" %%a in ('echo -!__c!a !__b! -q^|darkbox') do set "str=%%a"
goto :eof
It works, but do not take care of most keyboard control keys (insert, delete, backspace, home, end, ...) and print weird stuff with non-printable keys (Maj, F1-12, Ctrl, ...).




______________________________________________________
Partager permet le savoir. Le savoir permet de partager de nouveau savoirs.
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
TSnake41 a écrit:
As I understand, you would like to add text-input in your program.
The problem is very hard to resolve because darkbox -i replaces 'set /p' behavior that gives you raw input.

However, we can parse this raw input to a text line like regular 'set /p'.

For example (proof of concept) :
Code:


@Echo off
setlocal enabledelayedexpansion
if defined __ goto :main
set __=.
darkbox -ik | call %0 %* | darkbox
set __=
goto :eof

:main
<nul set /p =-d "Type something : "
call :readline
echo !str!>test.txt
goto :eof

:readline
set "__b= "
:_rl_loop
set /p __i=
for /f "tokens=1,2" %%A in ("!__i!") do (
  if %%A==m goto :_rl_loop
  if %%B==13 goto :_rl_end
  if %%B==10 goto :_rl_end
  echo -a %%B
  set "__b=!__b! %%B"
)
goto :_rl_loop
:_rl_end
call :db_tostring %__b%
goto :eof

:db_tostring
set "__b=%*"
set __c=0
for %%A in (%__b%) do set /a __c+=1
for /f "delims=" %%a in ('echo -!__c!a !__b! -q^|darkbox') do set "str=%%a"
goto :eof

It works, but do not take care of most keyboard control keys (insert, delete, backspace, home, end, ...) and print weird stuff with non-printable keys (Maj, F1-12, Ctrl, ...).


Hello, thanks for your answer.

As you understood, my whole batch program is graphical and mouse-driven.
Activation of all filters and navigation through the directory are done by the mouse and the "icons".
For every selected program on my HD, I can navigate through several screenprints/pictures.
After selection of a program, I use 7zip to decompress the archive and start the DOSBox program. (Or WIN/FLASH/SCUMM)
Everything is working fine, but my textfilter is not as I like it, now it's working with an "ENTER" to close the filter.

The idea is, when the text-filter is activated, the operator can continue to navigate with the mouse AND can change the text-filter with the keyboard. I try since 1 week to do this job, until now I'm not able to do it, I'm far from a professionnel, just curious.

Now, to use the keyboard, I have to stop the mouse-input.
I'm not able to catch a key-stroke OR a mouse-movement at the same moment.
Your PRG proposition allows to catch a key-stroke on the fly, but I need the mouse-input on the fly.
Your "Darkbox -i" is exactly what I'm looking for but I need it in a regular batch program.
To make running my batch prg, I use several external programs like DOSBOX-7Z-WINRAR-INSERTBMP etc

Thanks anyway

Hans



Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
What you want to do is possible, but is very difficult, expensive in terms of performances and storage (long code).

You'll be hurt to some problems in trying that (like now) !
The best compromise solution is to make an only keyboard input and press "ENTER" to return to the mouse mode, to control other things.

Wink




______________________________________________________
Coucou, tu veux voir mon Site Web ?? Mort de Rire
Visiter le site web du posteur Skype
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Xenoxis a écrit:
What you want to do is possible, but is very difficult, expensive in terms of performances and storage (long code).

You'll be hurt to some problems in trying that (like now) !
The best compromise solution is to make an only keyboard input and press "ENTER" to return to the mouse mode, to control other things.

Wink


Tja, that's the way I did it until this moment.
I'm looking now for an alternative solution, I'm creating a graphic keyboard, so I can forget the key-strokes!!
Then even the text-filter will be driven by the mouse.

I tried, nice for your help. If later an alternative solution is coming, I change it again!!

Cordialement

Hans



Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Mise à jour.

Nombreuses améliorations de la commande socket (que j'expliquerait plus tard, dans un autre topic).

Changements dans l'indentation (4 espaces -> 2 espaces).
Fix d'un bug (oubli) dans choice.exe n'affichant pas le choix par defaut à la fin du timeout.

Changements futurs possibles :
- encore d'autres améliorations de la commande socket
- ajout de -l et -b (autrefois dans darkbox_t) en tant que commandes darkbox
- module de lecture de chaîne de caractère dans darkbox_t (pour faire comme l'original set /p)




______________________________________________________
Partager permet le savoir. Le savoir permet de partager de nouveau savoirs.
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Au risque de passer pour un débile.. db et db_i j'ai compris à quoi ils servent.. mais darkbox_t.. étant donné que je ne l'ai jamais utiliser ni compris, je ne comprend pas la nuance




______________________________________________________
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Sa y est, je me suis enfin mit à darkbox et je dois bien avouer que c'est la meilleurs commande externe possible.
C'est tellement excellent que j'ai même plus l'impression de programmer en batch.

Cependant, il y a une petite chose qui me pose problème :

Quand on veut utiliser la souris et le clavier avec darkbox -i, certaine touche sont "confondue" :

En prenant comme exemple le fichier "knm.bat" de l'archive de darkbox téléchargeable, certaine toucher ont un "code" commun :


Code:
@Echo off
if defined __ goto :knm
set __=.
darkbox -i | %0 %* | darkbox
set __=
pause>NUL
goto :eof

:knm
echo -csh 0x00 0
echo -o 10 10
set K=N/A
set old_X=0
set old_Y=0

:loop
set /p i=
for /f "tokens=1,2,3,4" %%A in ("%i%") do (
    if %%A==m (
        set X=%%B
        set Y=%%C
        set C=%%D
        goto :draw_cur
    )
    if %%A==k (
        set K=%%B
        goto :draw_key
    )
)
goto :loop

:draw_cur
if %C% EQU 0 set C=F
echo -gcdw 0 0 0x9 "lastest key: %K%  " 0

echo -gca %old_X% %old_Y% 0x0f 32
echo -gcaw %X% %Y% 0x%C%0 32 0

set old_X=%X%
set old_Y=%Y%
goto :loop

:draw_key
echo -gcdw 0 0 0x9 "lastest key: %K%  " 0
goto :loop



En gros certaine touche retourne le même code :

[Shift] à le même code que [:]
[MAJ] à le même code que [*]
[Alt] que [8]
[Suppr] que [S]
[F1] que [;]
[->] que [M]
ect....

Y aurait-il un moyen de palier à ce bug ?




______________________________________________________
We're just an accident. We're just bad code. - Root
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Hmm, en réalité, c'est un soucis de collision entre les touches "ascii" et "non-ascii".
C'est du à ça :
Code:
[lang=c]/* Of course, this is an hack */
ie->event.key_press = ir.Event.KeyEvent.uChar.AsciiChar
  ? ir.Event.KeyEvent.uChar.AsciiChar
  : ir.Event.KeyEvent.wVirtualScanCode;
Il faudrait que je regarde de plus prés pour éviter ce soucis (je vais voir pour regarder le getch code source du CRT Windows).

EDIT: J'ai trouvé une solution, je verrais dans la semaine pour m'en occuper.




______________________________________________________
Partager permet le savoir. Le savoir permet de partager de nouveau savoirs.
Répondre en citant
Message [Final][Rolling] Darkbox - TSnake41 
Bad-Code a écrit:
Sa y est, je me suis enfin mit à darkbox et je dois bien avouer que c'est la meilleurs commande externe possible.
C'est tellement excellent que j'ai même plus l'impression de programmer en batch.

Cependant, il y a une petite chose qui me pose problème :

Quand on veut utiliser la souris et le clavier avec darkbox -i, certaine touche sont "confondue" :

En prenant comme exemple le fichier "knm.bat" de l'archive de darkbox téléchargeable, certaine toucher ont un "code" commun :

{{{code teste}}}

En gros certaine touche retourne le même code :

[Shift] à le même code que [:]
[MAJ] à le même code que [*]
[Alt] que [8]
[Suppr] que [S]
[F1] que [;]
[->] que [M]
ect....

Y aurait-il un moyen de palier à ce bug ?
Bon, j'ai trouvé un correctif du bug, cependant, cela pourrait poser problème dans certains cas :
L'ordre de l'entrée console avec darkbox -i est aléatoire (sur Windows).
Par exemple, si on fait un copier coller de "test" dans la console, il peut devenir "ttse" si on refait la transformation code touche -> lettre.

Cependant, ça a permis de corriger le bug.
Dans la nouvelle archive (qu'il y a dans le premier message) a la version corrigée (et aussi les nouvelles fonctionnalités encore buggués sur Windows).




______________________________________________________
Partager permet le savoir. Le savoir permet de partager de nouveau savoirs.
Message [Final][Rolling] Darkbox - TSnake41 


Montrer les messages depuis:
Répondre au sujet Page 5 sur 5
Aller à la page: <  1, 2, 3, 4, 5
  



Index | créer un forum | Forum gratuit d’entraide | Annuaire des forums gratuits | Signaler une violation | Conditions générales d'utilisation
Copyright 2008 - 2016 // Batch