Page 1 of 1 1
Topic Options
#194023 - 2009-05-27 06:32 PM does kix have input prompts?
itdaddy Offline
Starting to like KiXtart

Registered: 2006-12-19
Posts: 145
Loc: Wisconsin
I want to be able to be prompted at the dos prompt
or whatever to prompt an input to an array.

for example:

-----output prompt example-------
Enter in server names: srv1, srv2, mail2, srv5

-----------code example--------of what I want-----
$servers = prompt(Enter in server names:, "")
_________________________
Robert
A+, CCNA, MCP
Network Admin
Credit Union Wisconsin

Top
#194024 - 2009-05-27 06:51 PM Re: does kix have input prompts? [Re: itdaddy]
eriqjaffe Offline
Hey THIS is FUN

Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
There's the GETS command, which you can turn into an array:

 Code:
? "Enter in server names, separated by commas: " gets $foo
$severs = split($foo,",")


Edited by eriqjaffe (2009-05-27 06:52 PM)

Top
#194025 - 2009-05-27 06:51 PM Re: does kix have input prompts? [Re: itdaddy]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4517
Loc: USA
You can use Gets, but the input will be a string. In order for it to be an array you will have to split() the input. Something like:

 Code:
? "Type Input, seperated by commas"
gets $input
$input=split($input,",")
for each $item in $input
  ? $item
next

Top
#194026 - 2009-05-27 06:59 PM Re: does kix have input prompts? [Re: Allen]
itdaddy Offline
Starting to like KiXtart

Registered: 2006-12-19
Posts: 145
Loc: Wisconsin
thanks a lot guys. you dudes are awesome ! wow! this will help.
I am building a server bounce program. I call it bounceWatch or bw.exe.
I am going to compile it with the kix compiler. What it is going to do is this. Firs the the problem it will solve. Well I once a month check our servers and if they go over say 21 days or 30 days, I restart each one.
I use the windows command shutdown -m \\pcnane -f -r to restart them.
well I have decided since I do so many and I like to watch them come up before I go home to make sure they did come up.It takes a while to do say 20 servers. Yeah I could do a scheduled reboot but I am from school to watch them and make sure they are up. but anyhow, I will execuet bw.exe
and then it will ask me to enter server names srv1, srv2, srv5, mail2 etc..
and then it will ask if i want to bounce them give me one last chance
I have it loop and ask me for each one just in case I dont want to reboot one for some reason, after i say yes it will commence to reboot each one.
then display a list of my server names I inputted one left column and then on right column as they come up (test ping in background) be displayed and auto refresh sort so the list is exacly the same order as the inputted one so when it is all done i will see all the same names of servers I bounce. then say success and maybe make a noice like tah dah!!!!!! that would be so cool if i can pull this off so to make it easier for me since I am lazy hahhahh plus watching them come up would be cool...so wish me luck and once I perfect will post it back here for you guys to tear up! haha
but it will be a fun and useful project for me..;)

thanks for your help!
_________________________
Robert
A+, CCNA, MCP
Network Admin
Credit Union Wisconsin

Top
#194035 - 2009-05-28 10:36 AM Re: does kix have input prompts? [Re: itdaddy]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
A couple of suggestions:
  • Don't enter the server list every time, life is too short. Store the list in an INI file or registry key and update it when you add or remove a server.
  • KiXtart has it's own Shutdown() function that you can use to restart servers rather than using an external utility.
  • Don't forget to check that the servers go down as well as come up. One of my biggest problems is servers that should restart after patching - they start to go down but never quite get there, so they continue to respond to PING ok but the server is left in an unusable state.


I've got some code knocking around somewhere that does pretty much what you are looking for. Try to get it working yourself (it's much more fun that way) and if you get stuck post again.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 292 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.059 seconds in which 0.04 seconds were spent on a total of 13 queries. Zlib compression enabled.

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