Thumbnail

Display Popup

by Synthiam

Popup a custom window with custom text to the user from a command

Requires ARC v13 (Updated 9/3/2024) Source Code

How to add the Display Popup robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Display category tab.
  5. Press the Display Popup icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Display Popup robot skill.


How to use the Display Popup robot skill

Use the ControlCommand() to send custom text to this skill, which will be displayed on full screen for a set period. The configuration menu allows you to adjust the text font, text color, and background color. There is a default timeout value as well. All ControlCommand() for this skill can be found in the Cheat Sheet tab. See the video below for an example of use.

Main Window

User-inserted image

1. Display Popup Nothing to interact with. Use the configuration to change parameters such as timeout, text color, background color, and font.

2. Script Use a ControlCommand() script to execute a Display Popup.

Configuration

User-inserted image

1. Default Timeout Numerical Field Enter the default number of seconds you want the popup to stay displayed. It can be overwritten by the ControlCommand() script.

2. Color Buttons Change the color of the popup text and background.

3. Font Change Button  Change the popup font. Use any font that's installed on your device.

How to Use Display Popup

  1. Add the Display Popup skill to your ARC project (Project -> Add Skill -> Misc -> Display Popup).

  2. Change the Display Popup configuration if needed.

  3. Run a Display Popup ControlCommand() script. View your Display Popup until the timeout closes the popup.

*Note: Press any key to close the popup before the timeout expires.

Control Commands

controlCommand("Display Popup", "Display", "Text") controlCommand("Display Popup", "Display", "Text", [timeout seconds]) controlCommand("Display Popup", "Display", "Text", [timeout seconds], [window width], [window height]) controlCommand("Display Popup", "Display", "Text", [timeout seconds], [window width], [window height], [window x location], [window y location])

Code Sample


# use default timeout value
ControlCommand("Display Popup", "Display", "Some text to display")

# use specified 10 second timeout
ControlCommand("Display Popup", "Display", "Some text to display", 10)

# use specified 10 second timeout and specify the window size
ControlCommand("Display Popup", "Display", "Some text to display", 10, 100, 200)
# count to 10
for (var x = 0; x < 10; x++)
   controlCommand("Display Popup", "Display", x, 1);

Resources

Source code available here: DisplayResponse.zip


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

PRO
USA
#9  

Works great.  thanks for the really really fast help.

#10  

@Athena I would like the popup display to take a timer variable and countdown to zero. When it hits zero make the popup display disappear. I want to see the numbers counting down. How do I write the script for this.

PRO
Canada
#11  

To create a countdown timer that updates the Display Popup skill in real-time, you can use a loop in JavaScript to decrement the timer variable and update the popup display. Here's a sample script to achieve this:

  1. Add the Display Popup skill to your ARC project.
  2. Configure the Display Popup skill as needed.
  3. Use the following JavaScript code to create the countdown timer:
// Set the initial countdown time in seconds
var countdownTime = 10;

// Function to update the Display Popup with the current countdown time
function updatePopup() {
    // Display the current countdown time
    controlCommand("Display Popup", "Display", "Countdown: " + countdownTime, 1);

    // Decrement the countdown time
    countdownTime--;

    // If the countdown time is greater than or equal to 0, call the function again after 1 second
    if (countdownTime >= 0) {
        setTimeout(updatePopup, 1000);
    } else {
        // Close the popup when the countdown reaches zero
        controlCommand("Display Popup", "Display", "", 0);
    }
}

// Start the countdown
updatePopup();

Explanation:

  1. Initial Countdown Time: Set the initial countdown time in seconds.
  2. updatePopup Function: This function updates the Display Popup with the current countdown time, decrements the countdown time, and calls itself again after 1 second if the countdown time is greater than or equal to 0.
  3. setTimeout: This function is used to call updatePopup again after 1 second.
  4. Closing the Popup: When the countdown reaches zero, the popup is closed by displaying an empty string with a timeout of 0 seconds.

Steps to Run the Script:

  1. Open the script editor in ARC.
  2. Copy and paste the above JavaScript code into the script editor.
  3. Run the script to start the countdown timer.

This script will display a countdown timer in the popup window, updating every second until it reaches zero, at which point the popup will disappear.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#12  

@Athena ARC does not like your  setTimeout(updatePopup, 1000);  Were you supposed to write it differently for ARC software?

PRO
Canada
#13  

I apologize for the confusion. In ARC, you should use the sleep() function instead of setTimeout() for delays. Here's the corrected script for ARC:

// Set the initial countdown time in seconds
var countdownTime = 10;

// Function to update the Display Popup with the current countdown time
function updatePopup() {
    // Display the current countdown time
    controlCommand("Display Popup", "Display", "Countdown: " + countdownTime, 1);

    // Decrement the countdown time
    countdownTime--;

    // If the countdown time is greater than or equal to 0, call the function again after 1 second
    if (countdownTime >= 0) {
        sleep(1000); // Wait for 1 second
        updatePopup(); // Call the function again
    } else {
        // Close the popup when the countdown reaches zero
        controlCommand("Display Popup", "Display", "", 0);
    }
}

// Start the countdown
updatePopup();

Explanation:

  1. Initial Countdown Time: Set the initial countdown time in seconds.
  2. updatePopup Function: This function updates the Display Popup with the current countdown time, decrements the countdown time, and calls itself again after 1 second if the countdown time is greater than or equal to 0.
  3. sleep(1000): This function is used to wait for 1 second before calling updatePopup again.
  4. Closing the Popup: When the countdown reaches zero, the popup is closed by displaying an empty string with a timeout of 0 seconds.

Steps to Run the Script:

  1. Open the script editor in ARC.
  2. Copy and paste the above JavaScript code into the script editor.
  3. Run the script to start the countdown timer.

This script will display a countdown timer in the popup window, updating every second until it reaches zero, at which point the popup will disappear.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#14  

Actually @athena, the ControlCommand will wait for the display to finish the timeout. So you can do this..

# count to 10
for (var x = 0; x < 10; x++)
  controlCommand("Display Popup", "Display", x, 1);

So, you could use that as a template for counting down from 10...

PRO
Canada
#15  

Thank you for the clarification! Given that the controlCommand will wait for the display to finish the timeout, we can use a loop to count down from 10 and update the Display Popup accordingly. Here's the corrected script for counting down from 10:

// Set the initial countdown time in seconds
var countdownTime = 10;

// Loop to count down from 10 to 0
for (var x = countdownTime; x >= 0; x--) {
    // Display the current countdown time with a 1-second timeout
    controlCommand("Display Popup", "Display", "Countdown: " + x, 1);
}

Explanation:

  1. Initial Countdown Time: Set the initial countdown time in seconds.
  2. Loop: The for loop counts down from the initial countdown time to 0.
  3. Display Popup: The controlCommand updates the Display Popup with the current countdown time and sets a 1-second timeout for each update.

Steps to Run the Script:

  1. Open the script editor in ARC.
  2. Copy and paste the above JavaScript code into the script editor.
  3. Run the script to start the countdown timer.

This script will display a countdown timer in the popup window, updating every second until it reaches zero, at which point the popup will disappear.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.