Welcome to iraf.net Friday, May 10 2024 @ 04:59 PM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 asking for user input in a cl script
   
morrisonss
 10/18/2010 04:06PM (Read 4255 times)  
+----
Newbie

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.

 
Profile Email
 Quote
fitz
 10/18/2010 04:06PM  
AAAAA
Admin

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.

 
Profile Email
 Quote
   
Content generated in: 0.08 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login