fanna1119 Posted January 10, 2013 Posted January 10, 2013 Hi, I am pretty much a noob in autoit So I used Au3Record to record some things I do and it worked excellent but when I made a GUI using Koda GUI designer and I made a button and I wanted to linked my recorded functions to the button, but I just can't get it right! can someone maybe show me what I was doing wrong here (sorry if the GUI I uploaded isn't functional since the images inside the program are on my pc )my ipconfig.au3
stormbreaker Posted January 10, 2013 Posted January 10, 2013 (edited) #include <ButtonConstants.au3> #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include 'MyIPConfig.au3' $Form1 = GUICreate("A problem to solve", 150, 150) $btn = GUICtrlCreateButton('IP Info', 10, 10, 90, 30, $BS_BITMAP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $btn _Button_Function() EndSwitch WEnd Perhaps, this is the ans. to ur question. Here is the modified version of your posted file. #region ---Au3Recorder generated code Start (v3.3.7.0) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- Func _Button_Function() Run('C:\Windows\System32\cmd.exe') _WinWaitActivate("C:\Windows\System32\cmd.exe","") Send("ipconfig{ENTER}") MouseClick("right",14,55,1) MouseClick("left",68,73,1) _WinWaitActivate("Mark C:\Windows\System32\cmd.exe","") MouseMove(13,52) MouseDown("left") MouseMove(635,306) MouseUp("left") _WinWaitActivate("Select C:\Windows\System32\cmd.exe","") Send("{Enter}") Run('C:\Windows\System32\notepad.exe') _WinWaitActivate("Untitled - Notepad","") Send("{CTRLDOWN}v{CTRLUP}") EndFunc #endregion --- Au3Recorder generated code End --- Edited January 10, 2013 by MKISH fanna1119 1 ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
fanna1119 Posted January 10, 2013 Author Posted January 10, 2013 #include <ButtonConstants.au3> #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include 'MyIPConfig.au3' $Form1 = GUICreate("A problem to solve", 150, 150) $btn = GUICtrlCreateButton('IP Info', 10, 10, 90, 30, $BS_BITMAP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $btn _Button_Function() EndSwitch WEnd Perhaps, this is the ans. to ur question. Here is the modified version of your posted file. #region ---Au3Recorder generated code Start (v3.3.7.0) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- Func _Button_Function() Run('C:\Windows\System32\cmd.exe') _WinWaitActivate("C:\Windows\System32\cmd.exe","") Send("ipconfig{ENTER}") MouseClick("right",14,55,1) MouseClick("left",68,73,1) _WinWaitActivate("Mark C:\Windows\System32\cmd.exe","") MouseMove(13,52) MouseDown("left") MouseMove(635,306) MouseUp("left") _WinWaitActivate("Select C:\Windows\System32\cmd.exe","") Send("{Enter}") Run('C:\Windows\System32\notepad.exe') _WinWaitActivate("Untitled - Notepad","") Send("{CTRLDOWN}v{CTRLUP}") EndFunc #endregion --- Au3Recorder generated code End --- THANK YOU so much for your help
stormbreaker Posted January 10, 2013 Posted January 10, 2013 Glad it works for you... thanks for the 'LIKE'. Regards, MKISH ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
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