[chimerax-users] pause/wait read user input in chimerax script
Tom Goddard
goddard at sonic.net
Fri Mar 12 10:50:38 PST 2021
Hi Andrew,
Another example of a web page with links you click to execute one or multiple commands is the ChimeraX quick start guide, menu Help / Quick Start Guide.
I did not know about the Chimera pause command. And I made something similar for ChimeraX that I called the "next" command. It is not part of ChimeraX yet, I used it for making an augmented reality movie. The way "next" worked is that it ran a command script ("next myscript.cxc") until it hit the first blank line, then if I run the "next" command (no arguments) -- I assigned a VR hand controller button to do that -- then it runs the next group of commands until it hits a blank line. So the command script is just blocks of commands separated by blank lines. The script itself doesn't contain any "next" or "pause".
I see that the Chimera pause command prevents you from using any Chimera menus or tools while paused. It does let you rotate the model with the mouse. So basically you can just rotate and then run more commands. The "next" command allows doing anything you want before you run the next set of commands, so it is pretty powerful. For my movie making I used "next" to hide and show different sets of models, and then by hand I could change the display of those models, change a density map contour level, ..., so I could mix the script actions with interactive actions.
Tom
> On Mar 12, 2021, at 9:09 AM, Elaine Meng <meng at cgl.ucsf.edu> wrote:
>
> Hi Andrew,
> Chimera had a "pause" command that waited for a key press, but ChimeraX does not have that command currently.
>
> If you want to have a list of commands that you control when each one executes, you can instead make a special HTML file so that the commands will execute only when you click them, like some of our tutorials. You have to open the HTML file in ChimeraX (e.g. with command "open <URL>" or "open localfile.html") for this mechanism to work.
>
> There is a special "execute command" HTML tag described here:
> <https://www.rbvi.ucsf.edu/chimerax/docs/user/tools/helpviewer.html>
>
> It's a bit more work than just listing the commands, but mostly you would just have to enter each command twice, both in the displayed text and in the execution tag for that text.
>
> For more examples, you can view source of the tutorials that use this capability, e.g.:
>
> Protein-Ligand Binding Sites:
> <https://www.rbvi.ucsf.edu/chimerax/docs/user/tutorials/binding-sites.html>
>
> CryoEM Visualization:
> <https://www.rbvi.ucsf.edu/chimerax/data/stanford-jul2019/tutorial2.html>
>
> I hope this helps,
> Elaine
> -----
> Elaine C. Meng, Ph.D.
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>
>> On Mar 12, 2021, at 5:31 AM, andrew <atmp1 at protonmail.com> wrote:
>>
>> Greetings,
>> I would be grateful for help with a script.
>> I made a .cxc script.
>> Now, I would like to show somebody the steps, one by one as in
>> I download this [return]
>> I select that [return]
>> colour these [return]
>>
>> but I cannot see how to insert a pause/wait or something that waits on keyboard input. I did try to insert a "runscript" and put some lines in a python script that reads from the keyboard, but it looks as if chimerax has redirected the script's stdin.
>> I have a feeling, that if I knew what I was doing, I could put another line in the python script "import chimerax.core" and read until the next newline from the command line.
>>
>> Is there a way to pause after each line in a script ?
>> Many thanks for any advice.
>>
>> _______________________________________________
>> ChimeraX-users mailing list
>> ChimeraX-users at cgl.ucsf.edu
>> Manage subscription:
>> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
More information about the ChimeraX-users
mailing list