#31243 - 2002-10-23 03:19 PM
Stop script.
|
Koen van der Aa
Fresh Scripter
Registered: 2002-07-13
Posts: 7
|
Hi there,
I want the users to decide if the logon script should run or not. How can I do that?
It should work like this:
Question: Continue with login script Y/N: If N selected then script should close.
Grtz.
|
Top
|
|
|
|
#31244 - 2002-10-23 03:23 PM
Re: Stop script.
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Generally speaking if you architect your script and file placement correctly, answering your question will probably take as long letting the script execute.
But look at the manual for the "?", "GET", "IF", and "EXIT" commands. You can use them to do want.
|
Top
|
|
|
|
#31245 - 2002-10-23 03:27 PM
Re: Stop script.
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
How about something like this:
code:
Break On Do ?"Continue with login script Y/N: " Gets $Answer Until $Answer = "Y" Or $Answer = "N" If $Answer = "N" Quit() Else ?"Carry on..." Endif Exit 1
-Shawn [ 23. October 2002, 15:28: Message edited by: Shawn ]
|
Top
|
|
|
|
#31246 - 2002-10-23 03:35 PM
Re: Stop script.
|
Waltz
Seasoned Scripter
Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
|
...or Shawn's UDF Choice (), [which he apparently forgot that he wrote... ] code:
Function Choice($prompt,optional $choices) dim $i,$c,$opts,$key if not $choices $choices = "YN" endif for $i = 1 to len($choices) $opts = $opts + substr($choices,$i,1) + "," next $prompt = $prompt+" ["+substr($opts,1,len($opts)-1) + "] ? " ? $prompt while 1 get $c if asc($c) = 3 ; ^c $choice = "" exit 0 endif $key = instr($choices,$c) if $key $c = ucase($c) $c ; echo $choice = $c exit $key else beep endif loop EndFunction
_________________________
We all live in a Yellow Subroutine...
|
Top
|
|
|
|
#31248 - 2002-10-23 03:38 PM
Re: Stop script.
|
Koen van der Aa
Fresh Scripter
Registered: 2002-07-13
Posts: 7
|
Thanx Shawn, it works.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 369 anonymous users online.
|
|
|