Re: [Jmol-developers] myJmol as variable in Jmol.script

2016-05-07 Thread Rolf Huehne
Am 07.05.16 um 10:22 schrieb Klaus Schaper:
> Hi everybody,
>
> I just decided as recommended to switch from jmolScript to the modern
> Jmol.script syntax.
>
> I create to applets with the following function:
>
> function KS_ErzeugeAppRechteck(Ziel)
>
> {
>
> var Info = {src: "Ethan.xyz"};
>
> Info.j2sPath
> ="http://schelm.hhu.de/home/Lehre/scheLM_Test/_INCLUDE/JSMOL/j2s;;
>
> Jmol.getApplet(Ziel, Info);
>
> }
>
> I call this function twice from my webpage:
>
>  KS_ErzeugeAppRechteck('A'); 
>
>  KS_ErzeugeAppRechteck('B'); 
>
> Thus creating to applets with the name A and B.
>
> If I run the following function I can set the color of two atoms in A to
> blue:
>
> function KS_AtomeHervorheben()
>
> {
>
> Jmol.script(A, "select hydrogen;color white;select
> atomno=3,atomno=6; color atoms blue");
>
> }
>
> __
>
> If I change myJmol to B I can change the color of two atoms in B
>
> __
>
> function KS_AtomeHervorheben()
>
> {
>
> Jmol.script(B, "select hydrogen;color white;select
> atomno=3,atomno=6; color atoms blue");
>
> }
>
> However, what I really would like to do is to pass the name of the
> applet by the function call and parse it into the jmol.script command.
>
> function KS_AtomeHervorheben(name)
>
> {
>
> Jmol.script(name, "select hydrogen;color white;select
> atomno=3,atomno=6; color atoms blue");
>
> }
>
> However, I get the following error “TypeError: a._checkDeferred is not a
> function”.
>
> Is there any way to path the name of the app by the function call to the
> Jmol.script command or is there any other way to get the job done. I
> have webpages containing 7 Jsmol apps and I do not want to write the
> same commands 7 times.
>
Klaus, I think 'A' and 'B' are objects and not just names. So you could 
try to use the 'eval' function to address the objects:

Jmol.script(eval(name), "select hydrogen;color white;select 
atomno=3,atomno=6; color atoms blue");

Regards,
Rolf

--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
___
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers


[Jmol-developers] myJmol as variable in Jmol.script

2016-05-07 Thread Klaus Schaper
Hi everybody,

 

I just decided as recommended to switch from jmolScript to the modern
Jmol.script syntax.

 

I create to applets with the following function:

 

function KS_ErzeugeAppRechteck(Ziel)

   {

   var Info = {src: "Ethan.xyz"};   

   Info.j2sPath
="http://schelm.hhu.de/home/Lehre/scheLM_Test/_INCLUDE/JSMOL/j2s;;

   Jmol.getApplet(Ziel, Info);

   }   

 

I call this function twice from my webpage:

 

 KS_ErzeugeAppRechteck('A'); 

 KS_ErzeugeAppRechteck('B'); 

 

Thus creating to applets with the name A and B.

 

If I run the following function I can set the color of two atoms in A to
blue:

 

function KS_AtomeHervorheben()

   {

   Jmol.script(A, "select hydrogen;color white;select atomno=3,atomno=6;
color atoms blue");

   }

 

If I change myJmol to B I can change the color of two atoms in B 

 

function KS_AtomeHervorheben()

   {

   Jmol.script(B, "select hydrogen;color white;select atomno=3,atomno=6;
color atoms blue");

   }

 

However, what I really would like to do is to pass the name of the applet by
the function call and parse it into the jmol.script command.

 

function KS_AtomeHervorheben(name)

   {

   Jmol.script(name, "select hydrogen;color white;select atomno=3,atomno=6;
color atoms blue");

   }

 

However, I get the following error “TypeError: a._checkDeferred is not a
function”.

 

Is there any way to path the name of the app by the function call to the
Jmol.script command or is there any other way to get the job done. I have
webpages containing 7 Jsmol apps and I do not want to write the same
commands 7 times.

 

Thanks,

 

Klaus

 

 




 

PD Dr. Klaus Schaper

 

http://www.photochemie.hhu.de/ oder http://www.klaus-schaper.de
 

 

e-mail: scha...@klaus-schaper.de

 

Arbeitsgruppe für Organische Photochemie

Institut für Organische Chemie und Makromolekulare Chemie I

Raum 26.43.00.27

 

Heinrich-Heine-Universität Düsseldorf

Universitätsstr. 1

D-40225 Düsseldorf

Deutschland

 

Telefon: +49 211 81 12571

FAX: +49 211 81 14324

 




 

 

--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers