Prompting help
Elden Paul Iverson wrote on Jul 27, 2007
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 code
procedure codetest
string object {prompt = "Enter the name of your object:"}
string objectname
begin
objectname = (object)
end
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 code
procedure codetest
string object {prompt = "Enter the name of your object:"}
string objectname
begin
objectname = (object)
end
Mike Fitzpatrick wrote on Jul 27, 2007
Try
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
procedure codetest (object)
string object {prompt = "Enter the name of your object:"}
int foo = 1
begin
string objectname
objectname = object
end
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
Elden Paul Iverson wrote on Jul 27, 2007
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
end
Any ideas?
Below is my code:
procedure codetest (object)
string object {Prompt = "Enter the name of your object:"}
begin
string objectname
objectname = object
end
Any ideas?
Mike Fitzpatrick wrote on Jul 27, 2007
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
-Mike
Last post on Jul 27, 2007