nf67 Posted February 21, 2008 Posted February 21, 2008 Hello there, I'd like to set {ENTER} as the hotkey for my button called $Aanmelden. I think it's pretty easy to fix, but I just don't know how... Here's my attempt: #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Windows Live Messenger", 329, 636, 193, 125) $Email = GUICtrlCreateInput("", 48, 212, 241, 21) guictrlsetstate($Email,$gui_focus) $Wachtwoord = GUICtrlCreateInput( "", 48, 258, 241, 21, $ES_PASSWORD) $Aanmelden = GUICtrlCreatePic("C:\ProjectCake\MKaanmelden.bmp", 112, 448, 69, 21, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState() guictrlsetstate($Aanmelden,$GUI_DEFBUTTON) $MSNVenster = GUICtrlCreatePic("C:\ProjectCake\MWgeenknopgeenvakken.bmp", 0, 0, 329, 636, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit HotKeySet("{Enter}", "$Aanmelden" ); Doesn't work Case $Aanmelden FileWriteLine("C:\ProjectCake\log.txt", GuiCtrlRead($Email)) FileWriteLine("C:\ProjectCake\log.txt", GuiCtrlRead($Wachtwoord)) sleep ( 2000 ) MsgBox ( 5, "Fout bij inloggen", "Je kunt je niet bij Windows Live Messenger worden aangemeld omdat de Windows Live ID onjuist is of niet bestaat. Klik op Wachtwoord vergeten? in het hoofdvenster van Messenger als je je wachtwoord vergeten bent. Foutcode: 67711nf3" ) if 2 then winkill ( "Windows Live Messenger" ) run ( "C:\Program Files\Windows Live\Messenger\msnmsgr.exe" , "C:\Program Files\Windows Live\Messenger\" ) endif EndSwitch WEnd Thanks
Swift Posted February 21, 2008 Posted February 21, 2008 (edited) Cant set a hotkey for a button...but you can set the {ENTER} button to 'click' on your button...add the Style...heres an example #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 177, 86, 193, 125) $Button1 = GUICtrlCreateButton("Button1", 40, 24, 73, 33, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Msgbox(0, "test", "you pressed enter and this appeared") EndSwitch WEnd EDIT: also...you cant use HotKeySet() to call a variable...it must be a function. Edited February 21, 2008 by Swift
nf67 Posted February 21, 2008 Author Posted February 21, 2008 When I add $BS_DEFPUSHBUTTON to my styles all I get is a gray button ( instead of the picture for the button ): $Aanmelden = GUICtrlCreatePic("C:\ProjectCake\MKaanmelden.bmp", 112, 448, 69, 21, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$BS_DEFPUSHBUTTON)) What did I do wrong?
Swift Posted February 21, 2008 Posted February 21, 2008 To my knowledge it wont work with Pics Its not recommended to hotkeyset...and then call a function...because you will have to do your loop and everything else in the function...which kinda sucks..so...maybe someone knows a better idea...
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