﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
7172	Allow substituting arguments in a .cxc file command script	p.shah.lab@…	Tom Goddard	"Pranav Shah asked how to use two filename arguments to a *.cxc command script.  Maybe the runscript command could be enhanced to work with .cxc files (currently just Python files) and substitute arguments for $1, $2, $3 ... in the .cxc file.

{{{
On Jun 24, 2022, at 5:57 AM, Pranav Shah via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Hi Team,
Is it possible for one to declare a variable in a command file that
can then be passed to via the chimeraX command line interface. A
minimal example of something I would like to do is -
command.cxc
open $file
color radial palette rainbow
save $outfile.png height 512 width 512 transparentBackground True

In the chimeraX command line window I would then like to run
open command.cxc infile.mrc outfile.png
Best,
Pranav
}}}


{{{
From: Tom Goddard
Subject: Re: [chimerax-users] using variables in command files
Date: June 24, 2022 at 12:09:06 PM PDT
To: Pranav Shah
Cc: ChimeraX Users Help <chimerax-users@cgl.ucsf.edu>

Hi Pranav,

 Currently ChimeraX does not have a way to substitute argument values into a *.cxc file except for the open command ""foreach"" option which allows substituting the file name in for $file.  For simple series of commands you could define an alias, for example,

	alias radcolor open $1 ; color radial palette rainbow ; save $2 height 512 width 512 transparentBackground true

This defines the radcolor command that you can use like

	radcolor mymap.mrc image.png

Here's the documentation for the ""alias"" command

	https://www.cgl.ucsf.edu/chimerax/docs/user/commands/alias.html

The other mechanism for handing arguments to a script is the ""runscript"" command which passes arguments to Python scripts only.  I could imagine runscript being enhanced so that it works with a *.cxc command script and substitutes arguments in for $1, $2, $3, ... occurring in the script.

	https://www.cgl.ucsf.edu/chimerax/docs/user/commands/runscript.html

 Tom

}}}
"	enhancement	closed	moderate		Input/Output		fixed		Elaine Meng				all	ChimeraX
