Sign in to follow this  
Followers 0
The Kandie Man

Autoit Automated Shutdown

14 posts in this topic

#1 ·  Posted (edited)

AutoIt Automated Shutdown

Just a warning, you will be sad if you are attached to comments. My script has minimal comments because i didn't plan on releasing it. Sorry, but i don't feel like going back and commenting on the 700 or so lines that make up the program. :)

If you have a question about what a certain section of code does post it here and i will explain.

Features:

  • Easy Installation. Simply run the .exe in the folder you wish to install it in and it does all the registry settings for you.
  • Allows for all shutdown methods including: shutdown, reboot, hibernate, logoff and suspend.
  • Allows you to set different shutdown types such as weekly, daily, and on a specific date.
  • Has an easy to use GUI and pseudo service(a process that isn't registered as a service that initiates the shutdowns) in one exe.
  • Stores settings in an ini file for maximum portability.
  • GUI allows for extremely easy disabling and uninstallation of AutoIt Automated Shutdown
Note:

One thing that i haven't been able to achieve is loading it before the login screen. If you guys want to do this i started writing one that worked with srvany. I got it to run before the login screen but for some reason it wasn't able to shutdown the computer from the login screen.

GUI:

Posted Image

Shutdown Notification:

Posted Image

Please post comments. Any help making this work with srvany would be appreciated. Thanks.

Must run with the beta version of AutoIt!

AutoItAutomatedShutdownv1.0.0.2b2.zip

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I created a similar shutdown script for use at my company. The main difference is that I have the GUI on the server to allow the admin to choose whether to Logoff, Restart, Shutdown, etc. What then happens is that a port is opened on the server, corresponding to the requested action. (i.e. Port 1111 for Logoff, 2222 for Restart, etc. -- not the actual ports, of course) The PCs are constantly scanning for those ports and then will perform the action based on the open port.

The user then gets a splashtext message saying the computer will shut down in... counting down from 5 minutes. They have an option to hit ESC if they are still in the building and their computer will not shut down that night.

Kandie Man... I may be reading more into your post than you intended, but you seem to be rather full of yourself. You post seems to imply that you are doing the members of this forum a favor by posting your "advanced" script. Sorry that you had to go through so much trouble to place your script on the forum. BTW, I did figure out how to shut down the computer while at the logon screen using srvany. I guess I am advanced too.

Edited by SerialKiller

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

pretty awesome I has looking for something like this, I could find anything that display the time in hour:min:PM/AM format, its nice that this can be done with autoit, and I can learn how it works

I get errors when I start a service, it crashes, something about line 171 in array.au3 bady formated func statement

Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

pretty awesome I has looking for something like this, I could find anything that display the time in hour:min:PM/AM format, its nice that this can be done with autoit, and I can learn how it works

I get errors when I start a service, it crashes, something about line 171 in array.au3 bady formated func statement

What version of AutoIt are you running? You need to run it using the beta version of AutoIt.

The Kandie Man: You did write a nice script--very useful. My gripe posted above is only in relation to how you presented your post, not the script itself.

Edited by SerialKiller

Share this post


Link to post
Share on other sites

Hey this is great! I've been looking for something close to this that'll reboot the PC and login a specified user (either Admin or regular user) once the PC comes up again. Is there anything out there that can do that? Basically, I need to test certain features that would be available for Admin only and check that those features are not there for regular users, etc. These features require a reboot in between logins. I'm new to Windows testing and AutoIt (self-taught), so any pointers from you advanced gurus would help a bunch in my learning. I don't even know where to find out what registries need to be accessed in order to do the above or how the script could possibly work before a user has logged on. :) Please clue me in if you know. Thanks!

Share this post


Link to post
Share on other sites

Hey this is great! I've been looking for something close to this that'll reboot the PC and login a specified user (either Admin or regular user) once the PC comes up again. Is there anything out there that can do that? Basically, I need to test certain features that would be available for Admin only and check that those features are not there for regular users, etc. These features require a reboot in between logins. I'm new to Windows testing and AutoIt (self-taught), so any pointers from you advanced gurus would help a bunch in my learning. I don't even know where to find out what registries need to be accessed in order to do the above or how the script could possibly work before a user has logged on. :) Please clue me in if you know. Thanks!

It is fairly easy to reboot a computer while it is logged on. You just need to use the Shutdown() function. It gets trickier when you want to do it before a user has logged on. If that is the case, you need to run the AutoIt compiled script as a service. One good way to do this is use srvany to run as a service. Srvany will then call your compiled script and make it act as if your compiled script is running as a service as well.

Take a look at the Shutdown() function, RegWrite() function and read more about srvany. If you have any questions on how to implement it, be sure to post again.

Share this post


Link to post
Share on other sites

It is fairly easy to reboot a computer while it is logged on. You just need to use the Shutdown() function. It gets trickier when you want to do it before a user has logged on. If that is the case, you need to run the AutoIt compiled script as a service. One good way to do this is use srvany to run as a service. Srvany will then call your compiled script and make it act as if your compiled script is running as a service as well.

Take a look at the Shutdown() function, RegWrite() function and read more about srvany. If you have any questions on how to implement it, be sure to post again.

Ok will do! Thanks for the info!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Kandie Man... I may be reading more into your post than you intended, but you seem to be rather full of yourself. You post seems to imply that you are doing the members of this forum a favor by posting your "advanced" script. Sorry that you had to go through so much trouble to place your script on the forum. BTW, I did figure out how to shut down the computer while at the logon screen using srvany. I guess I am advanced too.

You are reading way too deep then. I am not doing members of the forum a favor in any way shape or form. I am simply saying i would like feedback. I can't improve my scripts if nobody gives any feeback and i do spend a significant amount of time checking for errors and cleaning my scripts before i release them. Also, why the flaming? What did i ever do to you? Yeah, so i am excited that I wrote this script. Sorry if i came out too over-the-top, but i am still fairly new to programming and scripting and i was extremely excited i was able to make a script like this.

A little while back i created a fairly advanced Automated Shutdown utility using AutoIt. I hadn't planed on releasing it but since i think you guys may need/like/appreciate something like this i decided to go ahead and do it out of the kindness of my heart.

The whole "out of the kindness of my heart" stuff is complete sarcasm. I am on the forums and i hear people asking for shutdown scripts all the time. I decided to make one for my friends and the computers on my network. Then i decided why not give back to the community. So i did it. I searched the forums for a while looking for a script that involved tasked shutdowns but I didn't find a single script in the entire scraps forum (maybe i am not looking hard enough). I decided to post my script in hopes that it would be appreciated by others on the forum who had the same problem finding shutdown scripts as me.

I am sorry if i offended anyone. :)

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

i am using beta.

Share this post


Link to post
Share on other sites

Odd, does it give you that error when you compile it? If so try running the included .exe.

Also, you said it gave you the error saying there was a problem with array.au3. There shouldn't be since array.au3 is not included in the script.

#Include <Date.au3>
#Include <GuiListView.au3>
#include <Misc.au3>
#include <GUIConstants.au3>

Those should be the only included files resource files in the script.

I am using AutoIt v3.1.1.117 beta to compile it.

Does this help?


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I can't even compile because it is still getting the same error when I run it or compile with beta 3.18 and 3.17 but The already compiled one works just fine i supossed..

Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

Interesting. What is the exact error message it gives you. Line 171 has the following:

If $inireadshutdowntimeformat = "PM" Then

As you can see there isn't even an array on that line. An exact error message would allow me to get to the exact source of the problem and figure out exactly what is going on.

Also, are you using SCITE to compile the script, if not, you can find it here:

http://www.autoitscript.com/autoit3/scite/downloads.php


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

thank you


Random

Share this post


Link to post
Share on other sites

thank you

good program, Hello Me You forgotten autoit forums one!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0