Difference between revisions of "Copying and pasting scripts"

From Jmol
Jump to navigation Jump to search
(Copying the State Script)
(Copying the State Script)
Line 6: Line 6:
 
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.
 
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===
 
===Apple Mac OS X===
====Copying the State Script====
+
====Obtaining the State Script====
The state script cannot be copied (or dragged) from the Jmol Script Console, but it can be copied 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>.
  
 
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 <i>Open Java Console</i>. The Java icon will not appear in your menu bar unless the Console is enabled in Java Preferences (see previous paragraph).
 
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 <i>Open Java Console</i>. The Java icon will not appear in your menu bar unless the Console is enabled in Java Preferences (see previous paragraph).
Line 13: Line 13:
 
The state script is generated from the Jmol Script Console, so now you need to <b>open the Jmol Script Console</b>. Click on the word <i>Jmol</i> at the lower right of Jmol, to open Jmol's menu. If <i>Console</i> is not on the menu, click <i>Main Menu</i>. Now click <i>Console</i>.
 
The state script is generated from the Jmol Script Console, so now you need to <b>open the Jmol Script Console</b>. Click on the word <i>Jmol</i> at the lower right of Jmol, to open Jmol's menu. If <i>Console</i> is not on the menu, click <i>Main Menu</i>. Now click <i>Console</i>.
  
Display the desired molecular scene, 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.
+
Display the desired molecular scene, 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>.  Copy the state script (Cmd-C).
  
 
===MS Windows===
 
===MS Windows===

Revision as of 17:09, 29 September 2011

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. For example, 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).

Java presents some technical obstacles to copying and pasting scripts. Below are described known workarounds.

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

Obtaining the State Script

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 the state script in the Java Console, starting with the line # Jmol state ... (omit lines before that one!), and ending with the line _setState;. Copy the state script (Cmd-C).

MS Windows

Application

(please provide details here)

Contributors

EricMartz, AngelHerraez