Skip to content

Can commands in a BUTTON be spread over multiple lines for readability? #159

Closed
@jhayes-apl

Description

@jhayes-apl

I am trying to create a screen that controls a power supply (via the TEMPLATE protocol). The user will fill in the voltages and currents (via TEXTFIELDs). There will be a button that sends the commands to set up the power supply. I can put all the commands on a very long line. To make it easier to read, is it possible to spread commands over multiple lines in the screen file? I tried some experiments in this screen:

SCREEN AUTO AUTO 1.0

HORIZONTALBOX
  BUTTON 'Test1' 'api.cmd("POWER VOLTAGE_SET with CHANNEL 3, VOLTAGE 4.0"); api.cmd("POWER VOLTAGE_SET with CHANNEL 4, VOLTAGE 5.0")'
  BUTTON 'Test2' "api.cmd('POWER VOLTAGE_SET with CHANNEL 3, VOLTAGE 4.0'); api.cmd('POWER VOLTAGE_SET with CHANNEL 4, VOLTAGE 5.0')"
  BUTTON 'Test3' "api.cmd('POWER VOLTAGE_SET with CHANNEL 3, VOLTAGE 4.0');
api.cmd('POWER VOLTAGE_SET with CHANNEL 4, VOLTAGE 5.0')"
  BUTTON 'Test3a' "api.cmd('POWER VOLTAGE_SET with CHANNEL 3, VOLTAGE 4.0');" +
"api.cmd('POWER VOLTAGE_SET with CHANNEL 4, VOLTAGE 5.0')"
  BUTTON 'Test3b' "api.cmd('POWER VOLTAGE_SET with CHANNEL 3, VOLTAGE 4.0');" + \
"api.cmd('POWER VOLTAGE_SET with CHANNEL 4, VOLTAGE 5.0')"
  BUTTON 'Test4' "api.cmd('POWER VOLTAGE_SET with CHANNEL 3, VOLTAGE 4.0');\
api.cmd('POWER VOLTAGE_SET with CHANNEL 4, VOLTAGE 5.0')"
END

Here are the results:

  • Test1: works, but one long line
  • Test2: also works same using different quotes
  • Test3 error: Syntax error ... literal not terminated before end of script
  • Test3a: no errors, but second command is not sent
  • Test3b: no errors, but second command is not sent
  • Test4: error: Syntax error ... literal not terminated before end of script

Any suggestions?
I am using COSMOS 5.0.4 on Linux.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions