Welcome to iraf.net Thursday, May 09 2024 @ 11:52 PM GMT
sscibell |
09/14/2015 06:51PM (Read 1014 times)
|
|
|
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
|
|
|
|
sscibell |
09/14/2015 08:42PM
|
|
|
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
|
|
|
|
fitz |
09/15/2015 10:42PM
|
|
|
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.
|
|
|
|
| |
|
Content generated in: 0.09 seconds |
|