#53839 - 2001-02-13 11:53 AM
Timer with bypass ??
|
Wizard
Hey THIS is FUN
   
Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
|
I currently show my users a short MOTD with a delay of about 15 seconds - annoying I know  The code I use is.. code:
$count = 15 DO AT(20,74) $count " " AT(20,74) SLEEP 1 $count = $count - 1 UNTIL $count = -1
Is there any way I can add to this so that I can press a key sequence, or just one key, to bypass this delay. I suppose I could add my userID, but if I am logging on as a different user, I would still need to wait. Thanks Wiz
_________________________
Wizard There's no place like 127.0.0.1
vb | kix | batch | html | cfm | js | english
|
|
Top
|
|
|
|
#53842 - 2002-03-06 11:32 PM
Re: Timer with bypass ??
|
celusil
Fresh Scripter
Registered: 2000-07-13
Posts: 9
Loc: Chicago, IL
|
It looks like this should work, I thought it was an answer to my problem, but I couldn't get it to work.
windows 2000 machine.
I use the code in a script, I'm going to try using it by itself and see if it works without any other code around it.
questions: is the $key " " a space or empty and the sendkeys(" "} has to match I assume.
I tried putting a character in the two variables without success
|
|
Top
|
|
|
|
#53843 - 2002-03-07 09:28 AM
Re: Timer with bypass ??
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
With the release of KiXtart 2001 there is another solution - KBHit()
This is similar to the original solution, rewritten with KBHit(). If you don't want the count down, leave out the lines marked "; Countdown"
code:
? "Hit any key to cancel: " $iTimer=15 While KBHit()==0 AND $iTimer $iTimer ; Countdown sleep 1 If $iTimer > 9 Chr(8) Endif ; Countdown Chr(8) " " Chr(8) Chr(8) ; Countdown $iTimer=$iTimer-1 Loop Get $sKeyHit
The $sKeyHit is set to the first key pressed.
|
|
Top
|
|
|
|
#53844 - 2002-03-11 07:05 AM
Re: Timer with bypass ??
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Celusil,
Why you are using the function MessageBox, which can wait 15 seconds but after pressing key it will continue. greetings.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|