Documentation Contents On-line Documentation Tutorials CCP4mg Home

Contents

Introduction
Recording
Replaying and Editing
See also:
Introduction to Python

Introduction

Recording and replaying commands can be useful to save time repeating a frequent command sequence and for making presentations. More sophisticated scripts can be used to extend the functionality of CCP4mg.
CCP4mg keeps a record of the commands that you enter and will display this history if you use the History and scripting utility on the Tools pull-down menu. You can select some or all of the command history to save to a file. This recording file can be replayed again later. If you need to modify the recording you do not need to manually edit it, there are options to delete commands or add new commands by picking them from the graphical interface.
The 'top' level of CCP4mg is written in the Python scripting language and you can replay Python scripts within CCP4mg. In many cases the easiest way to create a script will be to start from a recording made via the History and scripting utility. So, for example, if you want to apply some procedure to a range of molecules you should make a recording of applying the procedure to a single molecule and then edit the recording file to repeat for multiple molecules. Generally you will need some familiarity with Python to write or edit scripts but you may be able to do some simple things by following the examples below.

The History&Scripting->Replay script option on the Tools pull-down menu requires you to select a script file and has options:
Update display after each script line in this mode the script is executed one command at a time and after every command the display is updated. This will not work if the script contains control statements, loops etc.. If this is off the script is executed in one go and the display is not updated until the end of the script. If theUpdate display.. option is off it is possible to force a display update with an 'UpdateDisplay' command in the script.
Replay manually one line at a time The script is displayed in the interface window and replayed one line at a time as the user clicks the Do next button.

Recording

The History&scripting->Review & record command on the Tools pull-down menu will toggle open a window that, in the default history mode, lists all the commands you have entered in this session of the program with options to save some or all commands to a recording file. In the alternative replay mode a recording file is listed and can be replayed or edited.
For some options you will need to select one or more command lines from the window. Do this by clicking on a line with the left mouse button down. To select a range of lines first select one line and then click on the other end of the range using the left mouse button and with the Shift key down. The selected lines are highlighted by a gold background.



The options in history mode are
Clear selection Clear any selection from the window
Replay Script You will be prompted for the name of an existing script file which is replayed immediately and completely
Edit/replay stepwise You will be prompted for the name of an existing script file and the History interface goes into replay mode
Begin recording The button changes to End recording. All commands that you pick from the GUI are marked to be recorded
End recording You are prompted to enter the name of a file. All commands entered since Begin recording are saved to the file
Save selected lines You are prompted to enter the name of a file. All selected command lines are saved to the file

Replaying and Editing

If you select the Edit/replay stepwise and enter the name of an existing recording file then the interface goes into replay mode and displays the contents of the recording file. One line of the recording is highlighted in bold lettering. It is the next line that will be replayed next by default. Lines in the recording can be selected and cleared the same as in history mode.

The options in replay mode are

Do next Do the next command that is highlighted in the window
Go to line Move the next line marker to the first selected line
Run continuously Run the commands from the next line to the end of the recording and exit the replay mode
Quit Exit from replay mode
Insert commands Any commands picked from from anywhere on the interface will be entered into into recording before the next line.
Delete selected lines Delete selected lines from the recording
Save to file Save the current window contents to a file