itdaddy
(Starting to like KiXtart)
2009-05-27 06:32 PM
does kix have input prompts?

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:, "")


eriqjaffe
(Hey THIS is FUN)
2009-05-27 06:51 PM
Re: does kix have input prompts?

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,",")


AllenAdministrator
(KiX Supporter)
2009-05-27 06:51 PM
Re: does kix have input prompts?

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


itdaddy
(Starting to like KiXtart)
2009-05-27 06:59 PM
Re: does kix have input prompts?

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!


Richard H.Administrator
(KiX Supporter)
2009-05-28 10:36 AM
Re: does kix have input prompts?

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.