darknezz19 Posted March 17, 2010 Share Posted March 17, 2010 Hi guys. I wrote this just a minute ago and decided to post it. It's simple and plain but works great for me. I use it to watch movies at night in case i fall asleep. I want to dive into guis and see if I can come up with something a bit more complex. Have a good day. $Value = InputBox ( "Sleep Timer", "How many minutes should I wait?", "120", "", 150, 150 ) $Smins = 60000 * $Value Sleep($Smins) Shutdown (9) Link to comment Share on other sites More sharing options...
trancexx Posted March 17, 2010 Share Posted March 17, 2010 Great. Could you explain what it does? I just tried to watch .mp4 file with it and couldn't. I used the full path. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
darknezz19 Posted March 17, 2010 Author Share Posted March 17, 2010 (edited) Hi trancexx. This is a timer that asks you how many minutes to wait until it shuts down your computer. Kinda like the sleep timer you'd find on a TV. It's plainly simple. A better one with a gui and more options will be out later today if I can get these loops down. Wish me luck:) Edited March 17, 2010 by darknezz19 Link to comment Share on other sites More sharing options...
trancexx Posted March 17, 2010 Share Posted March 17, 2010 Ok, break a leg. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
darknezz19 Posted March 17, 2010 Author Share Posted March 17, 2010 (edited) Starting to grasp loops and such. Here's a new version. Next I want to add reading of a video to automatically plug in the minutes. Suggestions and or criticism welcome. *Edit* Rushed it out and didn't test it enough. There's bugs that need to be fixed. #include <GUIConstantsEx.au3> $Form1 = GUICreate("Sleep Timer", 200, 150) $Input1 = GUICtrlCreateInput("Minutes to Sleep", 50, 80, 100, 21) $Button1 = GUICtrlCreateButton("OK", 50, 110, 100, 30, 0) $Check1 = GUICtrlCreateRadio("Shutdown", 50, 20) $Check2 = GUICtrlCreateRadio("Sleep", 50, 40) GUISetState(@SW_SHOW) ; set the gui state to show so you can see it $End = 0 While 1 ; start of loop $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE ; exit if the window is closed Exit Case $Msg = $Input1 ; grab input of minutes and multiply by 60000 to get time in miliseconds $Mins = GUICtrlRead ($Input1) $Min = 60000 * $Mins Case $Msg = $Check1 ; if shutdown is selected asign 1 to $End $End = 1 Case $Msg = $Check2 ; if sleep is selected asign 2 to $End $End = 2 Case $Msg = $Button1 ; run the sleep timer If $End = 0 Then MsgBox(0, "Oops", "Please pick Shutdown or Sleep") Sleep($Min) ElseIf $End = 1 Then Shutdown (9) Exit ElseIf $End = 2 Then Shutdown (64) Exit EndIf EndSelect WEnd Edited March 17, 2010 by darknezz19 Link to comment Share on other sites More sharing options...
JohnOne Posted March 18, 2010 Share Posted March 18, 2010 Next I want to add reading of a video to automatically plug in the minutes. Suggestions and or criticism welcome.Take a look at this Get Extended File Property UDF By SimucalIts an old thread but the function still works, and will include the duration of a garden variety xvid avi, amongst other things.To make your project a little more adventurous for you, you should look into having your gui launching the video too. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now