Welcome to iraf.net Friday, March 29 2024 @ 12:36 PM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 Procedure Error
   
sscibell
 09/14/2015 06:51PM (Read 1008 times)  
+----
Newbie

Status: offline


Registered: 09/02/2015
Posts: 10
Hello,

I am trying to pass parameters to script tasks and I keep getting an error saying "ERROR: Illegal variable declarations." I tried simply following a script from 'IRAF CL Script Tips & Tricks' :

ecl\$this->_split2($m[0]) procedure askit (question)
\$this->_split2($m[0])\$this->_split2($m[0])\$this->_split2($m[0])bool question = yes {prompt="Do you want to continue?"}
ERROR: Illegal variable declarations.

Any idea why this is happening?

Thanks!
S

 
Profile Email
 Quote
sscibell
 09/14/2015 08:42PM  
+----
Newbie

Status: offline


Registered: 09/02/2015
Posts: 10
So also, I am basically trying to create a command in my script that allows for the user to input files names to be used later on in other tasks in the script. Perhaps there is an easier way to do this than to use 'procedure'??

Thanks!
S

 
Profile Email
 Quote
fitz
 09/15/2015 10:42PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Procedure scripts are meant to be in files by themselves, not created on-the-fly in the CL. For example, you would put

procedure hello (name)
string name { prompt='Your name' }
begin
print ("Hello " // name)
end

in a file called 'hello.cl' and then declare it as a task using

cl\$this->_split2($m[0]) task hello = //hello.cl


As for what you're trying to do specifically I'm not sure I understand the details. You can create lists of files using a text editor and then pass that list to tasks using the '@file' syntax, e.g.

cl\$this->_split2($m[0]) imstat @imlist.txt

where 'imlist.txt' contains a list of filenames, one per line. Likewise, you can use the FILES or SECTIONS tasks (see the help page) to create file lists using wildcard templates of various sorts.

If you're trying to create an interactive script and simply want to prompt the user then you could incorporate something like the following in your script:


printf ("Do you want to continue? ")
ch = cl.ukey
if (ch == "y") {
...... do something
} else {
.... do something else
}

Hope this helps.

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