actiona icon indicating copy to clipboard operation
actiona copied to clipboard

Non-blocking Message Box

Open pranjal-joshi opened this issue 3 years ago • 4 comments

Hello, I am looking to implement the following logic.

1. Show a message box.
2. Start a task that takes a long time.
3. Don't wait for the user to click the message box. Just use it as displaying something like "Processing, Please wait.."
4. Close the message box once the task finishes.

How to create a message box and go to the next line without closing or timeout the message box? I want it open while the task runs in the background!

pranjal-joshi avatar Feb 19 '22 07:02 pranjal-joshi

You can launch through command object a parallel message box using another tool such as yad. Or possibly two Actiona processes (each launched by actexec) which intercommunicate in parallel? Just use Actiona with other tools in a toolchain.

datavectors avatar Mar 20 '22 13:03 datavectors

You can write some code creating a MessageBox. You can then call show and close to display a non-modal message box.

Jmgr avatar Apr 09 '22 09:04 Jmgr

I have just tried this in a Code object but no MessageBox shows.

I am in Ubuntu 20.04 with Actiona 3.10.1.


// MessageBox object
// https://wiki.actiona.tools/doku.php?id=en:code:windows:messagebox

var myObject = new MessageBox({
	title: "Press yes or no",
	icon: MessageBox.Warning,
	buttons: MessageBox.Yes | MessageBox.No
});

myObject.show();


datavectors avatar Apr 09 '22 10:04 datavectors

The issue is that this code will not block the execution of the script, so the messagebox is probably shown and instantaneously closed because the script has finished running.

Try with this script:

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actiona" version="3.10.1" scriptVersion="1.1.0" os="GNU/Linux"/>
    <actions>
        <action name="ActionPause" version="1.0.0"/>
        <action name="ActionCode" version="1.0.0"/>
    </actions>
    <parameters/>
    <resources/>
    <script pauseBefore="0" pauseAfter="0">
        <action name="ActionCode">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="code">
                <subParameter name="value" code="1">var myObject = new MessageBox({
	title: &quot;Press yes or no&quot;,
	icon: MessageBox.Warning,
	buttons: MessageBox.Yes | MessageBox.No
});

myObject.show();</subParameter>
            </parameter>
        </action>
        <action name="ActionPause">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="duration">
                <subParameter name="value" code="0">30</subParameter>
            </parameter>
            <parameter name="unit">
                <subParameter name="value" code="0">seconds</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>

Jmgr avatar Apr 12 '22 20:04 Jmgr