
Hello All, I’m wondering if there is a way to call the file->open popup within chimera when running a python script? I know that it’s possible to run the script on the command line and read the desired arguments in that way, and obviously the files I want could be coded in and then changed every time I want to look at something new, but I’m not seeing an obvious option from the mailing list or in the runCommand list for writing in a mid-script call for the user to select a file. Is such a thing possible? Thanks for your help, -- Katrina

You can use the "open" command with no arguments to pop up the open dialog. Chimera should wait until you select a file (or cancel) before continuing to the next command (either on the same line or the next line in a script). Conrad On 4/16/2014 5:58 PM, Katrina Lexa wrote:
Hello All,
I’m wondering if there is a way to call the file->open popup within chimera when running a python script? I know that it’s possible to run the script on the command line and read the desired arguments in that way, and obviously the files I want could be coded in and then changed every time I want to look at something new, but I’m not seeing an obvious option from the mailing list or in the runCommand list for writing in a mid-script call for the user to select a file. Is such a thing possible?
Thanks for your help, -- Katrina
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

If the file is something that your script needs to read itself (a list of residue IDs or something) then instead of the "open" command you would do this to get the file path: from OpenSave import OpenModal from chimera.tkgui import app pathsAndTypes = OpenModal(title="Input for script").run(app) 'pathsAndTypes' is a list of 2-tuples. The 2-tuples are the path and file type. So assuming you only want one file, you would get the file path with: path = pathsAndTypes[0][0] --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Apr 17, 2014, at 8:54 AM, Conrad Huang <conrad@cgl.ucsf.edu> wrote:
You can use the "open" command with no arguments to pop up the open dialog. Chimera should wait until you select a file (or cancel) before continuing to the next command (either on the same line or the next line in a script).
Conrad
On 4/16/2014 5:58 PM, Katrina Lexa wrote:
Hello All,
I’m wondering if there is a way to call the file->open popup within chimera when running a python script? I know that it’s possible to run the script on the command line and read the desired arguments in that way, and obviously the files I want could be coded in and then changed every time I want to look at something new, but I’m not seeing an obvious option from the mailing list or in the runCommand list for writing in a mid-script call for the user to select a file. Is such a thing possible?
Thanks for your help, -- Katrina
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

Terrific! Thanks Eric and Conrad. On April 17, 2014 at 10:41:21 AM, Eric Pettersen (pett@cgl.ucsf.edu) wrote: If the file is something that your script needs to read itself (a list of residue IDs or something) then instead of the "open" command you would do this to get the file path: from OpenSave import OpenModal from chimera.tkgui import app pathsAndTypes = OpenModal(title="Input for script").run(app) 'pathsAndTypes' is a list of 2-tuples. The 2-tuples are the path and file type. So assuming you only want one file, you would get the file path with: path = pathsAndTypes[0][0] --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu On Apr 17, 2014, at 8:54 AM, Conrad Huang <conrad@cgl.ucsf.edu> wrote:
You can use the "open" command with no arguments to pop up the open dialog. Chimera should wait until you select a file (or cancel) before continuing to the next command (either on the same line or the next line in a script).
Conrad
On 4/16/2014 5:58 PM, Katrina Lexa wrote:
Hello All,
I’m wondering if there is a way to call the file->open popup within chimera when running a python script? I know that it’s possible to run the script on the command line and read the desired arguments in that way, and obviously the files I want could be coded in and then changed every time I want to look at something new, but I’m not seeing an obvious option from the mailing list or in the runCommand list for writing in a mid-script call for the user to select a file. Is such a thing possible?
Thanks for your help, -- Katrina
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
participants (3)
-
Conrad Huang
-
Eric Pettersen
-
Katrina Lexa