Proteopedia:DIY:Macros: Difference between revisions
m point to the code page |
|||
Line 19: | Line 19: | ||
==Coding New Macros== | ==Coding New Macros== | ||
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 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. |
Revision as of 04:42, 4 January 2021
Macros as a tool
Macros can be used in Proteopedia pages to call commonly used JSmol code. Macro functions can take parameters so that the code is general but can act on the specified item or items. Additional macros can be made.
This page is meant to be a resource for finding and using macros.
Defined MacrosDefined Macros
The currently listing of defined macro functions can be found at Proteopedia:Macros.
Using MacrosUsing Macros
Integrating macro use into JSmol code is straightforward. This example doesn't require any parameter to act.
This example shows how to specify an item or items to act on by passing in a parameter.
Coding New MacrosCoding New Macros
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 script /mc/ktheis.spt
. In particular note the /mc/ktheis.spt
part after 'script'. That is the address of the script code stored at Proteopeida. Place that part after after http://proteopedia.org/wiki/
so you end up at http://proteopedia.org/wiki//mc/ktheis.spt
where you can see the code for several defined macro functions.