Hi, Max,

Yes, I think the stuff inside the parentheses is literally a string, so,if you 
want to vary the string, you need to reconstruct the string in your loop with 
the + signs.  Although it "works", I think the line sums two different types 
(string and integer), so, I am not certain the syntax is strictly correct.

Best,

Matt
________________________________________
From: Latévi Max LAWSON DAKU [max.law...@unige.ch]
Sent: Thursday, July 07, 2016 11:15 AM
To: jmol-users@lists.sourceforge.net
Subject: Re: [Jmol-users] Use of variable in a call to getProperty

On 07. 07. 16 17:04, Kubasik, Matthew A. wrote:
> Max,
>

Hi Matt,

Thanks for your suggestions.

> Two suggestions.
>
> First, something like:
>
> freqvalues = getproperty('modelInfo.models.modelProperties.FreqValue')
>
> will look for frequency values of all models and put them in the array 
> "freqvalues".
>
> Unfortunately, this array will have empty entries for models lacking 
> frequency values.
>
> Second, if you know the range of models that contain freq values (say, models 
> 300 to 370), you can use something like:
>
> for (var i=300; i<370;i+=1){
> print getproperty('modelInfo.models['+i+'].modelProperties.FreqValue')
> }

I tried this latter and it works !! :D

Thanks again!

Best,
Max


>
> Perhaps more skilled coders on the list could suggest improvements to these 
> clunky lines!
>
> Matt
>
>
>
>
> ________________________________________
> From: Latévi Max LAWSON DAKU [max.law...@unige.ch]
> Sent: Thursday, July 07, 2016 10:38 AM
> To: jmol-users@lists.sourceforge.net
> Subject: [Jmol-users] Use of variable in a call to getProperty
>
> Dear Jmol users/developers,
>
> I would like to be able to use a variable in a call to getProperty.
> So far, the following command works.
>
>      $ print getproperty('modelInfo.models[7].modelProperties.FreqValue')
>      129.529358
>
> But I rwould like to use a variable as follows
>
>      $ i=7
>      $ print getproperty('modelInfo.models[i].modelProperties.FreqValue')
>
> But this doesn't work. I also tried to use @{i}, with no success as
> well. I'm not comfortable with dereferencing a variable in Jmol.
>
> The reason for trying to do so us that I'ld like to iterate through the
> frames and use the variable i hold the index of the frame.
>
>
> I thank you in advance for your help.
>
> Best regards,
> Max
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to