Omron HVC-P2 icon Omron HVC-P2 Omron HVC-P/HVC-P2 ARC plugin: Python-based camera integration for body, hand and face detection, gaze, age/gender, expressions and face recognition. Try it →
Asked

ARC Keeps Blocking Windows Shutdown

I'm having an occasional issue with Windows shutting down when using the Utility.shutdownPC(); command from an ARC script.

Background and setup:

  • I have a looping JavaScript script in ARC that watches a button on my robot. The button is read by an EZ-B v4 ADC port and triggers the script when the voltage changes.
  • The PC running ARC (Windows 11) is mounted on the robot and connected to three EZ-B v4 controllers via USB-to-Serial converter cables (EZ-Bs are connected to the PC via USB).
  • The script sends ControlCommand calls to various Robot Skills (Soundboard v4, Bender, Head Section, Left Arm, Right Arm, etc.) and then calls Utility.shutdownPC(); to shut down the onboard Windows 11 PC.

Problem: This process has worked reliably for a long time, but within the past week or so I’ve started seeing intermittent failures. When the shutdown hangs, Windows shows a message saying something like "ARC is still running and keeping the PC from shutting down" and offers a button to end ARC. If I choose that option, ARC appears to terminate and Windows then completes the shutdown.

Notes on troubleshooting I’ve tried or considered:

  • I do not allow Windows Update to update my Windows 11 OS, so I don’t think a Windows update is the cause.
  • I checked ARC’s settings and enabled "Do not display exit confirmation when exiting," but the same occasional hang still happens. I seem to recall that in the past I had that setting disabled and Utility.shutdownPC(); still shut down Windows without my intervention.
  • I’ve read suggestions online (e.g., adding switches like /s /f /t 0 to the shutdown command and disabling Fast Startup). Fast Startup is currently enabled on my PC. I haven’t tried these Windows-level changes yet.

Here is the shutdown script I’m using (triggered by the EZ-B ADC port):

ControlCommand("Personality Generator", "PauseOn");
sleep(250);
ControlCommand("Head Section", "ScriptStart", "Bubble Full Up");
ControlCommand("Head Section", "ScriptStart", "Radar 1/4 Sweep");

var Goodbye = Utility.getRandomUnique(1, 12);
print("Goodbuy: " + Goodbye)

if (Goodbye == 1) {
ControlCommand("Soundboard v4", "Track_9");//say "Hasta La Vista"
sleep(2500);
}
else if (Goodbye == 2) {
ControlCommand("Soundboard v4", "Track_10");//say "Love Long & Prosper"
sleep(2750);
}
else if (Goodbye == 3) {
ControlCommand("Soundboard v4", "Track_36");//say "So it Goes"
sleep(2500);
}
else if (Goodbye == 4) {
ControlCommand("Soundboard v4", "Track_83");//say "Pleasure to Serve"
sleep(3500);
}
else if (Goodbye == 5) {
ControlCommand("Soundboard v4", "Track_84");//say "Goodby"
sleep(1750);
}
else if (Goodbye == 6) {
ControlCommand("Soundboard v4", "Track_91");//say "May the Force be with you"
sleep(2750);
}
else if (Goodbye == 7) {
ControlCommand("Soundboard 2", "Track_19");//say "My Power Pack needs charging"
sleep(4500);
}
else if (Goodbye == 8) {
ControlCommand("Bender", "Track_28");//Say "Shows Over"
sleep(3000);
}
else if (Goodbye == 9) {
ControlCommand("Bender", "Track_36");//Say "Wanna Kill All Humans?"
sleep(3500);
}
else if (Goodbye == 10) {
ControlCommand("Bender", "Track_30");//Say "So Long Coffin Stuffers"
sleep(3500);
}
else if (Goodbye == 11) {
ControlCommand("Bender", "Track_3");//Say "Bite My Shiny Ass"
sleep(3500);
}

ControlCommand("Head Section", "ScriptStart", "Bubble Full Down");
ControlCommand("Left Arm", "ScriptStart", "Left Claw Closed");
ControlCommand("Right Arm", "ScriptStart", "Right Claw Closed");
sleep( 1000 );

Utility.shutdownPC();

I’m totally open to suggestions or an updated script to resolve this intermittent shutdown issue where it appears ARC is preventing Windows from shutting down. Thanks!



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skills (view all robot skills)
Script by Synthiam
Multi-language ARC Script: build, run and debug Blockly, JavaScript, EZ-Script or Python with Intellisense, run/save/load and Roboscratch support
Task Script by Synthiam Inc.
Split complex robot tasks into sequential scripts, synchronizing asynchronous skills via NEXT/CANCEL commands for staged automation.

ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#1  

That’s windows for ya who knows what updates do shrug

I can say that any looping scripts need to be stopped. If scripts are reading or writing to peripherals, that’s hardware messaging and windows controls that. So send stop commands to all your scripts from the shutdown script.

I think there’s an option in preferences to disable close dialog. Want to disable that too.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#2  

What you’re seeing is consistent with Windows waiting for ARC to fully exit, and the most common cause is exactly what DJ mentioned: one or more scripts are still running when Utility.shutdownPC() is called.

Because your shutdown script is triggered from a looping watcher script, the watcher itself may still be active long enough to keep ARC "busy" during shutdown. If any other scripts are also running, Windows can decide ARC is still preventing the shutdown.

What to change

1) Stop any looping scripts first

Before calling Utility.shutdownPC();, explicitly stop the scripts that may still be running.

If your watchdog script is separate from the shutdown script, use ControlCommand(..., "Stop") on it and any other loops or timers.

Example pattern:

ControlCommand("Personality Generator", "PauseOn");
sleep(250);

// Stop any scripts that might still be running
ControlCommand("Main Watcher", "Stop");
ControlCommand("Head Section", "ScriptStop");
ControlCommand("Left Arm", "ScriptStop");
ControlCommand("Right Arm", "ScriptStop");

// optional: give ARC a moment to settle
sleep(500);

// now do your shutdown sequence
Utility.shutdownPC();

The exact command name depends on the skill. For Script Collection, use ScriptStop or ScriptStart as appropriate. For regular Script controls, stopping the script that launched the shutdown logic is the key goal.

2) Avoid calling shutdown from inside the looping monitor itself

If possible, have the watcher script set a flag and let a separate one-shot shutdown script handle the actual shutdown.

For example:

  • Watcher detects button press
  • Watcher sets "$shutdownRequested" = true
  • A separate script reacts and performs shutdown

That reduces the chance the monitoring loop is still active when Windows begins closing ARC.

3) Add a small delay after stopping scripts

A short pause helps ARC finish any pending hardware commands before Windows starts shutdown.

sleep(1000);
Utility.shutdownPC();

4) Check the ARC exit confirmation setting

You already found the relevant setting:

  • Preferences
  • Disable Do not display exit confirmation when exiting
    or, if the wording is the inverse in your version, make sure ARC is allowed to close without prompting.

If Windows is still asking whether to end ARC, that means ARC didn’t exit cleanly enough before shutdown.

5) Consider Windows Fast Startup

Fast Startup can sometimes make shutdown behavior odd, especially on systems that are doing hardware/USB control like ARC. Disabling it is worth testing if this only started recently.

Suggested shutdown script structure

Here’s a cleaner version of your shutdown flow:

ControlCommand("Personality Generator", "PauseOn");
sleep(250);

// stop any active scripts/loops first
ControlCommand("Main Watcher", "ScriptStop");
ControlCommand("Head Section", "ScriptStop");
ControlCommand("Left Arm", "ScriptStop");
ControlCommand("Right Arm", "ScriptStop");

// let ARC finish sending commands
sleep(500);

// play shutdown actions
ControlCommand("Head Section", "ScriptStart", "Bubble Full Up");
ControlCommand("Head Section", "ScriptStart", "Radar 1/4 Sweep");

var goodbye = Utility.getRandomUnique(1, 12);
print("Goodbye: " + goodbye);

// your audio choices here...
// ...

sleep(1000);
Utility.shutdownPC();

Best practice recommendation

For reliability, I’d strongly recommend:

  • one looping watcher script
  • one separate shutdown script
  • watcher only triggers shutdown
  • shutdown script stops the watcher first, then performs final actions, then shuts down Windows

That pattern is much more stable in ARC.

A couple questions so I can narrow this down

  1. Is the button-watch script the same script that calls Utility.shutdownPC();, or does it start a second script?
  2. Are any of those ControlCommand(..., "ScriptStart", ...) calls launching scripts that loop or wait on sensors/audio?
  3. Do you know whether the script running the shutdown is inside a Script Collection or a regular Script skill?

If you want, I can help you rewrite this into a more robust two-script ARC pattern using JavaScript so the shutdown is much less likely to hang.


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.
Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#3  

From top menu -> Options -> Preferences -> Do not display exit confirmation (make sure that's checked)

User-inserted image

#4  

@DJ and @Athena , thanks for the help. I appreciate your personal care and taking the time to answer with your welcomed suggestions.

Actually in my first post I did mention I had already checked the "Do not display exit confirmation" in ARC's Option/Preferences section with no results.

I'll move forward with your suggestion of making sure all my looping scripts are shut down before I send the shutdown PC command. I do have a few of them so that makes sense.

I'll let you know how it works. Thanks again!

#5  

Oh, BTW, I am using a two script method. I actually do have just one script that loops and watched several (maybe 12 or so) buttons and switches. I had @Athena help me write it a few months ago. So I only have one script that keeps track of the ADC values of these dozen switches and buttons. Adding a StopScript command to the shutdown PC script for that one looping script will be quick and easy. I'll keep you posted.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#6  

That sounds like the right approach.

Since you only have one looping watcher script, adding a ScriptStop for that script right before Utility.shutdownPC(); is the cleanest fix. That should prevent ARC from still being "busy" when Windows starts the shutdown sequence.

A good pattern would be:

ControlCommand("Personality Generator", "PauseOn");
sleep(250);

// stop the looping monitor first
ControlCommand("Your Watcher Script Name", "ScriptStop");

// give ARC a brief moment to settle
sleep(500);

// do any final actions
ControlCommand("Head Section", "ScriptStart", "Bubble Full Up");
ControlCommand("Head Section", "ScriptStart", "Radar 1/4 Sweep");

// ...your goodbye audio logic here...

sleep(1000);
Utility.shutdownPC();

A couple of important notes

  • Replace "Your Watcher Script Name" with the actual name of the looping Script control.
  • If that watcher script is the one that triggered the shutdown, stopping it first is especially important.
  • If you still see occasional hangs after that, the next thing to test is adding a slightly longer delay after ScriptStop - for example sleep(1000); or even sleep(1500); before the shutdown.

Why this helps

Your loop is constantly reading ADC values, which means ARC is actively talking to hardware. If Windows begins shutdown while that loop is still running, it may wait for ARC to finish or decide ARC is still preventing exit. Stopping the watcher script first gives ARC a chance to become idle before the OS closes it.

If you want, I can help you rewrite your shutdown script so it:

  1. stops the watcher,
  2. finishes the goodbye actions,
  3. then shuts down Windows in the safest order.

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.