Page 2 of 2 <12
Topic Options
#37339 - 2003-03-06 11:30 AM Re: Test for keypress for a specific Time - then continue
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
Hi!

My final solution (as final as software can be [Wink] )

Altered a little bit, so if you press "p" the script will be paused and if you press any other key, the loop is exited directly without waiting.

Luziekix

code:
$ypos=1
? "Hit any key to cancel"
while $key = " " AND $count < 5 ; ca. 5 seconds
sleep 1
$count = $count + 1
$=sendkeys(" ")
get $key
AT(3,$ypos)"."
$ypos = $ypos + 1
loop
IF
$key="p"
? "PAUSED - Press any key to continue"
get $
get $
ENDIF


Top
#37340 - 2003-03-07 12:03 AM Re: Test for keypress for a specific Time - then continue
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hehe Luzie,

you may remove the comment '; ca. 5 seconds '
This is indeed a bit of an old fashioned joke I added in the sample 2 years ago [Razz]
_________________________



Top
#37341 - 2003-03-06 04:44 PM Re: Test for keypress for a specific Time - then continue
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
O.K. Jochen,

I see - my "last" version has some things to improve [Roll Eyes]

However I wonder, why itīs running well with KIX v3.63 but not with v4.20 (where it just simple quits instead of waiting 5 Seconds in the loop).

Any clue ?

Luziekix

Top
#37342 - 2003-03-07 01:01 AM Re: Test for keypress for a specific Time - then continue
Taurendil Offline
Lurker

Registered: 2003-03-07
Posts: 1
On the same topic, can anyone explain me while this isn't working for me. I'm writing a script that runs an eternal loop. Once each loop I want a 5 second period in which the user can cancel by pressing any key. (seems very similar to the original question.) This is what i wrote:
. For $counter = 1 to 100
. Sleep 0.05
. If KbHit()
. Quit
. Endif
. Next
The script does pause for 5 seconds, but doesn't accept any input from me; what am I doing wrong?
(I'm using version 4.20)
_________________________
- Impotent man looking for frigid woman to sit around and do nothing.

Top
#37343 - 2003-03-07 01:31 AM Re: Test for keypress for a specific Time - then continue
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Post the code inside [ CODE ] tags so we can see it properly. Try adding some comments so you can be sure of the result. Also, QUIT accepts a parameter and so will try to enumerate what follows.
code:
break on
For $counter = 1 to 100
Sleep 0.05
If KbHit()
'quitting'?
Quit 1
Endif
Next
'timed out'?

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#37344 - 2003-03-07 03:26 AM Re: Test for keypress for a specific Time - then continue
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You can also apply the MODE CON through a SHELL command directly into the windows that KIX32 run in. Also, why don't you use the UDF as I pointed out since you're running KiXtart 4.20?
_________________________
There are two types of vessels, submarines and targets.

Top
#37345 - 2003-03-12 11:12 AM Re: Test for keypress for a specific Time - then continue
Luziekix Offline
Getting the hang of it

Registered: 2003-02-27
Posts: 68
Hi Sealeopard!

SHELL "MODE CON COLS=80 LINES=25"

donīt seem to work.

(The window still has the default 300 lines).

Have you tested it ?

The UDF I will try today.

Regards,

Luzie

Top
#37346 - 2003-03-12 01:30 PM Re: Test for keypress for a specific Time - then continue
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
don't know about udf but simple:
code:
$width=80
$height=25
$key="__server_NETLOGON_WKIX32.EXE"
$nul=writevalue("HKEY_CURRENT_USER\Console\"+$key,"screenbuffersize",right("000"+dectohex($width),4)+right("000"+dectohex($height),4),"REG_DWORD")

takes care of that.
_________________________
!

download KiXnet

Top
#37347 - 2003-03-13 05:01 PM Re: Test for keypress for a specific Time - then continue
BBSOFT Offline
Lurker

Registered: 2003-02-24
Posts: 4
However, the above works on Kix v4 (which I recommend you to upgrade to, so we all have the same versions and functions)

On Kix v3 we can use the values directly without
Hex-to-Dez-Conversion:

$key="__Server-Name_NETLOGON_KIX32.EXE"
$Err=AddKey("HKEY_CURRENT_USER\Console\"+$key)
$err=writevalue("HKEY_CURRENT_USER\Console\"+$key,"screenbuffersize","500019","REG_DWORD")

Take care about the two "_" before the Server-Name, this is needed !

And: The above is first active on the second Logon !

BBSOFT

[ 18. March 2003, 08:57: Message edited by: BBSOFT ]

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 937 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.122 seconds in which 0.087 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org