It works. Thanks for the quick reply.
Original Message:
Sent: Wed September 03, 2025 04:32 AM
From: Sabine Rein
Subject: Carriage returns in HAScript prompt windows?
Hi John, here's the solution for radio buttons:
<HAScript name="test" description="0" timeout="20000" pausetime="20" promptall="true" blockinput="false" author="sabine rein" creationdate="09 2025" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true" continueontimeout="false">
<import>
<type class="javax.swing.JLabel" name="JavaLabel"/>
<type class="java.awt.GridLayout" name="JavaGridLayout"/>
<type class="javax.swing.JOptionPane" name="JavaOptionPane"/>
<type class="javax.swing.JPanel" name="JavaPanel"/>
<type class="javax.swing.JRadioButton" name="JavaRadioButton"/>
<type class="javax.swing.ButtonGroup" name="JavaButtonGroup"/>
</import>
<vars>
<create name="$option1$" type="JavaRadioButton" />
<create name="$option2$" type="JavaRadioButton" />
<create name="$group$" type="JavaButtonGroup" />
<create name="$panel$" type="JavaPanel" />
<create name="$returnValue$" type="integer" />
<create name="$selectedOption$" type="string" />
</vars>
<screen name="start" entryscreen="true" exitscreen="false" transient="false">
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
</description>
<actions>
<!-- Panel with 3 rows, 1 col -->
<varupdate name="$panel$" value="$new JavaPanel($new JavaGridLayout(3, 1)$)$" />
<!-- create options -->
<varupdate name="$option1$" value="$new JavaRadioButton('Novelty Deodorants')$" />
<varupdate name="$option2$" value="$new JavaRadioButton('Light Bulbs')$" />
<!-- Group for exclusivity (only one option can be selected) -->
<varupdate name="$group$" value="$new JavaButtonGroup()$" />
<perform value="$group.add($option1$)$" />
<perform value="$group.add($option2$)$" />
<!-- add to panel -->
<perform value="$panel.add($new JavaLabel('please choose an option:')$)$" />
<perform value="$panel.add($option1$)$" />
<perform value="$panel.add($option2$)$" />
<!-- show dialog -->
<varupdate name="$returnValue$" value="$JavaOptionPane.showConfirmDialog(null, $panel$, 'test', 2, 2)$" />
<!-- check selected option -->
<if condition="$option1.isSelected()$">
<varupdate name="$selectedOption$" value="'Novelty Deodorants'" />
</if>
<if condition="$option2.isSelected()$">
<varupdate name="$selectedOption$" value="'Light Bulbs'" />
</if>
<!-- check dialog result -->
<if condition="$returnValue$ == 0">
<message title="'test'" value="'Auswahl: ' + $selectedOption$" />
</if>
<if condition="$returnValue$ != 0">
<message title="'exit'" value="'exit'" />
</if>
</actions>
<nextscreens timeout="0">
<nextscreen name="end" />
</nextscreens>
</screen>
<screen name="end" entryscreen="false" exitscreen="true" transient="false">
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
</description>
<actions>
</actions>
</screen>
</HAScript>
------------------------------
Sabine Rein
Original Message:
Sent: Tue September 02, 2025 05:45 PM
From: John Pimentel
Subject: Carriage returns in HAScript prompt windows?
I like what you did with Java to get it to work. There was a question from someone about using radio buttons to select a value vs using a prompt to type the values. I know using Java you can do this but not sure how to get it to work with the ha scripting. Thanks
John
------------------------------
John Pimentel
Original Message:
Sent: Sat August 30, 2025 06:08 AM
From: Sabine Rein
Subject: Carriage returns in HAScript prompt windows?
Hi, found the solution:
<HAScript name="test" description="0" timeout="20000" pausetime="20" promptall="true" blockinput="false" author="sabine rein" creationdate="09 2025" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true" continueontimeout="false">
<import>
<type class="javax.swing.JLabel" name="JavaLabel"/>
<type class="java.awt.GridLayout" name="JavaGridLayout"/>
<type class="javax.swing.JOptionPane" name="JavaOptionPane"/>
<type class="javax.swing.JTextField" name="JavaTextField"/>
<type class="javax.swing.JPanel" name="JavaPanel"/>
</import>
<vars>
<create name="$str_deo$" type="string" />
<create name="$str_bulbs$" type="string" />
<create name="$panel$" type="JavaPanel" />
<create name="$deo$" type="JavaTextField" />
<create name="$bulbs$" type="JavaTextField" />
<create name="$returnValue$" type="integer" />
</vars>
<screen name="start" entryscreen="true" exitscreen="false" transient="false">
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
</description>
<actions>
<varupdate name="$panel$" value="$new JavaPanel($new JavaGridLayout(2, 2)$)$" />
<perform value="$panel.add($new JavaLabel('Novelty Deodorants:')$)$" />
<varupdate name="$deo$" value="$new JavaTextField()$" />
<perform value="$panel.add($deo$)$" />
<perform value="$panel.add($new JavaLabel('Light Bulbs:')$)$" />
<varupdate name="$bulbs$" value="$new JavaTextField()$" />
<perform value="$panel.add($bulbs$)$" />
<varupdate name="$returnValue$" value="$JavaOptionPane.showConfirmDialog(null, $panel$, 'test', 2, 2)$" />
<if condition="$returnValue$ == 0">
<varupdate name="$str_deo$" value="$deo.getText()$" />
<varupdate name="$str_bulbs$" value="$bulbs.getText()$" />
<message title="'test'" value="'deo: ' + $str_deo$ + ', bulbs: ' + $str_bulbs$" />
</if>
<if condition="$returnValue$ != 0">
<message title="'exit'" value="'exit'" />
</if>
</actions>
<nextscreens timeout="0">
<nextscreen name="end" />
</nextscreens>
</screen>
<screen name="end" entryscreen="false" exitscreen="true" transient="false">
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
</description>
<actions>
</actions>
</screen>
</HAScript>
------------------------------
Sabine Rein
Original Message:
Sent: Thu June 20, 2024 04:00 PM
From: Christopher Verdon
Subject: Carriage returns in HAScript prompt windows?
I'm working on a way to quickly enter repetitive text into the terminal window. It'd really help if when I make a prompt pop up if the text in the window, or as it's called the "prompt name" could have multiple lines of text. So far everything I've tried to put in the string or concatenate into the string has failed. For example I've tried using character codes like and formatting codes like \n, but I've had no luck. This is mostly just a side project I do on my breaks but any input would be appreciated. I've included a shot of what I've started. Where it says the 2 kinds of commodities is where I'd like to break it up.
------------------------------
Christopher Verdon
------------------------------