You can do input arguments to your script.

#!/usr/bin/env python
import sys, os
try: pathtoscripts = sys.argv[1]
except: pathtoscripts = ""


Then:
example.py /my/dir/home


Or else i would try to make a script, and import pymol as module.
I dont really know how to do this.


Troels Emtekær Linnet



2012/5/8 Rituparna Sengupta <rsengupta@wisc.edu>
Hi,

I'm wondering if anyone could tell me if there is a way of running a plugin in batch mode. I tried running it as a script but does not work when I use pymol -c or pymol -cq. The script has multiple arguments in the form of a list. I assign the variables to a list and then use that list to run the script. It works when the GUI is open (because I can assign values to a variable), but doesn't when I use -c or -cq (can't assign values from the command line.


File name: example.py


I used the extend command to extend the plugin to the command line (as described in the plugin tutorial). The end of the file has something like this:


def dosomething(app):


 a=tkSimpleDialog.askstring('sumthing',
 'Enter variable: ',
 parent=app.root)
 b=tkSimpleDialog.askstring('sumthing',
 'Enter variable: ',
 parent=app.root)

 c=tkSimpleDialog.askinteger('sumthing',
 'Enter variable: ',
 parent=app.root)
 info=[a, b, c]
 do_Something(info)


cmd.extend('do_Something', do_Something)




When the GUI is open, I assign the values of a, b and c to a variable string like: inf=['a', 'b', c]; by typing into the pymol command line. Then I can run the plugin using: do_Something(inf)
But I can't assign the values of a, b, and c to inf when using batch mode. I don't know how to. If anybody has any suggestions, please let me know. I'll be grateful for any advice.
Thanks in advance


Ritu

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net