Welcome to iraf.net Friday, May 17 2024 @ 01:57 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 Prompting help
   
piverson
 07/27/2007 02:33PM (Read 4319 times)  
+++--
Chatty

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

 
Profile Email
 Quote
fitz
 07/27/2007 02:33PM  
AAAAA
Admin

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

 
Profile Email
 Quote
piverson
 07/27/2007 02:33PM  
+++--
Chatty

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?

 
Profile Email
 Quote
fitz
 07/27/2007 02:33PM  
AAAAA
Admin

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

 
Profile Email
 Quote
   
Content generated in: 0.15 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