Krypton88 Posted December 5, 2008 Share Posted December 5, 2008 Hey guys! Im New to AutoIT but have been using Visual Studio 2008 So I do have some scripting knowledge... So As of now this is my first AutoIT project, And ive made my GUI and all But In my Script...For some reason I cant find the code for when the User click on Button1 Example: If user clicks Button1(ON) the mouse moving and clicking/keystroke script starts and if user clicks button2 (OFF) the script stops... I know in VB.net this would be If Button1_Click then Sorta deal , But I know that autoit is somewhat different, So please a little help? Thanks alot! Projects-Krypton's WoW Auto-Caster-V1.0-Lite Link to comment Share on other sites More sharing options...
FireFox Posted December 5, 2008 Share Posted December 5, 2008 (edited) Hey guys! Im New to AutoIT but have been using Visual Studio 2008 So I do have some scripting knowledge... So As of now this is my first AutoIT project, And ive made my GUI and all But In my Script...For some reason I cant find the code for when the User click on Button1 Example: If user clicks Button1(ON) the mouse moving and clicking/keystroke script starts and if user clicks button2 (OFF) the script stops... I know in VB.net this would be If Button1_Click then Sorta deal , But I know that autoit is somewhat different, So please a little help? Thanks alot! Hi, Opt("GuiOnEventMode",1);Switch on OnEventMode for GuiCtrls GuiCreate("",250,35) GuiCtrlCreateButton("Press me !",5,5,240,25) GuiCtrlSetOnEvent(-1,"_MyFunc");Set on event Button for "_MyFunc" function GuiSetState() Func _MyFunc() Msgbox(64,"","You pressed me !") EndFunc While 1;Start loop for script (window will stay visible) Sleep(250) WEnd Edited December 5, 2008 by FireFox Link to comment Share on other sites More sharing options...
Krypton88 Posted December 5, 2008 Author Share Posted December 5, 2008 Hey thanks for that man, how do I make the "X" (exit button) on top right work? Didnt know i need a code for that. Guess im used to VB doing that part for me lol Projects-Krypton's WoW Auto-Caster-V1.0-Lite Link to comment Share on other sites More sharing options...
Valuater Posted December 5, 2008 Share Posted December 5, 2008 (edited) like disss.... #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GuiOnEventMode", 1);Switch on OnEventMode for GuiCtrls GUICreate("", 250, 35) GUISetOnEvent($GUI_EVENT_CLOSE, "_MyExit") GUICtrlCreateButton("Press me !", 5, 5, 240, 25) GUICtrlSetOnEvent(-1, "_MyFunc");Set on event Button for "_MyFunc" function GUISetState() While 1;Start loop for script (window will stay visible) Sleep(250) WEnd ; ----------- Functions ------------------ Func _MyFunc() MsgBox(64, "", "You pressed me !") EndFunc ;==>_MyFunc Func _MyExit() MsgBox(64, "", "You pressed Exit !") Exit EndFunc ;==>_MyExit 8) Edited December 5, 2008 by Valuater Link to comment Share on other sites More sharing options...
Krypton88 Posted December 5, 2008 Author Share Posted December 5, 2008 Your the man bro thanks Projects-Krypton's WoW Auto-Caster-V1.0-Lite Link to comment Share on other sites More sharing options...
Valuater Posted December 5, 2008 Share Posted December 5, 2008 Welcome!! 8) 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