Assigning command line arguments to variables in another procedure [message #89261] |
Sun, 10 August 2014 15:57  |
tryanblogs
Messages: 3 Registered: August 2014
|
Junior Member |
|
|
IDL beginner here! Let's say I have two procedures, PRO1 and PRO2. If I receive a command line argument in PRO2, how can I assign the argument value to a variable in PRO1?
Is this possible to accomplish without passing a parameter in a procedure call? Example:
PRO PRO2
value = command_line_argument
PRO1, value
END
PRO PRO1, value
A = value
END
I have previously tried to make an object reference ,'My', to PRO1, but I receive a syntax error.
PRO PRO2
opts = ob_new('mg_options)
opts.addOption, 'value', 'v'
opts.parseArgs,error_message = errorMsg
My = obj_new('PRO1')
My.A=opts.get('value') ;syntax error on this line
END
Any insight is very much appreciated!
|
|
|
|
|
Re: Assigning command line arguments to variables in another procedure [message #89267 is a reply to message #89261] |
Mon, 11 August 2014 02:56   |
Yngvar Larsen
Messages: 134 Registered: January 2010
|
Senior Member |
|
|
"You are doing it all wrong". You should read about classes in IDL:
http://www.exelisvis.com/docs/ref_part2.html
http://www.exelisvis.com/docs/creating_custom_objects.html
Hint #1: Unlike in Java, not everything is a class in IDL.
Hint #2: PRO does not implement a class, but a procedure ("function" with no return value). Thus "My = obj_new('PRO1')" with PRO1 being a procedure, does not make sense.
Hint #3: Event if PRO1 was a class with a member called A, you cannot assign to the member with "My.A" in IDL.
On Monday, 11 August 2014 00:57:40 UTC+2, tryan...@gmail.com wrote:
> IDL beginner here! Let's say I have two procedures, PRO1 and PRO2. If I receive a command line argument in PRO2, how can I assign the argument value to a variable in PRO1?
>
>
>
> Is this possible to accomplish without passing a parameter in a procedure call? Example:
>
>
>
> PRO PRO2
>
> value = command_line_argument
>
> PRO1, value
>
> END
>
>
>
> PRO PRO1, value
>
> A = value
>
> END
>
>
>
> I have previously tried to make an object reference ,'My', to PRO1, but I receive a syntax error.
>
>
>
> PRO PRO2
>
> opts = ob_new('mg_options)
>
> opts.addOption, 'value', 'v'
>
> opts.parseArgs,error_message = errorMsg
>
>
>
> My = obj_new('PRO1')
>
> My.A=opts.get('value') ;syntax error on this line
>
> END
>
>
>
> Any insight is very much appreciated!
|
|
|
|