Asked — Edited

Auto Shut Down Of Ezb And Computer?

I have been successful with the Help of Alan (@thetechgruru) in having my robot automatically start by applying power to the EZB and starting my computer. This allows the robot to fully activate.

I have built a script that upon verbal command I can get the program and the EZB to shut down.

My next goal is to have this verbal command disconnect the EZB and shut off the computer. I know there is a command to disconnect the EZB which I can add to the verbal shut down script. I can also add a relay which applies and removes the EZB power prior to startup and after shut down.

My question is: Is it possible to shut off the computer from the EZB ?


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

#1  

You can use the EXEC script command to send commands to the operating system.


Exec( EXE/Bat File, [parameters] )
Executes a windows application or batch file. The second parameter is a list of optional parameters
Example: Exec(C:\Windows\Notepad.exe)
Example: Exec(C:\Windows\Notepad.exe, C:\MyFile.txt)

Windows has a shutdown command "shutdown". You would want to use it with the /p flag which powers off the computer and forces a shutdown even if an application has an open dialog box (which ARC might. If there have been any changes to the project, it will be asking if you want to save them, and if you force a shutdown, it won't save those changes, so this should be used carefully). (some computers don't fully power off on a shutdown, so using the /s and /f flags to force a shutdown might not actually power it down)

The script would look like:


Exec("C:\Windows\System32\shutdown.exe", "/p")

See https://www.lifewire.com/shutdown-command-2618100 for more options.

Alan

PRO
Synthiam
#2  

Or use EZ-Script command...

Quote:

SleepPC( Suspend|Hibernate, force, wake ) Sends a command to the operating system to sleep or hibernate. If Force is TRUE, the computer is forced to sleep and other applications have no say in the decision. If Wake is TRUE, the computer will wake up on Wake events. Example: SleepPC( Suspend, true, true ) Example: SleepPC( Hibernate, true, true )

#3  

I am away so I will try it when I get back. I assume it goes in the shut down script as the last thing?

PRO
Synthiam
#4  

Unless you can somehow make your bed before getting out of it:).... things in our universe must happen in order. Cause and effect!

Shut down before other commands and you guessed it: The other commands after it won't execute.

#5  

LOL..... My statement was kind of dumb.... I will try to get it loaded when I get back tomorrow.

#6  

Hay Andy, do you also want to shut down the entire game automatically when the computer shuts down? If so consider using a Smart Strip Power Strip. When the Smart Strip senses that you've turned your computer off, it automatically shuts off your anything else plugged into it too.

Amazon Smart Strip

User-inserted image

PRO
Synthiam
#7  

Andy - no dumb comments or questions:) yours was just a little easy to innocently poke fun at!

#8  

Hi Dave. The power strip looks nice. I may use it on another project. Thanks for the info. We kill the main power to the barn at the end of the day so no need for it on this project. I have a switch to apply or remove power to the EZB, so we can shut her off when we don't want to hear her. The cool thing is that now Madame boots up by herself when we turn on the computer on. Once I get the shutdown to work it will be great.

Dj. I'm easy. I even laugh at myself...

#9  

Just a reminder, I am using Win 7.

It almost works. I tried the script using the /p and it gets to the shutdown window but says it is need ARC to be closed. It goes no further.

I tried the /f and it brings me to another screen on which I need to activate a button to complete the shut down.

Any thoughts?

#10  

Hi Dj, I don't want to do any Sleep or Hibernate functions. I need the computer to fully shut down. The reason is, I remove all power once it is shut down.

I have tried not completing the shut down. With the force screen open I remove the power. I know this is not good to do. Upon restarting I get an error screen which asks how to restart. ( Safe Mode etc.) If I wait the 25 seconds or so, it will do a "Start Windows Normally". I know it works, but I also know it is not right.

My end goal is having a Latte Panda inside my robot. I will only have a Power / Safety switch which supplies power to the whole system. This will start the robot and remove power after shutdown. (The start part works fine.)

Any other ideas?

#11  

Andy, Try a timed shutdown to give ARC time to close. Try replacing the command in the shutdown .EXE file with the following command:

shutdown.exe -s -t 00 -f

This sets the shutdown to take place immediately when the shortcut is clicked. However edit the '00' part of the code to reflect the number of seconds delay that will take place before shutdown in implemented.

This delay should give ARC time to close.

If you still have issues like the computer not shutting down all the way go back to Alan's command but add the delay to the end. Not sure how to format that but try looking at this (or maybe someone can help with the santex):

Timed delay shutdown of win 7

#12  

The issue with shutdown.exe -s -t 00 -f is that depending on the computer, it may shut down the operating system, but not actually power it down (the screen will say "it is now safe to power off your computer"

Hibernate is actually a good solution. Unlike Sleep, hibernate requires no power, and will return the computer to the exact state it was in before hibernating (as far as what applications were running). You will definitely need the connect script in a time loop like we discussed earlier though because ARC will already be running, so it won't know to execute the script on startup.

Alan

#13  

Ya, my suggestion seems to suck. LOL:) Useing the /f switch would shut down ARC right away anyway.


/f = This option forces running programs to close without warning. Except with the /l, /p, and /h options, not using shutdown's /f option will present a warning about the pending shutdown or restart.

Maybe if the /f switch was left out and just the -s and -t 00 switches?

Andy wants to cut power to the computer with a outside switch when he leaves the building. If the computer is in Hibernate mode and loses power what would this do the next time he starts the computer?

#14  

Hibernate does not use any power... The current windows session (contents of RAM) is copied to a file on the hard drive... The computer then basically shuts down. Next time you press the power button the image file or whatever you call it is copied back to RAM so you can continue where you left off... If you cut the power while a PC is in hibernation mode it will still boot up to it's last session. So hibernation would work well in this case...

#15  

Thanks to all for the help.

So, if I understand right, I can use the method DJ mentioned to shutdown in hibernate, Then do I still need the same startup script Alan gave ?

#16  

You need the connect script in your app. Technically you don't need the shortcut in the startup folder, but it would be useful if the computer unexpectedly reboots or otherwise starts up from powered off rather than restoring from hibernation.

Alan

#17  

Oops... In re-reading the text from Alan he said I still need to do the Start Script. I will give it a try.

#18  

Hi Alan, Posts crossed... So if I leave the start as is with the loop, it should be fine. Then I just need the shutdown script to close running scripts and command the hibernate function.

When this works, I can use the embedded computer as planned. Thanks

#19  

Final Update !

Works great !

Antonn will finally getting his own Brain !

THANK YOU TO ALL THAT HELPED

#20  

Huzzah! :D

This was a good thread. I learned something also! Thanks.

#21  

Fantastic! And nice to see the collaborative effort of everyone who responded.

Alan