Handle pymol via CUI.

I often use Pymol to visualize PDB files.
Recently I want to merge some PDB files in one Pymol session file from CUI.
Because I run the task as batch. So I searched API document and tried it.
At first I need launch pymol in silent mode ( no GUI ).
And then load pdb files.
Next I set color of each object by b factor as spectrum.
Finally save object as pymol session file and closed pymol.
Every thing worked well.

Following code and sample files are pushed my repo.
https://github.com/iwatobipen/pymolscript

#test

import pymol
from pymol import cmd
pymol.finish_launching(['pymol','-qc'])
cmd.load('1atp.pdb')
cmd.load('1atp2.pdb')
cmd.load('1atp3.pdb')
cmd.spectrum('b', 'blue_white_red','1atp', 0, 100)
cmd.spectrum('b', 'yellow_cyan_blue','1atp2', 0, 100)
cmd.spectrum('b', 'green_magenta','1atp3', 0, 100)
cmd.save('somecolors.pse')
pymol.finish_launching()