Author: bugman Date: Fri Aug 26 12:37:10 2011 New Revision: 14483 URL: http://svn.gna.org/viewcvs/relax?rev=14483&view=rev Log: Built the back end of the molmol.macro_run user function. Modified: 1.3/generic_fns/molmol.py Modified: 1.3/generic_fns/molmol.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/molmol.py?rev=14483&r1=14482&r2=14483&view=diff ============================================================================== --- 1.3/generic_fns/molmol.py (original) +++ 1.3/generic_fns/molmol.py Fri Aug 26 12:37:10 2011 @@ -231,6 +231,24 @@ # Loop over the commands and execute them. for command in commands: + molmol_obj.exec_cmd(command) + + +def macro_run(file=None, dir=None): + """Execute the Molmol macro from the given text file. + + @keyword file: The name of the macro file to execute. + @type file: str + @keyword dir: The name of the directory where the macro file is located. + @type dir: str + """ + + # Open the file for reading. + file_path = get_file_path(file, dir) + file = open_read_file(file, dir, force) + + # Loop over the commands and apply them. + for command in file.readlines(): molmol_obj.exec_cmd(command)