Proteopedia:DIY:Macros: Difference between revisions

Wayne Decatur (talk | contribs)
Wayne Decatur (talk | contribs)
mNo edit summary
Line 4: Line 4:


This page is meant to be a resource for finding and using macros.
This page is meant to be a resource for finding and using macros.
<StructureSection load='1d9z' size='340' side='right' caption='Structure of UvrB in complex with ATP' scene=''>


==Defined Macros==
==Defined Macros==
Line 12: Line 14:


Integrating macro use into JSmol code is straightforward.
Integrating macro use into JSmol code is straightforward.
This example doesn't require any parameter to act.
This example doesn't require any parameter to act. It causes the structure shown to 'bobble()'.
 
<pre>
<jmol>
<jmolLink>
<script>
script /mc/ktheis.spt;
if (~bobble); @exit; ~bobble=false; else; bobble(); ~bobble=true; endif;
</script>
<text>Toggle Bobble on/off</text>
</jmolLink>
</jmol>
</pre>
 
Try the result here:
 
<jmol>
<jmolLink>
<script>
script /mc/ktheis.spt;
if (~bobble); @exit; ~bobble=false; else; bobble(); ~bobble=true; endif;
</script>
<text>Toggle Bobble on/off</text>
</jmolLink>
</jmol>
 
The <code><nowiki>bobble()</nowiki></code> part triggers the action. The <code><nowiki>@exit</nowiki></code> ends the looping bobble.


This example shows how to specify an item or items to act on by passing in a parameter.
This example shows how to specify an item or items to act on by passing in a parameter.
Line 20: Line 48:


Advanced users who want to code additional macros can get a flavor for the JSmol operating behind the scenes and ideas on how they'd code their own by examining the code for macros already available. To view an example go the [[Proteopedia:Macros]] page and note that examples such as the 'bobble()' example include notes on how you import it using <code><nowiki> script /mc/ktheis.spt</nowiki></code>. In particular note the <code><nowiki>/mc/ktheis.spt</nowiki></code> part after 'script'. That is the address of the script code stored at Proteopeida. Place that part after after <code><nowiki>http://proteopedia.org/wiki/</nowiki></code> so you end up at <code><nowiki>http://proteopedia.org/wiki//mc/ktheis.spt</nowiki></code> where you can see the code for several defined macro functions.
Advanced users who want to code additional macros can get a flavor for the JSmol operating behind the scenes and ideas on how they'd code their own by examining the code for macros already available. To view an example go the [[Proteopedia:Macros]] page and note that examples such as the 'bobble()' example include notes on how you import it using <code><nowiki> script /mc/ktheis.spt</nowiki></code>. In particular note the <code><nowiki>/mc/ktheis.spt</nowiki></code> part after 'script'. That is the address of the script code stored at Proteopeida. Place that part after after <code><nowiki>http://proteopedia.org/wiki/</nowiki></code> so you end up at <code><nowiki>http://proteopedia.org/wiki//mc/ktheis.spt</nowiki></code> where you can see the code for several defined macro functions.
</StructureSection>

Proteopedia Page Contributors and Editors (what is this?)Proteopedia Page Contributors and Editors (what is this?)

Wayne Decatur