skill:get a input value from keyboard

C

camelot

Guest
Hi,
I have a little problem. I have to get a space key pressed to allow
the program go on to other operations. I'm using batch skill in a
shell and no under Opus so bindkeys are not available. However, is
there a way to get a char or a string from keyboard and store it in a
variable? Something like that allow user to get information i a skill
batch session.

Thank you,

Giuseppe
 
The following should work under unix. Not sure how portable though.

use waitForKey(32) for spacebar.

Stéphane


procedure( getch()
let( (c)
system("stty -echo raw")
c = getc(piport)
system("stty echo -raw")
charToInt(c)
) ; let
) ; procedure

procedure( waitForKey(k)
while( k>=32 && k<=127 && getch() != k t )
)


camelot wrote:
Hi,
I have a little problem. I have to get a space key pressed to allow
the program go on to other operations. I'm using batch skill in a
shell and no under Opus so bindkeys are not available. However, is
there a way to get a char or a string from keyboard and store it in a
variable? Something like that allow user to get information i a skill
batch session.

Thank you,

Giuseppe
 
On 21 Nov, 17:02, "S. Badel" <stephane.ba...@REMOVETHISepfl.ch> wrote:
The following should work under unix. Not sure how portable though.

use waitForKey(32) for spacebar.

Stéphane

procedure( getch()
  let( (c)
   system("stty -echo raw")
   c = getc(piport)
   system("stty echo -raw")
   charToInt(c)
  ) ; let
) ; procedure

procedure( waitForKey(k)
  while( k>=32 && k<=127 && getch() != k t )
)



camelot wrote:
Hi,
I have a little problem. I have to get a space key pressed to allow
the program go on to other operations. I'm using batch skill in a
shell and no under Opus so bindkeys are not available. However, is
there a way to get a char or a string from keyboard and store it in a
variable? Something like that allow user to get information i a skill
batch session.

Thank you,

Giuseppe- Nascondi testo citato

- Mostra testo citato -
Hi, thank you for the suggestion but in my case I would like to check
the key press without a pause until the key is pressed...

Camelot
 

Welcome to EDABoard.com

Sponsor

Back
Top