Googler24022 Posted April 5, 2005 Share Posted April 5, 2005 I have a button and i was wandering how i could get a button to do a certain thing, for instance. i have a reboot button, so how would i make it reboot the comp when i press it? Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Share Posted April 5, 2005 (edited) Shutdown ( code ) The shutdown code is a combination of the following values: 0 = Logoff 1 = Shutdown 2 = Reboot 4 = Force 8 = Power down 32= Suspend 64= Hibernate Add the required values together. To shutdown and power down, for example, the code would be 9 (shutdown + power down = 1 + 8 = 9). Standby or hibernate are ignored if other codes are set. They are also ignored under Win9x. Straight out the help file, eg Code. While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $button Then Shutdown (6) EndIf Wend Edited April 5, 2005 by burrup qq Link to comment Share on other sites More sharing options...
Googler24022 Posted April 5, 2005 Author Share Posted April 5, 2005 Thank you, i will try to do this. Link to comment Share on other sites More sharing options...
Googler24022 Posted April 5, 2005 Author Share Posted April 5, 2005 expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: A.N.Other <myemail@nowhere.com> ; ; Script Function: ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here ProgressOn("", "Loading Program.......", "0 percent") For $i = 0 to 100 step 1 sleep(100) ProgressSet( $i, $i & " percent") Next ProgressSet(100 , "Load Successful", "") sleep(500) ProgressOff() #include <GUIConstants.au3> GUICreate("Computer Utility", 271, 30) ; will create a dialog box that when displayed is centered Opt("GUICoordMode",1) GUICtrlCreateButton ("Shutdown", 1, 1, 90, 30) GUICtrlCreateButton("Reboot", 91, 1, 90, 30) GUICtrlCreateButton("Hibernate", 181, 1, 90, 30) GUISetState () ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed TrayTip("Welcome", "This is my first Program, its a simple computer utility.", 10, 1) Sleep(5000) Theres my code, please can you enlighten me on how to finish it. Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Share Posted April 5, 2005 You need to assign your buttons . Try the following.BEWARE if you click the reset or shutdown button it will reset lol.expandcollapse popup#include <GUIConstants.au3> ProgressOn("", "Loading Program.......", "0 percent") For $i = 0 to 99 step 1 sleep(100) ProgressSet( $i, $i & " percent") If $i = 100 Then ProgressSet(100 , "Load Successful", "") sleep(500) EndIf Next ProgressOff() GUICreate("Computer Utility", 271, 30) Opt("GUICoordMode",1) $Shutdown = GUICtrlCreateButton ("Shutdown", 1, 1, 90, 30) $Reboot = GUICtrlCreateButton("Reboot", 91, 1, 90, 30) $Hibernate = GUICtrlCreateButton("Hibernate", 181, 1, 90, 30) GUISetState () TrayTip("Welcome", "This is my first Program, its a simple computer utility.", 10, 1) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Shutdown Shutdown(1) Case $msg = $Reboot Shutdown(2) Case $msg = $Hibernate Shutdown(64) EndSelect Wend qq Link to comment Share on other sites More sharing options...
Googler24022 Posted April 5, 2005 Author Share Posted April 5, 2005 (edited) Thank you so much! Now that i have done this, is there a function which can be used so when my mouse is over a button it will display the information about it? Edited April 5, 2005 by Googler24022 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