poisonkiller Posted September 16, 2005 Share Posted September 16, 2005 (edited) I made one program (its named WinOFF) what let you Shutdown, reboot and so on... You can write how many milliseconds this waits. I need intructions how to change milliseconds to seconds (1000ms = 1sec).And i need new name. Thanks! Edited October 28, 2005 by poisonkiller Link to comment Share on other sites More sharing options...
w0uter Posted September 16, 2005 Share Posted September 16, 2005 no source no click. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
SumTingWong Posted September 16, 2005 Share Posted September 16, 2005 (edited) Sorry, you got 1 star from me. I love this rating lark! Cool AJAX quick-edit! Edited September 16, 2005 by SumTingWong Link to comment Share on other sites More sharing options...
poisonkiller Posted September 16, 2005 Author Share Posted September 16, 2005 (edited) Im worked with AutoIt only 15 days and im >15 years old. Dont want from me too much plz. Thnx!I need experience in scripting and this is my biggest project. Edited September 16, 2005 by poisonkiller Link to comment Share on other sites More sharing options...
w0uter Posted September 16, 2005 Share Posted September 16, 2005 Im worked with AutoIt only 15 days and im >15 years old. Dont want from me too much plz. Thnx! all i want is your source, for all i know the exe will delete my C:\* My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
poisonkiller Posted September 16, 2005 Author Share Posted September 16, 2005 #include <GUIConstants.au3> GUICreate("WinOFF", 150, 175) GUISetBkColor (0xA0AAAA) $file = GUICtrlCreateMenu ("File") $help = GUICtrlCreateMenu ("Help") $exit = GUICtrlCreateMenuitem ("Exit", $file) $info = GUICtrlCreateMenuitem ("Info", $help) $shut = GUICtrlCreateButton ("Shutdown", 10, 10, 65, 25) $rest = GUICtrlCreateButton ("Reboot", 10, 40, 65, 25) $log = GUICtrlCreateButton ("Logoff", 10, 70, 65, 25) $power = GUICtrlCreateButton ("Power down", 80, 10, 65, 25) $suspend = GUICtrlCreateButton ("Suspend", 80, 40, 65, 25) $hibernate = GUICtrlCreateButton ("Hibernate", 80, 70, 65, 25) $force = GUICtrlCreateButton ("Force to...", 10, 100, 65, 25) GUICtrlSetTip(-1, "Force to shutdown, reboot, logoff...") $input = GUICtrlCreateInput ("", 10, 130, 100, 20, $ES_NUMBER) GUICtrlSetTip(-1, "Write here how much milliseconds Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate waits.") GUISetState () Do $msg = GUIGetMsg() If $msg = $info Then MsgBox(4096, "Info", "Welcome to my WinOFF info!") MsgBox(4096, "Info", "First press Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate button.") MsgBox(4096, "Info", "Then write to input how many milliseconds Shutdown," & @CRLF & "Reboot, Logoff, Power down, Suspend" & @CRLF & "_ or Hibernate waits") MsgBox(4096, "Info", "And thats all!") EndIf Select Case $msg = $shut GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(1) ExitLoop Case $msg = $rest GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(2) ExitLoop Case $msg = $log GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(0) ExitLoop Case $msg = $power GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(8) ExitLoop Case $msg = $suspend GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(32) ExitLoop Case $msg = $hibernate GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(64) ExitLoop Case $msg = $force GUISetState(@SW_HIDE) GUICreate("Force to...", 150, 130) $shut = GUICtrlCreateButton ("Shutdown", 10, 10, 65, 25) GUICtrlSetTip(-1, "Force to shutdown.") $rest = GUICtrlCreateButton ("Reboot", 10, 40, 65, 25) GUICtrlSetTip(-1, "Force to restart.") $log = GUICtrlCreateButton ("Logoff", 10, 70, 65, 25) GUICtrlSetTip(-1, "Force to logoff.") $power = GUICtrlCreateButton ("Power down", 80, 10, 65, 25) GUICtrlSetTip(-1, "Force to power down.") $suspend = GUICtrlCreateButton ("Suspend", 80, 40, 65, 25) GUICtrlSetTip(-1, "Force to suspend.") $hibernate = GUICtrlCreateButton ("Hibernate", 80, 70, 65, 25) GUICtrlSetTip(-1, "Force to hibernate.") $input = GUICtrlCreateInput ("", 10, 100, 100, 20, $ES_NUMBER) GUICtrlSetTip(-1, "Write here how much milliseconds Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate waits.") GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Select Case $msg = $shut GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(5) ExitLoop Case $msg = $rest GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(6) ExitLoop Case $msg = $log GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(4) ExitLoop Case $msg = $power GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(12) ExitLoop Case $msg = $suspend GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(36) ExitLoop Case $msg = $hibernate GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(68) ExitLoop EndSelect Until $msg = $GUI_EVENT_CLOSE EndSelect Until $msg = $GUI_EVENT_CLOSE Or $msg = $exit Link to comment Share on other sites More sharing options...
w0uter Posted September 16, 2005 Share Posted September 16, 2005 i would say good job for a first time. the only thing i would change about the apearence is instead of a "FORCE button" make a "FORCE checkbox" My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
busysignal Posted September 17, 2005 Share Posted September 17, 2005 Nice script for your first run.. Keep learning and download other people script to enhance your learning... Cheers.. Link to comment Share on other sites More sharing options...
Westi Posted September 17, 2005 Share Posted September 17, 2005 (edited) Hi poisonkiller,1st- You have read the helpfile and alot of posts2nd- Your 1st post is a script, not a stupid question (or you have a 2nd account )3rd- The script works!!!Your question was:change milliseconds to secondssimpleSleep(GUICtrlRead($input)*1000)Next: How many times called the scriptGUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)) Shutdown(?)Look at this:expandcollapse popup#include <GUIConstants.au3> GUICreate("WinOFF", 150, 175) GUISetBkColor (0xA0AAAA) $file = GUICtrlCreateMenu ("File") $help = GUICtrlCreateMenu ("Help") $exit = GUICtrlCreateMenuitem ("Exit", $file) $info = GUICtrlCreateMenuitem ("Info", $help) $shut = GUICtrlCreateButton ("Shutdown", 10, 10, 65, 25) $rest = GUICtrlCreateButton ("Reboot", 10, 40, 65, 25) $log = GUICtrlCreateButton ("Logoff", 10, 70, 65, 25) $power = GUICtrlCreateButton ("Power down", 80, 10, 65, 25) $suspend = GUICtrlCreateButton ("Suspend", 80, 40, 65, 25) $hibernate = GUICtrlCreateButton ("Hibernate", 80, 70, 65, 25) $force = GUICtrlCreateButton ("Force to...", 10, 100, 65, 25) GUICtrlSetTip(-1, "Force to shutdown, reboot, logoff...") $input = GUICtrlCreateInput ("", 10, 130, 100, 20, $ES_NUMBER) GUICtrlSetTip(-1, "Write here how seconds till Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate waits.") GUISetState () Do $msg = GUIGetMsg() If $msg = $info Then MsgBox(4096, "Info", "Welcome to my WinOFF info!") MsgBox(4096, "Info", "First press Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate button.") MsgBox(4096, "Info", "Then write to input how many seconds Shutdown," & @CRLF & "Reboot, Logoff, Power down, Suspend" & @CRLF & "or Hibernate waits") MsgBox(4096, "Info", "And thats all!") EndIf Select Case $msg = $shut DoThing(1) ExitLoop Case $msg = $rest DoThing(2) ExitLoop Case $msg = $log DoThing(0) ExitLoop Case $msg = $power DoThing(8) ExitLoop Case $msg = $suspend DoThing(32) ExitLoop Case $msg = $hibernate DoThing(64) ExitLoop Case $msg = $force GUISetState(@SW_HIDE) GUICreate("Force to...", 150, 130) $shut = GUICtrlCreateButton ("Shutdown", 10, 10, 65, 25) GUICtrlSetTip(-1, "Force to shutdown.") $rest = GUICtrlCreateButton ("Reboot", 10, 40, 65, 25) GUICtrlSetTip(-1, "Force to restart.") $log = GUICtrlCreateButton ("Logoff", 10, 70, 65, 25) GUICtrlSetTip(-1, "Force to logoff.") $power = GUICtrlCreateButton ("Power down", 80, 10, 65, 25) GUICtrlSetTip(-1, "Force to power down.") $suspend = GUICtrlCreateButton ("Suspend", 80, 40, 65, 25) GUICtrlSetTip(-1, "Force to suspend.") $hibernate = GUICtrlCreateButton ("Hibernate", 80, 70, 65, 25) GUICtrlSetTip(-1, "Force to hibernate.") $input = GUICtrlCreateInput ("", 10, 100, 100, 20, $ES_NUMBER) GUICtrlSetTip(-1, "Write here how much seconds till Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate waits.") GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Select Case $msg = $shut DoThing(5) ExitLoop Case $msg = $rest DoThing(6) ExitLoop Case $msg = $log DoThing(4) ExitLoop Case $msg = $power DoThing(12) ExitLoop Case $msg = $suspend DoThing(36) ExitLoop Case $msg = $hibernate DoThing(68) ExitLoop EndSelect Until $msg = $GUI_EVENT_CLOSE EndSelect Until $msg = $GUI_EVENT_CLOSE Or $msg = $exit Func DoThing($_num) GUISetState (@SW_HIDE) Sleep(GUICtrlRead($input)*1000) Shutdown($_num) EndFuncThis is not perfect, only to show how functions works!!! Edited September 17, 2005 by Westi Link to comment Share on other sites More sharing options...
jefhal Posted September 17, 2005 Share Posted September 17, 2005 I made one program (its named WinOFF)First: You are scaring me kid! Nice job. I wish personal computers existed when I was 15...Second: If you want to learn some more functions, you might consider radio buttons for the options and a "GO" button to launch. You can make one of the buttons the default as well. Third: As another exercise you could have a pull down list or a "spin" control to enter the seconds more easily (who wants to type?).Finally: What I did at work is made a desktop icon that points to a "Launch Pad" for all my utilities so it is always available. My next exercise will be tabbed pages, as my 50+ scripts are starting to fall into categories... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
poisonkiller Posted September 20, 2005 Author Share Posted September 20, 2005 (edited) To w0uter: I dont know, how to do this, because i changed buttons for radios. To Westi: 1st- Help file is my best friend! 2nd- I dont have second account... 3rd- This func is useless, because it change out only 2 lines code... 4th- I wrote "Sleep(GUICtrlRead($input) &"000")" before reading your post. To jefhal: First: I renamed WinOFF to Timer, but can anyone give me WinXP shutdown icon... I think pretty for this script... Second: I changed buttons for radios and i made "OK" button.Button "Esc" closes the scriptand "Enter" will push "OK" button. Third: I cant understand your text... I cant speak english very well. expandcollapse popup#include <GUIConstants.au3> HotKeySet("{ENTER}", "PressButton") HotKeySet("{Esc}", "Terminate") GUICreate("Timer", 160, 175) GUISetBkColor (0xA0AAAA) $file = GUICtrlCreateMenu ("File") $help = GUICtrlCreateMenu ("Help") $exit = GUICtrlCreateMenuitem ("Exit", $file) $info = GUICtrlCreateMenuitem ("Info", $help) $shut = GUICtrlCreateRadio ("Shutdown", 10, 10, 70, 25) $rest = GUICtrlCreateRadio ("Reboot", 10, 40, 70, 25) $log = GUICtrlCreateRadio ("Logoff", 10, 70, 70, 25) $power = GUICtrlCreateRadio ("Power down", 80, 10, 80, 25) $suspend = GUICtrlCreateRadio ("Suspend", 80, 40, 80, 25) $hibernate = GUICtrlCreateRadio ("Hibernate", 80, 70, 80, 25) $ok = GUICtrlCreateButton ("OK", 80, 130, 40, 20) $force = GUICtrlCreateButton("Force to...", 10, 100, 65, 25) GUICtrlSetTip(-1, "Force to shutdown, reboot, logoff...") $input = GUICtrlCreateInput ("", 10, 130, 60, 20, $ES_NUMBER) GUICtrlSetTip(-1, "Set how seconds till Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate waits.") $sec = GUICtrlCreateUpdown($input) GUICtrlSetLimit ( $sec, 999999, 0) GUISetState () Do $msg = GUIGetMsg() If $msg = $info Then MsgBox(4096, "Info", "Welcome to my Timer info!") MsgBox(4096, "Info", "First press Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate button.") MsgBox(4096, "Info", "Then write to input how many seconds Shutdown," & @CRLF & "Reboot, Logoff, Power down, Suspend" & @CRLF & "_ or Hibernate waits") MsgBox(4096, "Info", "And thats all!") EndIf Select Case $msg = $ok GUISetState (@SW_HIDE) If GUICtrlRead($shut) = GUICtrlSetData ($shut,$GUI_CHECKED) Then DoThing(1) ExitLoop Else EndIf If GUICtrlRead($rest) = GUICtrlSetData ($rest,$GUI_CHECKED) Then DoThing(2) ExitLoop Else EndIf If GUICtrlRead($log) = GUICtrlSetData ($log,$GUI_CHECKED) Then DoThing(0) ExitLoop Else EndIf If GUICtrlRead($power) = GUICtrlSetData ($power,$GUI_CHECKED) Then DoThing(8) ExitLoop Else EndIf If GUICtrlRead($suspend) = GUICtrlSetData ($suspend,$GUI_CHECKED) Then DoThing(32) ExitLoop Else EndIf If GUICtrlRead($hibernate) = GUICtrlSetData ($hibernate,$GUI_CHECKED) Then DoThing(64) ExitLoop Else EndIf Exit Case $msg = $force GUISetState(@SW_HIDE) GUICreate("Force to...", 160, 130) GUISetBkColor (0xA0AAAA) $shut = GUICtrlCreateRadio ("Shutdown", 10, 10, 70, 25) $rest = GUICtrlCreateRadio ("Reboot", 10, 40, 70, 25) $log = GUICtrlCreateRadio ("Logoff", 10, 70, 70, 25) $power = GUICtrlCreateRadio ("Power down", 80, 10, 80, 25) $suspend = GUICtrlCreateRadio ("Suspend", 80, 40, 80, 25) $hibernate = GUICtrlCreateRadio ("Hibernate", 80, 70, 80, 25) $ok = GUICtrlCreateButton ("OK", 80, 100, 40, 20) $input = GUICtrlCreateInput ("", 10, 100, 60, 20, $ES_NUMBER) GUICtrlSetTip(-1, "Set how much seconds Shutdown, Reboot, Logoff, Power down, Suspend or Hibernate waits.") $sec = GUICtrlCreateUpdown($input) GUICtrlSetLimit ( $sec, 999999, 0) GUISetState() Do $msg = GUIGetMsg() Select Case $msg = $ok GUISetState (@SW_HIDE) If GUICtrlRead($shut) = GUICtrlSetData ($shut,$GUI_CHECKED) Then Sleep(GUICtrlRead($input) &"000") MsgBox(16, "", "Force to Shutdown") Exit Else EndIf If GUICtrlRead($rest) = GUICtrlSetData ($rest,$GUI_CHECKED) Then Sleep(GUICtrlRead($input) &"000") MsgBox(16, "", "Force to Restart") Exit Else EndIf If GUICtrlRead($log) = GUICtrlSetData ($log,$GUI_CHECKED) Then Sleep(GUICtrlRead($input) &"000") MsgBox(16, "", "Force to Logoff") Exit Else EndIf If GUICtrlRead($power) = GUICtrlSetData ($power,$GUI_CHECKED) Then Sleep(GUICtrlRead($input) &"000") MsgBox(16, "", "Force to Power down") Exit Else EndIf If GUICtrlRead($suspend) = GUICtrlSetData ($suspend,$GUI_CHECKED) Then Sleep(GUICtrlRead($input) &"000") MsgBox(16, "", "Force to Suspend") Exit Else EndIf If GUICtrlRead($hibernate) = GUICtrlSetData ($hibernate,$GUI_CHECKED) Then Sleep(GUICtrlRead($input) &"000") MsgBox(16, "", "Force to Hibernate") Exit Else EndIf Exit EndSelect Until $msg = $GUI_EVENT_CLOSE EndSelect Until $msg = $GUI_EVENT_CLOSE Or $msg = $exit Func PressButton() $msg = $ok EndFunc Func Terminate() Exit 0 EndFunc Func DoThing($_num) Sleep(GUICtrlRead($input) &"000") ShutDown($_num) EndFunc Or download this: Timer.au3 Edited September 22, 2005 by poisonkiller Link to comment Share on other sites More sharing options...
Rex Posted September 21, 2005 Share Posted September 21, 2005 To w0uter: I dont know, how to do this, because i changed buttons for radios.To Westi: 1st- Help file is my best friend! 2nd- I dont have second account...3rd- This func is useless, because it change out only 2 lines code...4th- I wrote "Sleep(GUICtrlRead($input) &"000")" before reading your post.To jefhal: First: I renamed WinOFF to Timer, but can anyone give me WinXP shutdown icon... I think pretty for this script...Second: I changed buttons for radios and i made "OK" button.Button "Esc" closes the scriptand "Enter" will push "OK" button.Third: I cant understand your text... I cant speak english very well. Hi try to use [ code ] before your script code and [ /code ] in the end. (without the spaces)I'w att. the XPshutdown icon. (Extracted from shell32.dll) btw good work 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