Grantson Posted January 28, 2011 Share Posted January 28, 2011 Hi Guys I wrote a script and produced a gui within koda to automate various tasks within a PC rollout I want to do a little streamlining and have some hotkeys that group some tasks together for example 2 buttons on the gui that release the ip address then shut down the PC is there a way within a custom function in my script i can simulate clicking the 2 buttons? Thanks Grant Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 28, 2011 Share Posted January 28, 2011 Clicking those buttons triggers calls to functions in your script. Why not just call the functions without bothering with the buttons? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Grantson Posted January 29, 2011 Author Share Posted January 29, 2011 Clicking those buttons triggers calls to functions in your script. Why not just call the functions without bothering with the buttons?Because its a bit of a bodge job the button actions were written directly in the switch statement rather than calling functions. I guess its fairly simple to copy and paste each button into its own function then just write separate functions for the hot keys just wanted to see if there was another way before carving up my code and potentially breaking it lol Link to comment Share on other sites More sharing options...
JoHanatCent Posted January 30, 2011 Share Posted January 30, 2011 Maybe like this? #include <WindowsConstants.au3> HotKeySet("{esc}", "_Button") $hGui = GUICreate("Test", 300, 300, 200, 100, -1) $hButton1 = GUICtrlCreateButton("MSGBox", 100, 100, 150, 25) $hButton2 = GUICtrlCreateButton("InputBox", 100, 150, 150, 25) Global $hButton = GUICtrlCreateButton("FileOpenDialog", 20, 220, 120, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $hButton1 MsgBox(0, 'Button One', 'Hi', .5) Case $hButton2 InputBox("Title", "What you want?") Case $hButton FileOpenDialog("", "", "(*)", Default, "", $hGui) EndSwitch WEnd Func _Button() $msg = $hButton1 EndFunc ;==>_Button 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