Welcome to iraf.net Friday, May 10 2024 @ 04:59 PM GMT
morrisonss |
10/18/2010 04:06PM (Read 4255 times)
|
|
|
Status: offline
Registered: 09/18/2009
Posts: 12
|
Does anyone have any clue how to ask for a user input in a cl script? I have it so it will print the question, but I am unable to figure out how to get it to allow the user to input a response.
|
|
|
|
fitz |
10/18/2010 04:06PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
[code:1:abcf2cfd05]
procedure foo ()begin printf ("prompt> ")
scan (s1) printf ("You said '%s'\n", s1)
end
[/code:1:abcf2cfd05]This would be to prompt for e.g. filenames, although in that case using query parameters would do the same thing. If what you want is something like a keystroke command you would use the 'ukey' CL parameter. E.g.[code:1:abcf2cfd05]nextcmd:
printf ("\nCommand? ")
summary = no ch = cl.ukey
if (substr(ch,1,4) == "\\015") {
goto nextcmd
} switch (ch) {
case "?":
{ ....print help info
}
case "t": # Record
{ printf ("\nService Type? ")
n = scan (stype)
if (n == 0)
stype = ""
goto submit
}
}
[/code:1:abcf2cfd05]Note this ignores a <cr> and prints the prompt again, but defines a '?' and 't' keystroke command similar to what you see in graphics tasks.
|
|
|
|
| |
|
Content generated in: 0.08 seconds |
|