Difference between revisions of "Copying and pasting scripts"
(→Apple Mac OS X) |
AngelHerraez (talk | contribs) (clarify: block = highlight) |
||
(13 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | Jmol [[Scripting|scripts]] are groups of Jmol [http://chemapps.stolaf.edu/jmol/docs/ commands] that, when executed in Jmol, produce a desired molecular scene. Sometimes it is useful to obtain a script from one place, and run it in Jmol somewhere else. | + | Jmol [[Scripting|scripts]] are groups of Jmol [http://chemapps.stolaf.edu/jmol/docs/ commands] that, when executed in Jmol, produce a desired molecular scene. Sometimes it is useful to obtain a script from one place, and run it in Jmol somewhere else. |
+ | |||
+ | Example 1: Certain molecular scenes are generated much more easily in [http://firstglance.jmol.org FirstGlance in Jmol] than elsewhere (e.g. showing contacts to a ligand). Such a scene can be reproduced in [http://proteopedia.org Proteopedia.Org] by generating the state script in FirstGlance, and executing it in Proteopedia's molecular Scene Authoring Tools (see [http://www.proteopedia.org/wiki/index.php/Help:Copying_FirstGlance_Scenes_into_Proteopedia instructions]). | ||
+ | |||
+ | Example 2: After you color a protein by evolutionary conservation using [http://consurf.tau.ac.il ConSurf], you may wish to install that color scheme in a Proteopedia page. This is a bit easier than the steps below because the requisite script can be copied from a web page. (It is not a ''state script''.) Step by step instructions are here: [http://www.proteopedia.org/wiki/index.php/Help:How_to_Insert_a_ConSurf_Result_Into_a_Proteopedia_Green_Link How to insert a ConSurf result into a Proteopedia green link]. | ||
[http://www.proteopedia.org/wiki/index.php/Java Java] presents some technical obstacles to copying and pasting scripts. Below are described known workarounds. | [http://www.proteopedia.org/wiki/index.php/Java Java] presents some technical obstacles to copying and pasting scripts. Below are described known workarounds. | ||
Line 8: | Line 12: | ||
The following methods have been tested in Leopard OS 10.5.8 (Java 1.5.0_30) and Lion OS 10.7 (Java 1.6.0_26). | The following methods have been tested in Leopard OS 10.5.8 (Java 1.5.0_30) and Lion OS 10.7 (Java 1.6.0_26). | ||
− | ;Summary: Block the state script in the Java Console, then drag and drop it into the Jmol Script Console. | + | ;Summary: Block (highlight) the state script in the Java Console, then drag and drop it into the Jmol Script Console. |
====Obtaining the State Script==== | ====Obtaining the State Script==== | ||
+ | <font color="red">Caution: this procedure often fails: see the red paragraph below.</font> | ||
+ | |||
The state script cannot be obtained from the Jmol Script Console, but it can be copied or dragged from the Java Console. So first you need to <b>open the Java Console</b>. Run <i>Java Preferences</i> (in Applications:Utilities). Under the <i>Advanced</i> tab, check <i>Java Console: Hide Console</i>. | The state script cannot be obtained from the Jmol Script Console, but it can be copied or dragged from the Java Console. So first you need to <b>open the Java Console</b>. Run <i>Java Preferences</i> (in Applications:Utilities). Under the <i>Advanced</i> tab, check <i>Java Console: Hide Console</i>. | ||
Line 18: | Line 24: | ||
<b>Display the desired molecular scene</b>, with both the Java and Jmol Consoles open. Click the "Clear" button in the Java Console. Enter the command <i>'''show state'''</i> in the bottom box of the Jmol Console. This will display a long state script in both Consoles. | <b>Display the desired molecular scene</b>, with both the Java and Jmol Consoles open. Click the "Clear" button in the Java Console. Enter the command <i>'''show state'''</i> in the bottom box of the Jmol Console. This will display a long state script in both Consoles. | ||
− | '''Block the state script in the Java Console''', starting with the line <i># Jmol state ...</i> (omit lines before that one!), and ending with the line <i>_setState;</i>. You cannot paste the state script into the destination Jmol Script Console -- you must drag and drop it there. It is possible to drag directly from the Java Console but you need to have the recipient Jmol Script Console ready. So, to facilitate the drag-and-drop operation, we recommend that you copy the state script (Cmd-C) from the Java Console, and then paste it into a plain text document file for safekeeping. Plain text editors are TextEdit (bundled with your Mac OS X system, in Applications), or the free TextWrangler from [http://barebonessoftware.com BareBonesSoftware.Com]. | + | '''Block (highlight) the state script in the Java Console''', starting with the line <i># Jmol state ...</i> (omit lines before that one!), and ending with the line <i>_setState;</i>. You cannot paste the state script into the destination Jmol Script Console -- you must drag and drop it there. It is possible to drag directly from the Java Console but you need to have the recipient Jmol Script Console ready. So, to facilitate the drag-and-drop operation, we recommend that you copy the state script (Cmd-C) from the Java Console, and then paste it into a plain text document file for safekeeping. Plain text editors are TextEdit (bundled with your Mac OS X system, in Applications), or the free TextWrangler from [http://barebonessoftware.com BareBonesSoftware.Com]. |
+ | |||
+ | <font color="red">Unfortunately, the state script is often longer than the 10,000 bytes allowed in the Java Console. If this happens, perhaps the best workaround is to do the entire project on a Windows computer, where the Java Console is unnecessary (see below).</font> | ||
====Executing the State Script==== | ====Executing the State Script==== | ||
To execute (run) the state script, you first need to open the Jmol Script Console (see above) in the web page where you want to generate the desired molecular scene. | To execute (run) the state script, you first need to open the Jmol Script Console (see above) in the web page where you want to generate the desired molecular scene. | ||
− | In all cases, you need to '''drag''' the blocked state script, and '''drop''' it into the bottom box (command/script entry box) of the Jmol Script Console that belongs to the target applet. You cannot paste it! | + | In all cases, you need to '''drag''' the blocked (highlighted) state script, and '''drop''' it into the bottom box (command/script entry box) of the Jmol Script Console that belongs to the target applet. You cannot paste it! |
In simple cases (where the source scene and target scene are on the same server) you may be able to run the state script unmodified. | In simple cases (where the source scene and target scene are on the same server) you may be able to run the state script unmodified. | ||
Line 30: | Line 38: | ||
===MS Windows=== | ===MS Windows=== | ||
+ | The following methods have been tested in Windows XP with Java 1.6.0_26, in both Firefox and Internet Explorer. | ||
+ | |||
+ | ;Summary: Block (highlight) the state script in the Jmol Script Console, and drag/drop it into a temporary text file, or into the Jmol Script Console belonging to the target Jmol applet. | ||
+ | |||
+ | ====Obtaining the State Script==== | ||
+ | Display the desired molecular scene in the Jmol applet in a web page. | ||
+ | |||
+ | '''Open the Jmol Script Console''': click on the word ''Jmol'' at the lower right in Jmol. This should open Jmol's Menu. If the word ''Console'' does not appear on the Menu, click ''Main Menu''. Now click on ''Console''. | ||
+ | |||
+ | In the Jmol Script Console, click the button at the bottom ''Clear Output''. Now type '''show state''' in the bottom box, and press Enter. | ||
+ | |||
+ | Click in the top box of the Jmol Script Console, and Ctrl-A to '''block (highlight) the entire state script'''. | ||
+ | |||
+ | If the target Jmol applet's Jmol Script Console is available, you can now drag the blocked (highlighted) state script into the bottom box. (It is sometimes possible to copy (Ctrl-C) the state script and paste it (Ctrl-V) into the bottom box of the target Jmol Script Console, but this may not always work.) | ||
+ | |||
+ | To avoid frustration, we recommend that you '''save the state script in a plain text file'''. Drag the blocked (highlighted) state script into a [http://www.proteopedia.org/wiki/index.php/Help:Plain_text_editors plain text editor], or paste it, and save it in a plain text file for safekeeping. Later, you can open this file and either copy or drag the blocked (highlighted) script into the target Jmol Script Console. | ||
+ | |||
+ | ====Executing the State Script==== | ||
+ | To execute (run) the state script, you first need to open the Jmol Script Console (see above) in the web page where you want to generate the desired molecular scene. | ||
+ | |||
+ | In all cases, you need to '''drag''' the blocked (highlighted) state script, and '''drop''' it into the bottom box (command/script entry box) of the Jmol Script Console that belongs to the target applet. Alternatively, you may be able to copy and paste the state script, but this has not always worked. | ||
+ | |||
+ | In simple cases (where the source scene and target scene are on the same server) you may be able to run the state script unmodified. | ||
+ | |||
+ | '''Proteopedia:''' Special steps are needed to run the state script in the Scene Authoring Tool of Proteopedia, which will enable you to save the scene in a ''green link'' in Proteopedia. Detailed instructions are provided in [http://www.proteopedia.org/wiki/index.php/Help:Copying_FirstGlance_Scenes_into_Proteopedia Copying FirstGlance Scenes into Proteopedia]. | ||
==Application== | ==Application== | ||
(please provide details here) | (please provide details here) |
Latest revision as of 13:57, 5 October 2012
Jmol scripts are groups of Jmol commands that, when executed in Jmol, produce a desired molecular scene. Sometimes it is useful to obtain a script from one place, and run it in Jmol somewhere else.
Example 1: Certain molecular scenes are generated much more easily in FirstGlance in Jmol than elsewhere (e.g. showing contacts to a ligand). Such a scene can be reproduced in Proteopedia.Org by generating the state script in FirstGlance, and executing it in Proteopedia's molecular Scene Authoring Tools (see instructions).
Example 2: After you color a protein by evolutionary conservation using ConSurf, you may wish to install that color scheme in a Proteopedia page. This is a bit easier than the steps below because the requisite script can be copied from a web page. (It is not a state script.) Step by step instructions are here: How to insert a ConSurf result into a Proteopedia green link.
Java presents some technical obstacles to copying and pasting scripts. Below are described known workarounds.
Contents
Applet
We'll assume you have obtained a molecular scene in a web page, in the Jmol applet, and that you wish to regenerate this scene in a Jmol applet elsewhere. The goal is to display the state script for the desired molecular scene, copy and paste the state script into the Jmol console, and run the state script. The details depend on the computer being used.
Apple Mac OS X
The following methods have been tested in Leopard OS 10.5.8 (Java 1.5.0_30) and Lion OS 10.7 (Java 1.6.0_26).
- Summary
- Block (highlight) the state script in the Java Console, then drag and drop it into the Jmol Script Console.
Obtaining the State Script
Caution: this procedure often fails: see the red paragraph below.
The state script cannot be obtained from the Jmol Script Console, but it can be copied or dragged from the Java Console. So first you need to open the Java Console. Run Java Preferences (in Applications:Utilities). Under the Advanced tab, check Java Console: Hide Console.
Now close and restart your browser. Display a web page containing the Jmol applet. You should find a Java icon in your menu bar (at the top of the screen): a black coffee cup with steam rising. Click on it, and then on Open Java Console. The Java icon will not appear in your menu bar unless the Console is enabled in Java Preferences (see previous paragraph).
The state script is generated from the Jmol Script Console, so now you need to open the Jmol Script Console. Click on the word Jmol at the lower right of Jmol, to open Jmol's menu. If Console is not on the menu, click Main Menu. Now click Console.
Display the desired molecular scene, with both the Java and Jmol Consoles open. Click the "Clear" button in the Java Console. Enter the command show state in the bottom box of the Jmol Console. This will display a long state script in both Consoles.
Block (highlight) the state script in the Java Console, starting with the line # Jmol state ... (omit lines before that one!), and ending with the line _setState;. You cannot paste the state script into the destination Jmol Script Console -- you must drag and drop it there. It is possible to drag directly from the Java Console but you need to have the recipient Jmol Script Console ready. So, to facilitate the drag-and-drop operation, we recommend that you copy the state script (Cmd-C) from the Java Console, and then paste it into a plain text document file for safekeeping. Plain text editors are TextEdit (bundled with your Mac OS X system, in Applications), or the free TextWrangler from BareBonesSoftware.Com.
Unfortunately, the state script is often longer than the 10,000 bytes allowed in the Java Console. If this happens, perhaps the best workaround is to do the entire project on a Windows computer, where the Java Console is unnecessary (see below).
Executing the State Script
To execute (run) the state script, you first need to open the Jmol Script Console (see above) in the web page where you want to generate the desired molecular scene.
In all cases, you need to drag the blocked (highlighted) state script, and drop it into the bottom box (command/script entry box) of the Jmol Script Console that belongs to the target applet. You cannot paste it!
In simple cases (where the source scene and target scene are on the same server) you may be able to run the state script unmodified.
Proteopedia: Special steps are needed to run the state script in the Scene Authoring Tool of Proteopedia, which will enable you to save the scene in a green link in Proteopedia. Detailed instructions are provided in Copying FirstGlance Scenes into Proteopedia.
MS Windows
The following methods have been tested in Windows XP with Java 1.6.0_26, in both Firefox and Internet Explorer.
- Summary
- Block (highlight) the state script in the Jmol Script Console, and drag/drop it into a temporary text file, or into the Jmol Script Console belonging to the target Jmol applet.
Obtaining the State Script
Display the desired molecular scene in the Jmol applet in a web page.
Open the Jmol Script Console: click on the word Jmol at the lower right in Jmol. This should open Jmol's Menu. If the word Console does not appear on the Menu, click Main Menu. Now click on Console.
In the Jmol Script Console, click the button at the bottom Clear Output. Now type show state in the bottom box, and press Enter.
Click in the top box of the Jmol Script Console, and Ctrl-A to block (highlight) the entire state script.
If the target Jmol applet's Jmol Script Console is available, you can now drag the blocked (highlighted) state script into the bottom box. (It is sometimes possible to copy (Ctrl-C) the state script and paste it (Ctrl-V) into the bottom box of the target Jmol Script Console, but this may not always work.)
To avoid frustration, we recommend that you save the state script in a plain text file. Drag the blocked (highlighted) state script into a plain text editor, or paste it, and save it in a plain text file for safekeeping. Later, you can open this file and either copy or drag the blocked (highlighted) script into the target Jmol Script Console.
Executing the State Script
To execute (run) the state script, you first need to open the Jmol Script Console (see above) in the web page where you want to generate the desired molecular scene.
In all cases, you need to drag the blocked (highlighted) state script, and drop it into the bottom box (command/script entry box) of the Jmol Script Console that belongs to the target applet. Alternatively, you may be able to copy and paste the state script, but this has not always worked.
In simple cases (where the source scene and target scene are on the same server) you may be able to run the state script unmodified.
Proteopedia: Special steps are needed to run the state script in the Scene Authoring Tool of Proteopedia, which will enable you to save the scene in a green link in Proteopedia. Detailed instructions are provided in Copying FirstGlance Scenes into Proteopedia.
Application
(please provide details here)