<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Shubham,<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>As far as I know, there is no way to get the Shell tool to start up with a script executing in it. I think what you need to do is have the script do all the heavy lifting. For one thing, it can get the path of the session file with code like this:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>from chimera.ui.open_save import OpenDialogWithMessage</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>dialog = OpenDialogWithMessage(message="Choose the session file containing the structure to be analyzed", caption="Open Session")</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>session_format = session.data_formats["ChimeraX session"]</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>dialog.setNameFilter(session.data_formats.qt_file_filter(session_format))</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>paths = dialog.selectedFiles()</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>if not paths:</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span># user cancelled dialog</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>from chimerax.core.errors import CancelOperation</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>raise CancelOperation("script cancelled by user")</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>session_path = paths[0]</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span># probably use an "open" command to open the session</div><div class=""><br class=""></div><div class="">You would do a similar thing for the residues text file, except you probably would skip the setNameFilter() call since there is no particular suffix you are looking for.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>So the tricky part is getting residue-pair choices from the user interactively. In an ideal world you would use Qt to create a dialog with a list of residue pairs in it, and clicking on an item in the list would visualize the pair. That's the approach I would use since I am familiar with Qt, but if you aren't then that's a pretty big learning curve for what you want to accomplish. Nonetheless, if that's what you'd like to do, just let me know and I'll provide some pointers.</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Alternatively, a simpler approach is to leverage the fact that ChimeraX supports special HTML links that execute commands. So you would write out an HTML file with a link for every residue pair and the user could click on links to visualize the corresponding pair. The file would have a bunch of lines like:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><a href="cxcmd:sel :14,27; view sel">Residues 14 and 27</a></div><div class=""><br class=""></div><div class="">or whatever commands you wanted to execute when the link is clicked, plus any other HTML you wanted to put in it. You would then just use the "open" command to open the HTML file and it will show up in a window.</div><div class=""><br class=""></div><div class=""><div class="">--Eric</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Eric Pettersen</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>UCSF Computer Graphics Lab</div><div class=""><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On May 22, 2022, at 10:51 PM, Shubham Devesh Ramgoolam via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Hi all,</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">I hope you are doing well.</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">I have a python script that allows the user to visualize specific residue pairs.</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Here is an overview of how the script functions:</div><ul type="disc" style="margin-bottom: 0in; margin-top: 0in;" class=""><li class="MsoListParagraph" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Ask the user to input the path of a .cxs file (created previously) and a text file containing the pairs to be visualized</li><li class="MsoListParagraph" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Print the names of the pairs along a uniquely assigned number</li><li class="MsoListParagraph" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Ask the user to input a number in order to visualize the pair assigned to it</li></ul><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">To run the script currently, I have to do the following: i)Open chimerax ii)Show the shell iii) Call the script from the shell</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Now, is it possible to include some codes in the script that would allow me to just open chimerax, click on File -> Open -> this script, and then the shell would show up and the execution would continue there?</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Right now, if I ran the script using File -> Open -> this script, I would get this error:</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Traceback (most recent call last):<br class="">File "C:/Users/Shubham/Desktop/this_script.py", line 8, in<span class="Apple-converted-space"> </span><br class="">session_path = input('Enter file (.cxs) to be visualized with path: \n')<br class="">RuntimeError: input(): lost sys.stdin<span class="Apple-converted-space"> </span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Regards,</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Shubham</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Sent from<span class="Apple-converted-space"> </span><a href="https://go.microsoft.com/fwlink/?LinkId=550986" style="color: blue; text-decoration: underline;" class="">Mail</a><span class="Apple-converted-space"> </span>for Windows</div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">ChimeraX-users mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:ChimeraX-users@cgl.ucsf.edu" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">ChimeraX-users@cgl.ucsf.edu</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Manage subscription:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a></div></blockquote></div><br class=""></div></div></body></html>