Reply to topic  [ 3 posts ] 
Prompt function that will take an input 
Author Message
Yorick Padawan

Joined: Tue Jun 07, 2011 1:46 pm
Posts: 32
Location: UNH
Post Prompt function that will take an input
Hi,

I'm making a commandline script that I'd like to prompt the user for specific input. Is there a way to prompt the user?

For example:
Code:
prompt, "What channel do you want to see? [1],[2],[3],[all]\n", answerVar

Quote:
What channel do you want to see? [1],[2],[3],[all]
1

Code:
if (answerVar == 1)
{
...etc

Thanks,
Ronak


Tue Jul 12, 2011 8:31 am
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: Prompt function that will take an input
help,read

or

help,rdline

Beware that this is not an event driven programming model. A better programming style is to organize your task into a series of functions that your users invoke. If you think your users can't handle that, I recommend you collect all the information required to complete your task before you begin any of the calculations. At least with that style you won't be precluding converting your program to a GUI environment.


Wed Jul 13, 2011 12:55 pm
Profile
Yorick Padawan

Joined: Tue Jun 07, 2011 1:46 pm
Posts: 32
Location: UNH
Post Re: Prompt function that will take an input
Ahh, that is very simple and it works just as I wanted it to.

Code:
answer = ""
n = read(prompt="Do you want to continue? [Y]/N ", format="", answer);
if (answer == "") {
   answer = "Y"; // default
}


Quote:
> ...
Do you want to continue? [Y]/N Y
...


Thanks again,
Ronak


Thu Jul 14, 2011 9:15 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.