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

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

PRO
Synthiam
#25   — Edited

If you scroll up and read the control commands manuals, it works in seconds only

the FOR statement is a loop.

@athena explain what a FOR loop is and each part of this

for (var x = 10; x > 0; x--) controlCommand("Display Popup", "Display", x, 1);
PRO
Canada
#26  

Sure, let's break down the for loop and how it works in the context of your script. A for loop in JavaScript (and many other programming languages) is used to repeat a block of code a certain number of times. It consists of three main parts: initialization, condition, and iteration.

Here's the structure of a for loop:

for (initialization; condition; iteration) {
    // Code to be executed
}

Explanation of Each Part:

  1. Initialization: This part is executed once before the loop starts. It is typically used to initialize a counter variable.
  2. Condition: This part is evaluated before each iteration of the loop. If the condition is true, the loop continues; if it is false, the loop stops.
  3. Iteration: This part is executed after each iteration of the loop. It is typically used to update the counter variable.

Your Specific for Loop:

for (var x = 10; x > 0; x--) {
    controlCommand(Display Popup, Display, x, 1);
}
  • Initialization: var x = 10; - This initializes the counter variable x to 10.
  • Condition: x > 0; - This checks if x is greater than 0. If it is, the loop continues; if not, the loop stops.
  • Iteration: x-- - This decrements the counter variable x by 1 after each iteration.

How to Modify for Tenths or Hundredths:

To count down in tenths or hundredths, you need to adjust the initialization, condition, and iteration parts of the loop accordingly. Here's how you can do it:

Counting Down in Tenths:

for (var x = 10.0; x > 0; x -= 0.1) {
    controlCommand(Display Popup, Display, x.toFixed(1), 0.1, 100, 200);
    sleep(100); // Sleep for 100 milliseconds (0.1 seconds)
}

Counting Down in Hundredths:

for (var x = 10.0; x > 0; x -= 0.01) {
    controlCommand(Display Popup, Display, x.toFixed(2), 0.01, 100, 200);
    sleep(10); // Sleep for 10 milliseconds (0.01 seconds)
}

Full Script Example for Hundredths:

for (var x = 10.0; x > 0; x -= 0.01) {
    controlCommand(Display Popup, Display, x.toFixed(2), 0.01, 100, 200);
    sleep(10); // Sleep for 10 milliseconds (0.01 seconds)
}

Explanation:

  • Initialization: var x = 10.0; - Initializes the counter variable x to 10.0.
  • Condition: x > 0; - Checks if x is greater than 0.
  • Iteration: x -= 0.01 - Decrements the counter variable x by 0.01 after each iteration.
  • Display Command: controlCommand(Display Popup, Display, x.toFixed(2), 0.01, 100, 200); - Updates the popup with the current value of x, formatted to two decimal places.
  • Sleep: sleep(10); - Pauses the script for 10 milliseconds (0.01 seconds) to allow the display to update.

This script will count down from 10.00 to 0.00 in hundredths of a second, updating the display every 0.01 seconds.


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.
PRO
Synthiam
#27  

Now remember you can count down in 10th if a second but the robot skill only accepts seconds. The lowest it’ll go is 1 second.

#28  

Ahh, now it makes sense. Cannot make a skill go down to hundredths if it's not made to do it as the lowest it can go is 1 second. The code made sense on earlier versions but then when I ran it  would take a second regardless of how I had put in .01. Thanks