Auto Shut Down Of Ezb And Computer?

 
#1

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 ?

#2

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

Code:


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 EZ-Builder 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:

Code:


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



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

Alan

#3

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 )

#4

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?

#5

Unless you can somehow make your bed before getting out of it Smile.... 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.

#6

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

#7

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

#8

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

#9

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...

#10

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 EZ builder 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?