Message: Re: Is there a UI way to query if an alias is defined? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Is there a UI way to query if an alias is defined? 

Forum: (Graphical) User Interfaces
Re: Question Is there a UI way to query if an alias is defined? (Michael H. Kelsey)
Re: None Re: Is there a UI way to query if an alias is defined? (Makoto Asai)
Date: 04 Feb, 2017
From: Michael H. Kelsey <Michael H. Kelsey>

On Sat, 04 Feb 2017 00:48:00 GMT, Makoto Asai wrote:
> Actually, if you want to define a default value, these two lines are
> enough (and they work with version 10.0)
> 
> /control/alias SOMENAME _default_value_
> /control/getEnv SOMENAME
> 
> The command /control/getEnv *replaces* the alias with the value defined
> in the shell environment *only if* "SOMENAME" is defined as a shell
> variable.

Thanks, Makoto. Actually, envvars aren't involved in this at all, unfortunately. Within my macro, I want to be able set aliases with hardcoded (numeric) values, with the option of the user being able to _pre-set_ the alias before invoking my macro. Something like this:

donuts.mac:
   /control/ifndef INNER_GAP "/control/alias INNER_GAP 2."     #** THIS IS WHAT I WISH FOR
[...]
   /CDMS/Pipe/Clearance {INNER_GAP} mm
[...]

Then, the user's own macro might have lines

  /CDMS/Detector snolab
  /CDMS/UseShield
  /control/execute donuts.mac

In this case, the macro would have INNER_GAP set to the default value "2.". Alternatively, the user might write

  /CDMS/Detector snolab
  /CDMS/UseShield
  /control/alias INNER_GAP 10.
  /control/execute donuts.mac

in which case, donuts.mac would see INNER_GAP with the user's value of "10."

It's that "ifndef" which is missing. The "ifstr" you mentioned in your other reply is almost correct, but it'll still throw an error if the alias is undefined.

  -- Mike

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Is there a UI way to query if an alias is defined?   (Makoto Asai - 04 Feb, 2017)
 Add Message Add Message
to: "Re: Is there a UI way to query if an alias is defined?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]