Marek(-|-) Posted November 27, 2004 Share Posted November 27, 2004 expandcollapse popup#include <GUIConstants.au3> $quickdown = GUICreate("QuickDown - version 1.1", 400, 250) $heading = GUICtrlCreateLabel("QuickDown v1.1",128.5,-1,143,25) ;l-r = window length/2 - label length/2 GUICtrlSetFont($heading, 15) $hotkeylabel = GUICtrlCreateLabel("Hot keys available:", 20,50,140,20) GUICtrlSetFont($hotkeylabel, 10) $logoff = GUICtrlCreateCheckbox("Logoff", 20,75,80,20) $shutdown = GUICtrlCreateCheckbox("Shut down", 20,95,80,20) $reboot = GUICtrlCreateCheckbox("Reboot", 20,115,80,20) $powerdown = GUICtrlCreateCheckbox("Power down", 20,135,80,20) $suspend = GUICtrlCreateCheckbox("Suspend", 20,155,80,20) $hibernate = GUICtrlCreateCheckbox("Hibernate", 20,175,80,20) $test = GUICtrlCreateCheckbox("Test", 20,195,80,20) GUICtrlCreatelabel("alt + l", 105,78,60,20) GUICtrlCreateLabel("alt + t", 105,98,60,20) GUICtrlCreateLabel("alt + r", 105,118,60,20) GUICtrlCreateLabel("alt + p", 105,138,60,20) GUICtrlCreateLabel("alt + s", 105,158,60,20) GUICtrlCreateLabel("alt + h", 105,178,60,20) $select = GUICtrlCreateButton("Select Hot Keys", 250,75,100,20) $reset = GUICtrlCreateButton("Reset Hot Keys", 250,105,100,20) $start = GUICtrlCreateButton("Start", 250,135,100,20) $cancel = GUICtrlCreateButton("Cancel", 250,165,100,20) $GUITEST = GUICreate("TEST", 400,250) ;this gui window was just used to test the checkboxes to see if they worked GUICtrlCreateLabel("TESTING",128.5,-1,143,100) GUISwitch($quickdown) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancel Exit Case $msg = $logoff HotKeySet("!l", "Logoff") Case $msg = $shutdown HotKeySet("!t", "Terminate") Case $msg = $reboot HotKeySet("!r", "Reboot") Case $msg = $powerdown HotKeySet("!p", "Powerdown") Case $msg = $suspend HotKeySet("!s", "Suspend") Case $msg = $hibernate HotKeySet("!h", "Hibernate") Case $msg = $start GUISetState(@SW_HIDE) Case $msg = $test ;this case was just used to test to see if the checkboxes actually worked, and they did GUISetState(@SW_HIDE) GUISwitch($GUITEST) GUISetState(@SW_SHOW) EndSelect WEnd While 1 Sleep(1) WEnd HotKeySet("^o", "REOPEN") Func REOPEN() GUISwitch($quickdown) GUISetState(@SW_SHOW) EndFunc Func Logoff() Shutdown(4) EndFunc Func Terminate() Shutdown (13) EndFunc Func Reboot() Shutdown(6) EndFunc Func Powerdown() Shutdown(12) EndFunc Func Suspend() Shutdown(36) EndFunc Func Hibernate() Shutdown (68) EndFunc Thats my code so far. Let me just tell you what I am trying to make and what seems to be the problem. I am trying to make a GUI window that displays checkboxes, and when checked the hotkey for that command is enabled. I know that some of the buttons listed in code arent used yet, but I want the "Select Hotkeys" button to enable the hotkeys that have been checked. The "Reset Hot Keys" button should take all of the checks out of the checkboxes and disable the hokeys previouly selected. The cancel button exits the program.. The "Start" button hides the window, like in the tray or something like that, and I want to make it so that when you press ctrl+o it will reopen the initial GUI window. The part Im having troulbe with is the selecting of the hotkeys. I have added in a few "Test" controls that I used to check to see if the checkboxes actually worked the way i had them set up, and they all did. However, when I check on of the other boxes ( I havent yet tried to make the "reset hotkeys" or the "select hotkeys" buttons work) the corresponding hotkeys do not work. I have it set up so that just by checking the boxes the hotkeys should be set, but they just dont work. I'm thinking that its either a problem with the functions or with the hotkeyset... that is my problem #1. The next thing that I seem to be having trouble on is with the "Start" button. I have made it so that when you press "start" the GUI window hides, but I cant make it so that when I press ctrl + o the GUI window reopens. This corresponds with the previous problem with the hotkeys or with the functions. This is my problem #2. If you can help me with anything I have mentioned about this script that would be just great. Even with some of the buttons that havent been included but have been mentioned. (-|_) -|- ( _|-) Link to comment Share on other sites More sharing options...
stingjoel Posted November 27, 2004 Share Posted November 27, 2004 Marek, I am trying to rebuilt your script...I hope this script is like what you want...but I remove test window... expandcollapse popup#include <GUIConstants.au3> Opt("GuiOnEventMode", 1) Global $quickdown, $logoff, $shutdown, $reboot, $powerdown, $suspend, $hibernate $quickdown = GUICreate("QuickDown - version 1.1", 400, 250) GuiSetOnEvent($GUI_EVENT_CLOSE, "Quit") $heading = GUICtrlCreateLabel("QuickDown v1.1",128.5,-1,143,25) ;l-r = window length/2 - label length/2 GUICtrlSetFont($heading, 15) $hotkeylabel = GUICtrlCreateLabel("Hot keys available:", 20,50,140,20) GUICtrlSetFont($hotkeylabel, 10) $logoff = GUICtrlCreateCheckbox("Logoff", 20,75,80,20) $shutdown = GUICtrlCreateCheckbox("Shut down", 20,95,80,20) $reboot = GUICtrlCreateCheckbox("Reboot", 20,115,80,20) $powerdown = GUICtrlCreateCheckbox("Power down", 20,135,80,20) $suspend = GUICtrlCreateCheckbox("Suspend", 20,155,80,20) $hibernate = GUICtrlCreateCheckbox("Hibernate", 20,175,80,20) GUICtrlCreatelabel("alt + l", 105,78,60,20) GUICtrlCreateLabel("alt + t", 105,98,60,20) GUICtrlCreateLabel("alt + r", 105,118,60,20) GUICtrlCreateLabel("alt + p", 105,138,60,20) GUICtrlCreateLabel("alt + s", 105,158,60,20) GUICtrlCreateLabel("alt + h", 105,178,60,20) $select = GUICtrlCreateButton("Select Hot Keys", 250,75,100,20) $reset = GUICtrlCreateButton("Reset Hot Keys", 250,105,100,20) $start = GUICtrlCreateButton("Start", 250,135,100,20) GuiCtrlSetOnEvent(-1, "StartButton") $cancel = GUICtrlCreateButton("Cancel", 250,165,100,20) GUISwitch($quickdown) GUISetState(@SW_SHOW) HotKeySet("^o", "REOPEN") While 1 Sleep(100) WEnd Func REOPEN() GUISwitch($quickdown) GUISetState(@SW_SHOW) EndFunc Func Logoff() MsgBox (4096, "Logoff", "Logoff") ;Shutdown(4) EndFunc Func Terminate() MsgBox (4096, "ShutDown", "ShutDown") ;Shutdown (13) EndFunc Func Reboot() MsgBox (4096, "Reboot", "Reboot") ;Shutdown(6) EndFunc Func Powerdown() MsgBox (4096, "Power Down", "Power Down") ;Shutdown(12) EndFunc Func Suspend() MsgBox (4096, "Suspend", "Suspend") ;Shutdown(36) EndFunc Func Hibernate() MsgBox (4096, "Hibernate", "Hibernate") ;Shutdown (68) EndFunc Func StartButton() GUISwitch($quickdown) GUISetState(@SW_HIDE) HotKeySet("!l") HotKeySet("!t") HotKeySet("!r") HotKeySet("!p") HotKeySet("!s") HotKeySet("!h") If GUIRead($logoff)=1 Then HotKeySet("!l", "Logoff") If GUIRead($shutdown)=1 Then HotKeySet("!t", "Terminate") If GUIRead($Reboot)=1 Then HotKeySet("!r", "Reboot") If GUIRead($powerdown)=1 Then HotKeySet("!p", "Powerdown") If GUIRead($suspend)=1 Then HotKeySet("!s", "Suspend") If GUIRead($hibernate)=1 Then HotKeySet("!h", "Hibernate") EndFunc Func Quit() Exit EndFunc Link to comment Share on other sites More sharing options...
Marek(-|-) Posted November 27, 2004 Author Share Posted November 27, 2004 umm.. your script doesnt even work GuiSetOnEvent($GUI_EVENT_CLOSE, "Quit") it says thats the problem, but even without that it still dont work... maybe you made a typo or something? (-|_) -|- ( _|-) Link to comment Share on other sites More sharing options...
stingjoel Posted November 27, 2004 Share Posted November 27, 2004 Did you download the latest unstable autoit? If not, try download the lastest, because it run good in my computer... :"> Or have you copy and paste all the script? because I add Opt("GuiOnEventMode", 1)...without this statement/function, GuiSetOnEvent will result an error umm.. your script doesnt even work GuiSetOnEvent($GUI_EVENT_CLOSE, "Quit")it says thats the problem, but even without that it still dont work... maybe you made a typo or something?<{POST_SNAPBACK}> 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