Welcome to iraf.net Friday, May 17 2024 @ 01:57 AM GMT
piverson |
07/27/2007 02:33PM (Read 4319 times)
|
|
|
Status: offline
Registered: 07/10/2007
Posts: 42
|
I am having trouble getting prompts to work in a cl script. I have written the script exactly as other posts have suggested but, for some reason, never actually get the prompt. I have attached the code below. I have tried with object without parens; I have tried with string objectname between the begin and end; I have tried with each declared as ="". I am currently at a loss.Thanks,
Paul
#codetest.cl by Paul Iverson
#the purpose of this cl script is to give a tasked file that can be used to test codeprocedure codeteststring object {prompt = "Enter the name of your object:"}
string objectnamebegin
objectname = (object)
end
|
|
|
|
fitz |
07/27/2007 02:33PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Try [code:1:a4feceb167]procedure codetest (object)string object {prompt = "Enter the name of your object:"}
int foo = 1begin
string objectname
objectname = object
end
[/code:1:a4feceb167]Everything between the 'procedure' and the 'begin' statement is considered a parameter, but only those in the procedure argument list are considered 'query parameters' that will be prompted for if not on the commandline. All others will use a default value (e.g. the 'foo' param). I think you want 'objectname' to be a local var declared after the 'begin' so you can get the param only once and thereafer use the local var for the value, otherwise you might get prompted each time you refer to 'object' in the script.Cheers,
-Mike
|
|
|
|
piverson |
07/27/2007 02:33PM
|
|
|
Status: offline
Registered: 07/10/2007
Posts: 42
|
Another problem. IRAF is responding with the error "Attempt to access undefined local variable 'objectname'".Below is my code:procedure codetest (object)string object {Prompt = "Enter the name of your object:"}begin
string objectname
objectname = object
endAny ideas?
|
|
|
|
fitz |
07/27/2007 02:33PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
If you've previously declared the script and run it, do an 'unlearn'. By putting 'object' in the procedure declaration you've changed the task's parameter and an unlearn will reset them. Otherwise, be sure you aren't declaring the task as e.g. "task $code = code.cl" -- the '$' says the task has no parameters and will cause the same message.-Mike
|
|
|
|
| |
|
Content generated in: 0.15 seconds |
|